aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dir-item.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/dir-item.c')
-rw-r--r--fs/btrfs/dir-item.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index ff10cf5a8422..d5db8bdea3d8 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -47,6 +47,8 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle
47 if (ret) 47 if (ret)
48 return ERR_PTR(ret); 48 return ERR_PTR(ret);
49 } 49 }
50 if (ret < 0)
51 return ERR_PTR(ret);
50 WARN_ON(ret > 0); 52 WARN_ON(ret > 0);
51 leaf = btrfs_buffer_leaf(path->nodes[0]); 53 leaf = btrfs_buffer_leaf(path->nodes[0]);
52 item = leaf->items + path->slots[0]; 54 item = leaf->items + path->slots[0];
@@ -225,14 +227,13 @@ int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
225 struct btrfs_leaf *leaf; 227 struct btrfs_leaf *leaf;
226 u32 sub_item_len; 228 u32 sub_item_len;
227 u32 item_len; 229 u32 item_len;
228 int ret; 230 int ret = 0;
229 231
230 leaf = btrfs_buffer_leaf(path->nodes[0]); 232 leaf = btrfs_buffer_leaf(path->nodes[0]);
231 sub_item_len = sizeof(*di) + btrfs_dir_name_len(di); 233 sub_item_len = sizeof(*di) + btrfs_dir_name_len(di);
232 item_len = btrfs_item_size(leaf->items + path->slots[0]); 234 item_len = btrfs_item_size(leaf->items + path->slots[0]);
233 if (sub_item_len == btrfs_item_size(leaf->items + path->slots[0])) { 235 if (sub_item_len == btrfs_item_size(leaf->items + path->slots[0])) {
234 ret = btrfs_del_item(trans, root, path); 236 ret = btrfs_del_item(trans, root, path);
235 BUG_ON(ret);
236 } else { 237 } else {
237 char *ptr = (char *)di; 238 char *ptr = (char *)di;
238 char *start = btrfs_item_ptr(leaf, path->slots[0], char); 239 char *start = btrfs_item_ptr(leaf, path->slots[0], char);
@@ -240,7 +241,6 @@ int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
240 item_len - (ptr + sub_item_len - start)); 241 item_len - (ptr + sub_item_len - start));
241 ret = btrfs_truncate_item(trans, root, path, 242 ret = btrfs_truncate_item(trans, root, path,
242 item_len - sub_item_len); 243 item_len - sub_item_len);
243 BUG_ON(ret);
244 } 244 }
245 return 0; 245 return 0;
246} 246}