btrfs-progs: update btrfs_extend_item to match the kernel definition

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>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Josef Bacik 2023-08-23 10:32:37 -04:00 committed by David Sterba
parent 1c4139a325
commit 95efaee986
6 changed files with 9 additions and 18 deletions

View File

@ -2661,10 +2661,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;
@ -2712,12 +2710,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;
}
/*
@ -3366,7 +3362,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);

View File

@ -974,8 +974,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,

View File

@ -48,8 +48,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);

View File

@ -1039,7 +1039,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);
@ -1048,8 +1047,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);

View File

@ -282,8 +282,7 @@ int btrfs_csum_file_block(struct btrfs_trans_handle *trans, u64 logical,
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;
}

View File

@ -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;
}