btrfs: eliminate total_size parameter from setup_items_for_insert
The value of this argument can be derived from the total_data as it's simply the value of the data size + size of btrfs_items being touched. Move the parameter calculation inside the function. This results in a simpler interface and also a minor size reduction: ./scripts/bloat-o-meter ctree.original fs/btrfs/ctree.o add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-34 (-34) Function old new delta btrfs_duplicate_item 260 259 -1 setup_items_for_insert 1200 1190 -10 btrfs_insert_empty_items 177 154 -23 Reviewed-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:

committed by
David Sterba

parent
fc0716c2f6
commit
3dc9dc8969
@@ -33,8 +33,7 @@ static void insert_extent(struct btrfs_root *root, u64 start, u64 len,
|
||||
key.type = BTRFS_EXTENT_DATA_KEY;
|
||||
key.offset = start;
|
||||
|
||||
setup_items_for_insert(root, &path, &key, &value_len, value_len,
|
||||
value_len + sizeof(struct btrfs_item), 1);
|
||||
setup_items_for_insert(root, &path, &key, &value_len, value_len, 1);
|
||||
fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item);
|
||||
btrfs_set_file_extent_generation(leaf, fi, 1);
|
||||
btrfs_set_file_extent_type(leaf, fi, type);
|
||||
@@ -64,8 +63,7 @@ static void insert_inode_item_key(struct btrfs_root *root)
|
||||
key.type = BTRFS_INODE_ITEM_KEY;
|
||||
key.offset = 0;
|
||||
|
||||
setup_items_for_insert(root, &path, &key, &value_len, value_len,
|
||||
value_len + sizeof(struct btrfs_item), 1);
|
||||
setup_items_for_insert(root, &path, &key, &value_len, value_len, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user