@@ -2513,10 +2513,8 @@ void btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end)
}
}
-int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
- u32 data_size)
+void btrfs_extend_item(struct btrfs_path *path, u32 data_size)
{
- int ret = 0;
int slot;
struct extent_buffer *leaf;
u32 nritems;
@@ -2564,12 +2562,10 @@ int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
btrfs_set_item_size(leaf, slot, old_size + data_size);
btrfs_mark_buffer_dirty(leaf);
- ret = 0;
if (btrfs_leaf_free_space(leaf) < 0) {
btrfs_print_leaf(leaf);
BUG();
}
- return ret;
}
/*
@@ -3218,7 +3214,7 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, u8 *uuid, u8 type,
* ret == -EEXIST case, An item with that type already exists.
* Extend the item and store the new subvol_id at the end.
*/
- btrfs_extend_item(uuid_root, path, sizeof(subvol_id_le));
+ btrfs_extend_item(path, sizeof(subvol_id_le));
eb = path->nodes[0];
slot = path->slots[0];
offset = btrfs_item_ptr_offset(eb, slot);
@@ -967,8 +967,7 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
struct extent_buffer **cow_ret, u64 new_root_objectid);
int btrfs_create_root(struct btrfs_trans_handle *trans,
struct btrfs_fs_info *fs_info, u64 objectid);
-int btrfs_extend_item(struct btrfs_root *root, struct btrfs_path *path,
- u32 data_size);
+void btrfs_extend_item(struct btrfs_path *path, u32 data_size);
void btrfs_truncate_item(struct btrfs_path *path, u32 new_size, int from_end);
int btrfs_split_item(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
@@ -40,8 +40,8 @@ static struct btrfs_dir_item *insert_with_overflow(struct btrfs_trans_handle
di = btrfs_match_dir_item_name(root, path, name, name_len);
if (di)
return ERR_PTR(-EEXIST);
- ret = btrfs_extend_item(root, path, data_size);
- WARN_ON(ret > 0);
+ btrfs_extend_item(path, data_size);
+ ret = 0;
}
if (ret < 0)
return ERR_PTR(ret);
@@ -1040,7 +1040,6 @@ static int setup_inline_extent_backref(struct btrfs_root *root,
u64 refs;
int size;
int type;
- int ret;
leaf = path->nodes[0];
ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item);
@@ -1049,8 +1048,7 @@ static int setup_inline_extent_backref(struct btrfs_root *root,
type = extent_ref_type(parent, owner);
size = btrfs_extent_inline_ref_size(type);
- ret = btrfs_extend_item(root, path, size);
- BUG_ON(ret);
+ btrfs_extend_item(path, size);
ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item);
refs = btrfs_extent_refs(leaf, ei);
@@ -293,8 +293,7 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans,
diff = diff - btrfs_item_size(leaf, path->slots[0]);
if (diff != csum_size)
goto insert;
- ret = btrfs_extend_item(root, path, diff);
- BUG_ON(ret);
+ btrfs_extend_item(path, diff);
goto csum;
}
@@ -78,8 +78,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
goto out;
old_size = btrfs_item_size(path->nodes[0], path->slots[0]);
- ret = btrfs_extend_item(root, path, ins_len);
- BUG_ON(ret);
+ btrfs_extend_item(path, ins_len);
ref = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_inode_ref);
ref = (struct btrfs_inode_ref *)((unsigned long)ref + old_size);
@@ -352,7 +351,7 @@ int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans,
name, name_len, NULL))
goto out;
- btrfs_extend_item(root, path, ins_len);
+ btrfs_extend_item(path, ins_len);
ret = 0;
}
@@ -232,8 +232,7 @@ static int csum_file_block(struct btrfs_trans_handle *trans,
diff = diff - btrfs_item_size(leaf, path->slots[0]);
if (diff != csum_size)
goto insert;
- ret = btrfs_extend_item(csum_root, path, diff);
- BUG_ON(ret);
+ btrfs_extend_item(path, diff);
goto csum;
}
Similar to btrfs_truncate_item(), this is void in the kernel as the failure case is simply BUG_ON(). Additionally there is no root parameter as it's not used in the function at all. Make these changes and update the callers. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- kernel-shared/ctree.c | 8 ++------ kernel-shared/ctree.h | 3 +-- kernel-shared/dir-item.c | 4 ++-- kernel-shared/extent-tree.c | 4 +--- kernel-shared/file-item.c | 3 +-- kernel-shared/inode-item.c | 5 ++--- tune/change-csum.c | 3 +-- 7 files changed, 10 insertions(+), 20 deletions(-)