Cleanup, remove superfluous blocksize parameter
cover Cleanup, remove superfluous blocksize parameter
First portion of cleanups that remove a parameter that's being passed to a lot of functions, although the value does not change during the filesystem lifetime. This part contains the obvious and safe changes, but there are more pending that start to touch functionality and haven't not passed xfstests without warnings.
You can pull from
git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git cleanup/blocksize-diet-part1
David Sterba (6):
btrfs: remove unused parameter from readahead_tree_block
btrfs: return void from readahead_tree_block
btrfs: inline code of reada_tree_block and remove it
btrfs: remove parameter blocksize from read_tree_block
btrfs: remove unused parameter blocksize from btrfs_find_tree_block
btrfs: remove blocksize from btrfs_alloc_free_block and rename
fs/btrfs/backref.c | 6 ++---- fs/btrfs/ctree.c | 54 ++++++++++++++++++++------------------------------ fs/btrfs/ctree.h | 6 +++--- fs/btrfs/disk-io.c | 37 +++++++++++----------------------- fs/btrfs/disk-io.h | 7 +++---- fs/btrfs/extent-tree.c | 20 ++++++++----------- fs/btrfs/ioctl.c | 3 +-- fs/btrfs/print-tree.c | 1 - fs/btrfs/relocation.c | 28 ++++++-------------------- 9 files changed, 57 insertions(+), 105 deletions(-)
Signature · 1 line
1.8.4.5
PATCH 1/6 btrfs: remove unused parameter from readahead_tree_block
The parent_transid parameter has been unused since its introduction in ca7a79ad8dbe2466 ("Pass down the expected generation number when reading tree blocks"). In reada_tree_block, it was even wrongly set to leafsize. Transid check is done in the proper read and readahead ignores errors.
--- fs/btrfs/ctree.c | 6 +++--- fs/btrfs/disk-io.c | 3 +-- fs/btrfs/disk-io.h | 3 +-- fs/btrfs/extent-tree.c | 3 +-- fs/btrfs/relocation.c | 9 ++------- 5 files changed, 8 insertions(+), 16 deletions(-)
fs/btrfs/ctree.c +3 -3
@@ -2298,7 +2298,7 @@ static void reada_for_search(struct btrfs_root *root,if ((search <= target && target - search <=65536 ) || (search > target && search - target <=65536 )) { gen =btrfs_node_ptr_generation (node, nr); -readahead_tree_block (root, search, blocksize, gen); +readahead_tree_block (root, search, blocksize); nread += blocksize; } nscan++;
@@ -2350,9 +2350,9 @@ static noinline void reada_for_balance(struct btrfs_root *root, }if (block1) -readahead_tree_block (root, block1, blocksize,0 ); +readahead_tree_block (root, block1, blocksize);if (block2) -readahead_tree_block (root, block2, blocksize,0 ); +readahead_tree_block (root, block2, blocksize); }
fs/btrfs/disk-io.c +1 -2
@@ -1062,8 +1062,7 @@ static const struct address_space_operations btree_aops = { .set_page_dirty = btree_set_page_dirty, }; -int readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize, -u64 parent_transid) +int readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize) {struct extent_buffer *buf =NULL ;struct inode *btree_inode = root->fs_info->btree_inode;
fs/btrfs/disk-io.h +1 -2
@@ -46,8 +46,7 @@ struct btrfs_fs_devices;struct extent_buffer *read_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize,u64 parent_transid); -int readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize, -u64 parent_transid); +int readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize);int reada_tree_block_flagged (struct btrfs_root *root,u64 bytenr,u32 blocksize,int mirror_num,struct extent_buffer **eb); struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root,
fs/btrfs/extent-tree.c +1 -2
@@ -7486,8 +7486,7 @@ static noinline void reada_walk_down(struct btrfs_trans_handle *trans,continue ; } reada: - ret =readahead_tree_block (root, bytenr, blocksize, - generation); + ret =readahead_tree_block (root, bytenr, blocksize);if (ret)break ; nread++;
fs/btrfs/relocation.c +2 -7
@@ -2861,13 +2861,8 @@ static int reada_tree_block(struct reloc_control *rc, struct tree_block *block) {BUG_ON (block->key_ready); -if (block->key.type ==BTRFS_METADATA_ITEM_KEY ) -readahead_tree_block (rc->extent_root, block->bytenr, - block->key.objectid, - rc->extent_root->nodesize); -else -readahead_tree_block (rc->extent_root, block->bytenr, - block->key.objectid, block->key.offset); +readahead_tree_block (rc->extent_root, block->bytenr, + block->key.objectid);return 0 ; }
Signature · 1 line
1.8.4.5
PATCH 2/6 btrfs: return void from readahead_tree_block
In reply to David SterbaErrors in readahead are not fatal and ignored elsewhere in the code.
--- fs/btrfs/disk-io.c | 6 ++---- fs/btrfs/disk-io.h | 2 +- fs/btrfs/extent-tree.c | 4 +--- 3 files changed, 4 insertions(+), 8 deletions(-)
fs/btrfs/disk-io.c +2 -4
@@ -1062,19 +1062,17 @@ static const struct address_space_operations btree_aops = { .set_page_dirty = btree_set_page_dirty, }; -int readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize) +void readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize) {struct extent_buffer *buf =NULL ;struct inode *btree_inode = root->fs_info->btree_inode; -int ret =0 ; buf =btrfs_find_create_tree_block (root, bytenr, blocksize);if (!buf) -return 0 ; +return ;read_extent_buffer_pages (&BTRFS_I (btree_inode)->io_tree, buf,0 ,WAIT_NONE , btree_get_extent,0 );free_extent_buffer (buf); -return ret; } int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, u32 blocksize,
fs/btrfs/disk-io.h +1 -1
@@ -46,7 +46,7 @@ struct btrfs_fs_devices;struct extent_buffer *read_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize,u64 parent_transid); -int readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize); +void readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize);int reada_tree_block_flagged (struct btrfs_root *root,u64 bytenr,u32 blocksize,int mirror_num,struct extent_buffer **eb); struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root,
fs/btrfs/extent-tree.c +1 -3
@@ -7486,9 +7486,7 @@ static noinline void reada_walk_down(struct btrfs_trans_handle *trans,continue ; } reada: - ret =readahead_tree_block (root, bytenr, blocksize); -if (ret) -break ; +readahead_tree_block (root, bytenr, blocksize); nread++; } wc->reada_slot = slot;
Signature · 1 line
1.8.4.5
PATCH 3/6 btrfs: inline code of reada_tree_block and remove it
In reply to David SterbaIt's trivial with a single user. And remove one pointless BUG_ON.
--- fs/btrfs/relocation.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
fs/btrfs/relocation.c +2 -10
@@ -2857,15 +2857,6 @@ static int get_tree_block_key(struct reloc_control *rc,return 0 ; } -static int reada_tree_block (struct reloc_control *rc, -struct tree_block *block) -{ -BUG_ON (block->key_ready); -readahead_tree_block (rc->extent_root, block->bytenr, - block->key.objectid); -return 0 ; -} -/* * helper function to relocate a tree block */
@@ -2945,7 +2936,8 @@ int relocate_tree_blocks(struct btrfs_trans_handle *trans,while (rb_node) { block = rb_entry(rb_node, struct tree_block, rb_node);if (!block->key_ready) -reada_tree_block (rc, block); +readahead_tree_block (rc->extent_root, block->bytenr, + block->key.objectid); rb_node =rb_next (rb_node); }
Signature · 1 line
1.8.4.5
PATCH 4/6 btrfs: remove parameter blocksize from read_tree_block
In reply to David SterbaWe know the tree block size, no need to pass it around.
--- fs/btrfs/backref.c | 6 ++---- fs/btrfs/ctree.c | 10 +++------- fs/btrfs/disk-io.c | 17 +++++------------ fs/btrfs/disk-io.h | 2 +- fs/btrfs/extent-tree.c | 8 +++----- fs/btrfs/print-tree.c | 1 - fs/btrfs/relocation.c | 11 ++++------- 7 files changed, 18 insertions(+), 37 deletions(-)
fs/btrfs/backref.c +2 -4
@@ -490,7 +490,7 @@ static int __add_missing_keys(struct btrfs_fs_info *fs_info,continue ;BUG_ON (!ref->wanted_disk_byte); eb =read_tree_block (fs_info->tree_root, ref->wanted_disk_byte, - fs_info->tree_root->nodesize,0 ); +0 );if (!eb || !extent_buffer_uptodate (eb)) {free_extent_buffer (eb);return -EIO ;
@@ -1028,12 +1028,10 @@ again:if (ref->count && ref->parent) {if (extent_item_pos && !ref->inode_list && ref->level ==0 ) { -u32 bsz;struct extent_buffer *eb; - bsz = fs_info->extent_root->nodesize; eb =read_tree_block (fs_info->extent_root, - ref->parent, bsz,0 ); + ref->parent,0 );if (!eb || !extent_buffer_uptodate (eb)) {free_extent_buffer (eb); ret = -EIO ;
fs/btrfs/ctree.c +3 -7
@@ -1425,7 +1425,6 @@ get_old_root(struct btrfs_root *root, u64 time_seq)struct tree_mod_root *old_root =NULL ;u64 old_generation =0 ;u64 logical; -u32 blocksize; eb_root =btrfs_read_lock_root_node (root); tm =__tree_mod_log_oldest_root (root->fs_info, eb_root, time_seq);
@@ -1444,8 +1443,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq)if (old_root && tm && tm->op !=MOD_LOG_KEY_REMOVE_WHILE_FREEING ) {btrfs_tree_read_unlock (eb_root);free_extent_buffer (eb_root); - blocksize = root->nodesize; - old =read_tree_block (root, logical, blocksize,0 ); + old =read_tree_block (root, logical,0 );if (WARN_ON (!old || !extent_buffer_uptodate (old))) {free_extent_buffer (old); btrfs_warn(root->fs_info,
@@ -1692,8 +1690,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, uptodate =0 ;if (!cur || !uptodate) {if (!cur) { - cur =read_tree_block (root, blocknr, - blocksize, gen); + cur =read_tree_block (root, blocknr, gen);if (!cur || !extent_buffer_uptodate (cur)) {free_extent_buffer (cur);return -EIO ;
@@ -1872,7 +1869,6 @@ static noinline struct extent_buffer *read_node_slot(struct btrfs_root *root,BUG_ON (level ==0 ); eb =read_tree_block (root,btrfs_node_blockptr (parent, slot), - root->nodesize,btrfs_node_ptr_generation (parent, slot));if (eb && !extent_buffer_uptodate (eb)) {free_extent_buffer (eb);
@@ -2507,7 +2503,7 @@ read_block_for_search(struct btrfs_trans_handle *trans,btrfs_release_path (p); ret = -EAGAIN ; - tmp =read_tree_block (root, blocknr, blocksize,0 ); + tmp =read_tree_block (root, blocknr,0 );if (tmp) {/* * If the read above didn't mark this buffer up to date,
fs/btrfs/disk-io.c +5 -12
@@ -1138,12 +1138,12 @@ int btrfs_wait_tree_block_writeback(struct extent_buffer *buf) }struct extent_buffer *read_tree_block (struct btrfs_root *root,u64 bytenr, -u32 blocksize,u64 parent_transid) +u64 parent_transid) {struct extent_buffer *buf =NULL ;int ret; - buf =btrfs_find_create_tree_block (root, bytenr, blocksize); + buf =btrfs_find_create_tree_block (root, bytenr, root->nodesize);if (!buf)return NULL ;
@@ -1484,7 +1484,6 @@ static struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root,struct btrfs_fs_info *fs_info = tree_root->fs_info;struct btrfs_path *path;u64 generation; -u32 blocksize;int ret; path =btrfs_alloc_path ();
@@ -1509,9 +1508,8 @@ static struct btrfs_root *btrfs_read_tree_root(struct btrfs_root *tree_root, } generation =btrfs_root_generation (&root->root_item); - blocksize = root->nodesize; root->node =read_tree_block (root,btrfs_root_bytenr (&root->root_item), - blocksize, generation); + generation);if (!root->node) { ret = -ENOMEM ; goto find_fail;
@@ -2139,7 +2137,6 @@ int open_ctree(struct super_block *sb, {u32 sectorsize;u32 nodesize; -u32 blocksize;u32 stripesize;u64 generation;u64 features;
@@ -2643,7 +2640,6 @@ int open_ctree(struct super_block *sb, goto fail_sb_buffer; } - blocksize = tree_root->nodesize; generation =btrfs_super_chunk_root_generation (disk_super); __setup_root(nodesize, sectorsize, stripesize, chunk_root,
@@ -2651,7 +2647,7 @@ int open_ctree(struct super_block *sb, chunk_root->node =read_tree_block (chunk_root,btrfs_super_chunk_root (disk_super), - blocksize, generation); + generation);if (!chunk_root->node || !test_bit (EXTENT_BUFFER_UPTODATE , &chunk_root->node->bflags)) { printk(KERN_WARNING "BTRFS: failed to read chunk root on %s\n",
@@ -2684,12 +2680,11 @@ int open_ctree(struct super_block *sb, } retry_root_backup: - blocksize = tree_root->nodesize; generation =btrfs_super_generation (disk_super); tree_root->node =read_tree_block (tree_root,btrfs_super_root (disk_super), - blocksize, generation); + generation);if (!tree_root->node || !test_bit (EXTENT_BUFFER_UPTODATE , &tree_root->node->bflags)) { printk(KERN_WARNING "BTRFS: failed to read tree root on %s\n",
@@ -2858,7 +2853,6 @@ retry_root_backup: err = -EIO ; goto fail_qgroup; } - blocksize = tree_root->nodesize; log_tree_root =btrfs_alloc_root (fs_info);if (!log_tree_root) {
@@ -2870,7 +2864,6 @@ retry_root_backup: log_tree_root, fs_info, BTRFS_TREE_LOG_OBJECTID); log_tree_root->node =read_tree_block (tree_root, bytenr, - blocksize, generation +1 );if (!log_tree_root->node || !extent_buffer_uptodate (log_tree_root->node)) {
fs/btrfs/disk-io.h +1 -1
@@ -45,7 +45,7 @@ struct btrfs_device;struct btrfs_fs_devices ;struct extent_buffer *read_tree_block (struct btrfs_root *root,u64 bytenr, -u32 blocksize,u64 parent_transid); +u64 parent_transid);void readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize);int reada_tree_block_flagged (struct btrfs_root *root,u64 bytenr,u32 blocksize,int mirror_num,struct extent_buffer **eb);
fs/btrfs/extent-tree.c +3 -5
@@ -7645,7 +7645,6 @@ walk_down: level = root_level;while (level >=0 ) {if (path->nodes[level] ==NULL ) { -int child_bsize = root->nodesize;int parent_slot;u64 child_gen;u64 child_bytenr;
@@ -7657,8 +7656,7 @@ walk_down: child_bytenr =btrfs_node_blockptr (eb, parent_slot); child_gen =btrfs_node_ptr_generation (eb, parent_slot); - eb =read_tree_block (root, child_bytenr, child_bsize, - child_gen); + eb =read_tree_block (root, child_bytenr, child_gen);if (!eb || !extent_buffer_uptodate (eb)) { ret = -EIO ; goto out;
@@ -7674,7 +7672,7 @@ walk_down: ret =btrfs_qgroup_record_ref (trans, root->fs_info, root->objectid, child_bytenr, - child_bsize, + root->nodesize,BTRFS_QGROUP_OPER_SUB_SUBTREE ,0 );if (ret)
@@ -7889,7 +7887,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,if (!next) {if (reada && level ==1 )reada_walk_down (trans, root, wc, path); - next =read_tree_block (root, bytenr, blocksize, generation); + next =read_tree_block (root, bytenr, generation);if (!next || !extent_buffer_uptodate (next)) {free_extent_buffer (next);return -EIO ;
fs/btrfs/print-tree.c +0 -1
@@ -336,7 +336,6 @@ void btrfs_print_tree(struct btrfs_root *root, struct extent_buffer *c)for (i =0 ; i < nr; i++) {struct extent_buffer *next =read_tree_block (root,btrfs_node_blockptr (c, i), - root->nodesize,btrfs_node_ptr_generation (c, i));if (btrfs_is_leaf (next) && level !=1 )
fs/btrfs/relocation.c +4 -7
@@ -1813,8 +1813,7 @@ again:break ; } - eb =read_tree_block (dest, old_bytenr, blocksize, - old_ptr_gen); + eb =read_tree_block (dest, old_bytenr, old_ptr_gen);if (!eb || !extent_buffer_uptodate (eb)) { ret = (!eb) ? -ENOMEM : -EIO ;free_extent_buffer (eb);
@@ -1944,7 +1943,6 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path,u64 bytenr;u64 ptr_gen =0 ;u64 last_snapshot; -u32 blocksize;u32 nritems; last_snapshot =btrfs_root_last_snapshot (&root->root_item);
@@ -1970,8 +1968,7 @@ int walk_down_reloc_tree(struct btrfs_root *root, struct btrfs_path *path, } bytenr =btrfs_node_blockptr (eb, path->slots[i]); - blocksize = root->nodesize; - eb =read_tree_block (root, bytenr, blocksize, ptr_gen); + eb =read_tree_block (root, bytenr, ptr_gen);if (!eb || !extent_buffer_uptodate (eb)) {free_extent_buffer (eb);return -EIO ;
@@ -2680,7 +2677,7 @@ static int do_relocation(struct btrfs_trans_handle *trans, blocksize = root->nodesize; generation =btrfs_node_ptr_generation (upper->eb, slot); - eb =read_tree_block (root, bytenr, blocksize, generation); + eb =read_tree_block (root, bytenr, generation);if (!eb || !extent_buffer_uptodate (eb)) {free_extent_buffer (eb); err = -EIO ;
@@ -2842,7 +2839,7 @@ static int get_tree_block_key(struct reloc_control *rc,BUG_ON (block->key_ready); eb =read_tree_block (rc->extent_root, block->bytenr, - block->key.objectid, block->key.offset); + block->key.offset);if (!eb || !extent_buffer_uptodate (eb)) {free_extent_buffer (eb);return -EIO ;
Signature · 1 line
1.8.4.5
PATCH 5/6 btrfs: remove unused parameter blocksize from btrfs_find_tree_block
In reply to David Sterba--- fs/btrfs/ctree.c | 12 +++++------- fs/btrfs/disk-io.c | 5 ++--- fs/btrfs/disk-io.h | 2 +- fs/btrfs/extent-tree.c | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-)
fs/btrfs/ctree.c +5 -7
@@ -1683,7 +1683,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,continue ; } - cur =btrfs_find_tree_block (root, blocknr, blocksize); + cur =btrfs_find_tree_block (root, blocknr);if (cur) uptodate =btrfs_buffer_uptodate (cur, gen,0 );else
@@ -2264,7 +2264,7 @@ static void reada_for_search(struct btrfs_root *root, search =btrfs_node_blockptr (node, slot); blocksize = root->nodesize; - eb =btrfs_find_tree_block (root, search, blocksize); + eb =btrfs_find_tree_block (root, search);if (eb) {free_extent_buffer (eb);return ;
@@ -2326,7 +2326,7 @@ static noinline void reada_for_balance(struct btrfs_root *root,if (slot >0 ) { block1 =btrfs_node_blockptr (parent, slot -1 ); gen =btrfs_node_ptr_generation (parent, slot -1 ); - eb =btrfs_find_tree_block (root, block1, blocksize); + eb =btrfs_find_tree_block (root, block1);/* * if we get -eagain from btrfs_buffer_uptodate, we * don't want to return eagain here. That will loop
@@ -2339,7 +2339,7 @@ static noinline void reada_for_balance(struct btrfs_root *root,if (slot +1 < nritems) { block2 =btrfs_node_blockptr (parent, slot +1 ); gen =btrfs_node_ptr_generation (parent, slot +1 ); - eb =btrfs_find_tree_block (root, block2, blocksize); + eb =btrfs_find_tree_block (root, block2);if (eb &&btrfs_buffer_uptodate (eb, gen,1 ) !=0 ) block2 =0 ;free_extent_buffer (eb);
@@ -2450,16 +2450,14 @@ read_block_for_search(struct btrfs_trans_handle *trans, {u64 blocknr;u64 gen; -u32 blocksize;struct extent_buffer *b = *eb_ret;struct extent_buffer *tmp;int ret; blocknr =btrfs_node_blockptr (b, slot); gen =btrfs_node_ptr_generation (b, slot); - blocksize = root->nodesize; - tmp =btrfs_find_tree_block (root, blocknr, blocksize); + tmp =btrfs_find_tree_block (root, blocknr);if (tmp) {/* first we do an atomic uptodate check */ if (btrfs_buffer_uptodate (tmp, gen,1 ) >0 ) {
fs/btrfs/disk-io.c +2 -3
@@ -1108,7 +1108,7 @@ int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, u32 blocksize, }struct extent_buffer *btrfs_find_tree_block (struct btrfs_root *root, -u64 bytenr,u32 blocksize) +u64 bytenr) {return find_extent_buffer (root->fs_info, bytenr); }
@@ -4002,8 +4002,7 @@ static int btrfs_destroy_marked_extents(struct btrfs_root *root,clear_extent_bits (dirty_pages, start, end, mark,GFP_NOFS );while (start <= end) { - eb =btrfs_find_tree_block (root, start, - root->nodesize); + eb =btrfs_find_tree_block (root, start); start += root->nodesize;if (!eb)continue ;
fs/btrfs/disk-io.h +1 -1
@@ -62,7 +62,7 @@ int write_ctree_super(struct btrfs_trans_handle *trans,struct buffer_head *btrfs_read_dev_super (struct block_device *bdev);int btrfs_commit_super (struct btrfs_root *root);struct extent_buffer *btrfs_find_tree_block (struct btrfs_root *root, -u64 bytenr,u32 blocksize); +u64 bytenr);struct btrfs_root *btrfs_read_fs_root (struct btrfs_root *tree_root,struct btrfs_key *location);int btrfs_init_fs_root (struct btrfs_root *root);
fs/btrfs/extent-tree.c +1 -1
@@ -7825,7 +7825,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, bytenr =btrfs_node_blockptr (path->nodes[level], path->slots[level]); blocksize = root->nodesize; - next =btrfs_find_tree_block (root, bytenr, blocksize); + next =btrfs_find_tree_block (root, bytenr);if (!next) { next =btrfs_find_create_tree_block (root, bytenr, blocksize);if (!next)
Signature · 1 line
1.8.4.5
PATCH 6/6 btrfs: remove blocksize from btrfs_alloc_free_block and rename
In reply to David SterbaRename to btrfs_alloc_tree_block as it fits to the alloc/find/free + _tree_block family. The parameter blocksize was set to the metadata block size, directly or indirectly.
--- fs/btrfs/ctree.c | 26 +++++++++++--------------- fs/btrfs/ctree.h | 6 +++--- fs/btrfs/disk-io.c | 8 +++----- fs/btrfs/extent-tree.c | 5 +++-- fs/btrfs/ioctl.c | 3 +-- 5 files changed, 21 insertions(+), 27 deletions(-)
fs/btrfs/ctree.c +11 -15
@@ -258,9 +258,8 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,else btrfs_node_key (buf, &disk_key,0 ); - cow =btrfs_alloc_free_block (trans, root, buf->len,0 , - new_root_objectid, &disk_key, level, - buf->start,0 ); + cow =btrfs_alloc_tree_block (trans, root,0 , new_root_objectid, + &disk_key, level, buf->start,0 );if (IS_ERR (cow))return PTR_ERR (cow);
@@ -1133,9 +1132,9 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans, }else parent_start =0 ; - cow =btrfs_alloc_free_block (trans, root, buf->len, parent_start, - root->root_key.objectid, &disk_key, - level, search_start, empty_size); + cow =btrfs_alloc_tree_block (trans, root, parent_start, + root->root_key.objectid, &disk_key, level, + search_start, empty_size);if (IS_ERR (cow))return PTR_ERR (cow);
@@ -3355,9 +3354,8 @@ static noinline int insert_new_root(struct btrfs_trans_handle *trans,else btrfs_node_key (lower, &lower_key,0 ); - c =btrfs_alloc_free_block (trans, root, root->nodesize,0 , - root->root_key.objectid, &lower_key, - level, root->node->start,0 ); + c =btrfs_alloc_tree_block (trans, root,0 , root->root_key.objectid, + &lower_key, level, root->node->start,0 );if (IS_ERR (c))return PTR_ERR (c);
@@ -3495,9 +3493,8 @@ static noinline int split_node(struct btrfs_trans_handle *trans, mid = (c_nritems +1 ) /2 ;btrfs_node_key (c, &disk_key, mid); - split =btrfs_alloc_free_block (trans, root, root->nodesize,0 , - root->root_key.objectid, - &disk_key, level, c->start,0 ); + split =btrfs_alloc_tree_block (trans, root,0 , root->root_key.objectid, + &disk_key, level, c->start,0 );if (IS_ERR (split))return PTR_ERR (split);
@@ -4275,9 +4272,8 @@ again:else btrfs_item_key (l, &disk_key, mid); - right =btrfs_alloc_free_block (trans, root, root->nodesize,0 , - root->root_key.objectid, - &disk_key,0 , l->start,0 ); + right =btrfs_alloc_tree_block (trans, root,0 , root->root_key.objectid, + &disk_key,0 , l->start,0 );if (IS_ERR (right))return PTR_ERR (right);
fs/btrfs/ctree.h +3 -3
@@ -3290,9 +3290,9 @@ struct btrfs_block_group_cache *btrfs_lookup_block_group( u64 bytenr);void btrfs_put_block_group (struct btrfs_block_group_cache *cache);int get_block_group_index (struct btrfs_block_group_cache *cache); -struct extent_buffer *btrfs_alloc_free_block (struct btrfs_trans_handle *trans, -struct btrfs_root *root,u32 blocksize, -u64 parent,u64 root_objectid, +struct extent_buffer *btrfs_alloc_tree_block (struct btrfs_trans_handle *trans, +struct btrfs_root *root,u64 parent, +u64 root_objectid,struct btrfs_disk_key *key,int level,u64 hint,u64 empty_size); void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
fs/btrfs/disk-io.c +3 -5
@@ -1324,8 +1324,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans, root->root_key.type =BTRFS_ROOT_ITEM_KEY ; root->root_key.offset =0 ; - leaf =btrfs_alloc_free_block (trans, root, root->nodesize, -0 , objectid,NULL ,0 ,0 ,0 ); + leaf =btrfs_alloc_tree_block (trans, root,0 , objectid,NULL ,0 ,0 ,0 );if (IS_ERR (leaf)) { ret =PTR_ERR (leaf); leaf =NULL ;
@@ -1412,9 +1411,8 @@ static struct btrfs_root *alloc_log_tree(struct btrfs_trans_handle *trans,* updated (along with back refs to the log tree). */ - leaf =btrfs_alloc_free_block (trans, root, root->nodesize,0 , -BTRFS_TREE_LOG_OBJECTID ,NULL , -0 ,0 ,0 ); + leaf =btrfs_alloc_tree_block (trans, root,0 ,BTRFS_TREE_LOG_OBJECTID , +NULL ,0 ,0 ,0 );if (IS_ERR (leaf)) {kfree (root);return ERR_CAST (leaf);
fs/btrfs/extent-tree.c +3 -2
@@ -7322,8 +7322,8 @@ static void unuse_block_rsv(struct btrfs_fs_info *fs_info,* * returns the tree buffer or NULL. */ -struct extent_buffer *btrfs_alloc_free_block (struct btrfs_trans_handle *trans, -struct btrfs_root *root,u32 blocksize, +struct extent_buffer *btrfs_alloc_tree_block (struct btrfs_trans_handle *trans, +struct btrfs_root *root,u64 parent,u64 root_objectid,struct btrfs_disk_key *key,int level,u64 hint,u64 empty_size)
@@ -7333,6 +7333,7 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,struct extent_buffer *buf;u64 flags =0 ;int ret; +u32 blocksize = root->nodesize;bool skinny_metadata =btrfs_fs_incompat (root->fs_info,SKINNY_METADATA );
fs/btrfs/ioctl.c +1 -2
@@ -480,8 +480,7 @@ static noinline int create_subvol(struct inode *dir,if (ret) goto fail; - leaf =btrfs_alloc_free_block (trans, root, root->nodesize, -0 , objectid,NULL ,0 ,0 ,0 ); + leaf =btrfs_alloc_tree_block (trans, root,0 , objectid,NULL ,0 ,0 ,0 );if (IS_ERR (leaf)) { ret =PTR_ERR (leaf); goto fail;
Signature · 1 line
1.8.4.5