Cleanup, remove superfluous blocksize parameter, part 2
Here's the rest of the parameter removal, no warnings anymore and passed xfstests. There are a few more clenaups that were required to finish the goal.
You can pull from
git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git cleanup/blocksize-diet-part2
Based on current next branch 9627aeee3e203e30679549e4962633698a6bf87f, top commit ce3e69847e3ec79a38421bfd3d6f554d5e481231
David Sterba (9):
btrfs: sink blocksize parameter to readahead_tree_block
btrfs: remove blocksize from reada_extent
btrfs: sink blocksize parameter to reada_tree_block_flagged
btrfs: sink blocksize parameter to btrfs_init_new_buffer
btrfs: sink blocksize parameter to btrfs_find_create_tree_block
btrfs: sink blocksize parameter to tree_block_processed
btrfs: use GFP_NOFS in __alloc_extent_buffer directly
btrfs: unify extent buffer allocation api
btrfs: sink parameter len to alloc_extent_buffer
fs/btrfs/ctree.c | 13 +++++-------- fs/btrfs/disk-io.c | 17 ++++++++--------- fs/btrfs/disk-io.h | 6 +++--- fs/btrfs/extent-tree.c | 13 ++++++------- fs/btrfs/extent_io.c | 34 ++++++++++++++++++++++++---------- fs/btrfs/extent_io.h | 7 ++++--- fs/btrfs/reada.c | 15 ++++++--------- fs/btrfs/relocation.c | 12 ++++++------ fs/btrfs/tests/extent-buffer-tests.c | 2 +- fs/btrfs/tests/inode-tests.c | 4 ++-- fs/btrfs/tests/qgroup-tests.c | 23 +++++++++++------------ fs/btrfs/tree-log.c | 2 +- fs/btrfs/volumes.c | 9 +++++++-- 13 files changed, 84 insertions(+), 73 deletions(-)
Signature · 1 line
2.1.3
PATCH 1/9 btrfs: sink blocksize parameter to readahead_tree_block
All callers pass nodesize.
--- fs/btrfs/ctree.c | 8 +++----- fs/btrfs/disk-io.c | 4 ++-- fs/btrfs/disk-io.h | 2 +- fs/btrfs/extent-tree.c | 2 +- fs/btrfs/relocation.c | 3 +-- 5 files changed, 8 insertions(+), 11 deletions(-)
fs/btrfs/ctree.c +3 -5
@@ -2282,7 +2282,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); +readahead_tree_block (root, search); nread += blocksize; } nscan++;
@@ -2301,7 +2301,6 @@ static noinline void reada_for_balance(struct btrfs_root *root,u64 gen;u64 block1 =0 ;u64 block2 =0 ; -int blocksize; parent = path->nodes[level +1 ];if (!parent)
@@ -2309,7 +2308,6 @@ static noinline void reada_for_balance(struct btrfs_root *root, nritems =btrfs_header_nritems (parent); slot = path->slots[level +1 ]; - blocksize = root->nodesize;if (slot >0 ) { block1 =btrfs_node_blockptr (parent, slot -1 );
@@ -2334,9 +2332,9 @@ static noinline void reada_for_balance(struct btrfs_root *root, }if (block1) -readahead_tree_block (root, block1, blocksize); +readahead_tree_block (root, block1);if (block2) -readahead_tree_block (root, block2, blocksize); +readahead_tree_block (root, block2); }
fs/btrfs/disk-io.c +2 -2
@@ -1073,12 +1073,12 @@ static const struct address_space_operations btree_aops = { .set_page_dirty = btree_set_page_dirty, }; -void readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize) +void readahead_tree_block (struct btrfs_root *root,u64 bytenr) {struct extent_buffer *buf =NULL ;struct inode *btree_inode = root->fs_info->btree_inode; - buf =btrfs_find_create_tree_block (root, bytenr, blocksize); + buf =btrfs_find_create_tree_block (root, bytenr, root->nodesize);if (!buf)return ; read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree,
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,u64 parent_transid); -void readahead_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize); +void readahead_tree_block (struct btrfs_root *root,u64 bytenr);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 -1
@@ -7485,7 +7485,7 @@ static noinline void reada_walk_down(struct btrfs_trans_handle *trans,continue ; } reada: -readahead_tree_block (root, bytenr, blocksize); +readahead_tree_block (root, bytenr); nread++; } wc->reada_slot = slot;
fs/btrfs/relocation.c +1 -2
@@ -2965,8 +2965,7 @@ 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) -readahead_tree_block (rc->extent_root, block->bytenr, - block->key.objectid); +readahead_tree_block (rc->extent_root, block->bytenr); rb_node =rb_next (rb_node); }
Signature · 1 line
2.1.3
PATCH 2/9 btrfs: remove blocksize from reada_extent
In reply to David SterbaReplace with global nodesize instead.
--- fs/btrfs/reada.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
fs/btrfs/reada.c +6 -9
@@ -66,7 +66,6 @@ struct reada_extctl {struct reada_extent {u64 logical;struct btrfs_key top; -u32 blocksize;int err;struct list_head extctl;int refcnt;
@@ -349,7 +348,6 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root, blocksize = root->nodesize; re->logical = logical; - re->blocksize = blocksize; re->top = *top;INIT_LIST_HEAD (&re->extctl);spin_lock_init (&re->lock);
@@ -660,7 +658,6 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,int mirror_num =0 ;struct extent_buffer *eb =NULL ;u64 logical; -u32 blocksize;int ret;int i;int need_kick =0 ;
@@ -694,7 +691,7 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,spin_unlock (&fs_info->reada_lock);return 0 ; } - dev->reada_next = re->logical + re->blocksize; + dev->reada_next = re->logical + fs_info->tree_root->nodesize; re->refcnt++;spin_unlock (&fs_info->reada_lock);
@@ -709,7 +706,6 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info, } } logical = re->logical; - blocksize = re->blocksize;spin_lock (&re->lock);if (re->scheduled_for ==NULL ) {
@@ -724,8 +720,8 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,return 0 ;atomic_inc (&dev->reada_in_flight); - ret =reada_tree_block_flagged (fs_info->extent_root, logical, blocksize, - mirror_num, &eb); + ret =reada_tree_block_flagged (fs_info->extent_root, logical, + fs_info->tree_root->nodesize, mirror_num, &eb);if (ret)__readahead_hook (fs_info->extent_root,NULL , logical, ret);else if (eb)
@@ -851,7 +847,7 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all)break ;printk (KERN_DEBUG " re: logical %llu size %u empty %d for %lld" , - re->logical, re->blocksize, + re->logical, fs_info->tree_root->nodesize,list_empty (&re->extctl), re->scheduled_for ? re->scheduled_for->devid :-1 );
@@ -886,7 +882,8 @@ static void dump_devs(struct btrfs_fs_info *fs_info, int all) }printk (KERN_DEBUG "re: logical %llu size %u list empty %d for %lld" , - re->logical, re->blocksize,list_empty (&re->extctl), + re->logical, fs_info->tree_root->nodesize, +list_empty (&re->extctl), re->scheduled_for ? re->scheduled_for->devid :-1 );for (i =0 ; i < re->nzones; ++i) { printk(KERN_CONT " zone %llu-%llu devs",
Signature · 1 line
2.1.3
PATCH 3/9 btrfs: sink blocksize parameter to reada_tree_block_flagged
In reply to David Sterba--- fs/btrfs/disk-io.c | 4 ++-- fs/btrfs/disk-io.h | 2 +- fs/btrfs/reada.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
fs/btrfs/disk-io.c +2 -2
@@ -1086,7 +1086,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr)free_extent_buffer (buf); } -int reada_tree_block_flagged (struct btrfs_root *root,u64 bytenr,u32 blocksize, +int reada_tree_block_flagged (struct btrfs_root *root,u64 bytenr,int mirror_num,struct extent_buffer **eb) {struct extent_buffer *buf =NULL ;
@@ -1094,7 +1094,7 @@ int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr, u32 blocksize,struct extent_io_tree *io_tree = &BTRFS_I (btree_inode)->io_tree;int ret; - buf =btrfs_find_create_tree_block (root, bytenr, blocksize); + buf =btrfs_find_create_tree_block (root, bytenr, root->nodesize);if (!buf)return 0 ;
fs/btrfs/disk-io.h +1 -1
@@ -47,7 +47,7 @@ struct btrfs_fs_devices;struct extent_buffer *read_tree_block (struct btrfs_root *root,u64 bytenr,u64 parent_transid);void readahead_tree_block (struct btrfs_root *root,u64 bytenr); -int reada_tree_block_flagged (struct btrfs_root *root,u64 bytenr,u32 blocksize, +int reada_tree_block_flagged (struct btrfs_root *root,u64 bytenr,int mirror_num,struct extent_buffer **eb);struct extent_buffer *btrfs_find_create_tree_block (struct btrfs_root *root,u64 bytenr,u32 blocksize);
fs/btrfs/reada.c +1 -1
@@ -721,7 +721,7 @@ static int reada_start_machine_dev(struct btrfs_fs_info *fs_info,atomic_inc (&dev->reada_in_flight); ret =reada_tree_block_flagged (fs_info->extent_root, logical, - fs_info->tree_root->nodesize, mirror_num, &eb); + mirror_num, &eb);if (ret)__readahead_hook (fs_info->extent_root,NULL , logical, ret);else if (eb)
Signature · 1 line
2.1.3
PATCH 4/9 btrfs: sink blocksize parameter to btrfs_init_new_buffer
In reply to David Sterba--- fs/btrfs/extent-tree.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
fs/btrfs/extent-tree.c +4 -5
@@ -7215,11 +7215,11 @@ int btrfs_alloc_logged_file_extent(struct btrfs_trans_handle *trans,static struct extent_buffer *btrfs_init_new_buffer (struct btrfs_trans_handle *trans,struct btrfs_root *root, -u64 bytenr,u32 blocksize,int level) +u64 bytenr,int level) {struct extent_buffer *buf; - buf =btrfs_find_create_tree_block (root, bytenr, blocksize); + buf =btrfs_find_create_tree_block (root, bytenr, root->nodesize);if (!buf)return ERR_PTR (-ENOMEM );btrfs_set_header_generation (buf, trans->transid);
@@ -7338,7 +7338,7 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,if (btrfs_test_is_dummy_root (root)) { buf =btrfs_init_new_buffer (trans, root, root->alloc_bytenr, - blocksize, level); + level);if (!IS_ERR (buf)) root->alloc_bytenr += blocksize;return buf;
@@ -7355,8 +7355,7 @@ struct extent_buffer *btrfs_alloc_tree_block(struct btrfs_trans_handle *trans,return ERR_PTR (ret); } - buf =btrfs_init_new_buffer (trans, root, ins.objectid, - blocksize, level); + buf =btrfs_init_new_buffer (trans, root, ins.objectid, level);BUG_ON (IS_ERR (buf));/* -ENOMEM */ if (root_objectid ==BTRFS_TREE_RELOC_OBJECTID ) {
Signature · 1 line
2.1.3
PATCH 5/9 btrfs: sink blocksize parameter to btrfs_find_create_tree_block
In reply to David SterbaFinally it's clear that the requested blocksize is always equal to nodesize, with one exception, the superblock.
Superblock has fixed size regardless of the metadata block size, but uses the same helpers to initialize sys array/chunk tree and to work with the chunk items. So it pretends to be an extent_buffer for a moment, btrfs_read_sys_array is full of special cases, we're adding one more.
--- fs/btrfs/disk-io.c | 12 ++++++------ fs/btrfs/disk-io.h | 2 +- fs/btrfs/extent-tree.c | 4 ++-- fs/btrfs/tree-log.c | 2 +- fs/btrfs/volumes.c | 9 +++++++-- 5 files changed, 17 insertions(+), 12 deletions(-)
fs/btrfs/disk-io.c +6 -6
@@ -1078,7 +1078,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr)struct extent_buffer *buf =NULL ;struct inode *btree_inode = root->fs_info->btree_inode; - buf =btrfs_find_create_tree_block (root, bytenr, root->nodesize); + buf =btrfs_find_create_tree_block (root, bytenr);if (!buf)return ; read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree,
@@ -1094,7 +1094,7 @@ int reada_tree_block_flagged(struct btrfs_root *root, u64 bytenr,struct extent_io_tree *io_tree = &BTRFS_I (btree_inode)->io_tree;int ret; - buf =btrfs_find_create_tree_block (root, bytenr, root->nodesize); + buf =btrfs_find_create_tree_block (root, bytenr);if (!buf)return 0 ;
@@ -1125,12 +1125,12 @@ struct extent_buffer *btrfs_find_tree_block(struct btrfs_root *root, }struct extent_buffer *btrfs_find_create_tree_block (struct btrfs_root *root, -u64 bytenr,u32 blocksize) +u64 bytenr) {if (btrfs_test_is_dummy_root (root))return alloc_test_extent_buffer (root->fs_info, bytenr, - blocksize); -return alloc_extent_buffer (root->fs_info, bytenr, blocksize); + root->nodesize); +return alloc_extent_buffer (root->fs_info, bytenr, root->nodesize); }
@@ -1152,7 +1152,7 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,struct extent_buffer *buf =NULL ;int ret; - buf =btrfs_find_create_tree_block (root, bytenr, root->nodesize); + buf =btrfs_find_create_tree_block (root, bytenr);if (!buf)return NULL ;
fs/btrfs/disk-io.h +1 -1
@@ -50,7 +50,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr);int reada_tree_block_flagged (struct btrfs_root *root,u64 bytenr,int mirror_num,struct extent_buffer **eb);struct extent_buffer *btrfs_find_create_tree_block (struct btrfs_root *root, -u64 bytenr,u32 blocksize); +u64 bytenr);void clean_tree_block (struct btrfs_trans_handle *trans,struct btrfs_root *root,struct extent_buffer *buf); int open_ctree(struct super_block *sb,
fs/btrfs/extent-tree.c +2 -2
@@ -7219,7 +7219,7 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root, {struct extent_buffer *buf; - buf =btrfs_find_create_tree_block (root, bytenr, root->nodesize); + buf =btrfs_find_create_tree_block (root, bytenr);if (!buf)return ERR_PTR (-ENOMEM );btrfs_set_header_generation (buf, trans->transid);
@@ -7825,7 +7825,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans, next =btrfs_find_tree_block (root, bytenr);if (!next) { - next =btrfs_find_create_tree_block (root, bytenr, blocksize); + next =btrfs_find_create_tree_block (root, bytenr);if (!next)return -ENOMEM ; btrfs_set_buffer_lockdep_class(root->root_key.objectid, next,
fs/btrfs/tree-log.c +1 -1
@@ -2164,7 +2164,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans, parent = path->nodes[*level]; root_owner =btrfs_header_owner (parent); - next =btrfs_find_create_tree_block (root, bytenr, blocksize); + next =btrfs_find_create_tree_block (root, bytenr);if (!next)return -ENOMEM ;
fs/btrfs/volumes.c +7 -2
@@ -6247,8 +6247,13 @@ int btrfs_read_sys_array(struct btrfs_root *root)u32 cur;struct btrfs_key key; - sb =btrfs_find_create_tree_block (root,BTRFS_SUPER_INFO_OFFSET , -BTRFS_SUPER_INFO_SIZE ); +ASSERT (BTRFS_SUPER_INFO_SIZE <= root->nodesize); +/* +* This will create extent buffer of nodesize, superblock size is +* fixed to BTRFS_SUPER_INFO_SIZE. If nodesize > sb size, this will +* overallocate but we can keep it as-is, only the first page is used. +*/ + sb =btrfs_find_create_tree_block (root,BTRFS_SUPER_INFO_OFFSET );if (!sb)return -ENOMEM ;btrfs_set_buffer_uptodate (sb);
Signature · 1 line
2.1.3
PATCH 6/9 btrfs: sink blocksize parameter to tree_block_processed
In reply to David Sterba--- fs/btrfs/relocation.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/btrfs/relocation.c +5 -4
@@ -2855,9 +2855,10 @@ static void update_processed_blocks(struct reloc_control *rc, } } -static int tree_block_processed (u64 bytenr,u32 blocksize, -struct reloc_control *rc) +static int tree_block_processed (u64 bytenr,struct reloc_control *rc) { +u32 blocksize = rc->extent_root->nodesize; +if (test_range_bit (&rc->processed_blocks, bytenr, bytenr + blocksize -1 ,EXTENT_DIRTY ,1 ,NULL ))return 1 ;
@@ -3352,7 +3353,7 @@ static int __add_tree_block(struct reloc_control *rc,bool skinny =btrfs_fs_incompat (rc->extent_root->fs_info,SKINNY_METADATA ); -if (tree_block_processed (bytenr, blocksize, rc)) +if (tree_block_processed (bytenr, rc))return 0 ;if (tree_search (blocks, bytenr))
@@ -3610,7 +3611,7 @@ static int find_data_references(struct reloc_control *rc,if (added) goto next; -if (!tree_block_processed (leaf->start, leaf->len, rc)) { +if (!tree_block_processed (leaf->start, rc)) { block =kmalloc (sizeof (*block),GFP_NOFS );if (!block) { err = -ENOMEM ;
Signature · 1 line
2.1.3
PATCH 7/9 btrfs: use GFP_NOFS in __alloc_extent_buffer directly
In reply to David SterbaSame mask from all callers.
--- fs/btrfs/extent_io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/extent_io.c +5 -5
@@ -4598,11 +4598,11 @@ static inline void btrfs_release_extent_buffer(struct extent_buffer *eb)static struct extent_buffer *__alloc_extent_buffer (struct btrfs_fs_info *fs_info,u64 start, -unsigned long len,gfp_t mask) +unsigned long len) {struct extent_buffer *eb =NULL ; - eb =kmem_cache_zalloc (extent_buffer_cache, mask); + eb =kmem_cache_zalloc (extent_buffer_cache,GFP_NOFS );if (eb ==NULL )return NULL ; eb->start = start;
@@ -4643,7 +4643,7 @@ struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src)struct extent_buffer *new;unsigned long num_pages =num_extent_pages (src->start, src->len); - new =__alloc_extent_buffer (NULL , src->start, src->len,GFP_NOFS ); + new =__alloc_extent_buffer (NULL , src->start, src->len);if (new ==NULL )return NULL ;
@@ -4672,7 +4672,7 @@ struct extent_buffer *alloc_dummy_extent_buffer(u64 start, unsigned long len)unsigned long num_pages =num_extent_pages (0 , len);unsigned long i; - eb =__alloc_extent_buffer (NULL , start, len,GFP_NOFS ); + eb =__alloc_extent_buffer (NULL , start, len);if (!eb)return NULL ;
@@ -4824,7 +4824,7 @@ struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,if (eb)return eb; - eb =__alloc_extent_buffer (fs_info, start, len,GFP_NOFS ); + eb =__alloc_extent_buffer (fs_info, start, len);if (!eb)return NULL ;
Signature · 1 line
2.1.3
PATCH 8/9 btrfs: unify extent buffer allocation api
In reply to David SterbaMake the extent buffer allocation interface consistent. Cloned eb will set a valid fs_info. For dummy eb, we can drop the length parameter and set it from fs_info.
The built-in sanity checks may pass a NULL fs_info that's queried for nodesize, but we know it's 4096.
--- fs/btrfs/ctree.c | 5 ++--- fs/btrfs/extent_io.c | 23 ++++++++++++++++++----- fs/btrfs/extent_io.h | 3 ++- fs/btrfs/tests/extent-buffer-tests.c | 2 +- fs/btrfs/tests/inode-tests.c | 4 ++-- fs/btrfs/tests/qgroup-tests.c | 21 ++++++++++----------- 6 files changed, 35 insertions(+), 23 deletions(-)
fs/btrfs/ctree.c +2 -3
@@ -1363,8 +1363,7 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct btrfs_path *path,if (tm->op ==MOD_LOG_KEY_REMOVE_WHILE_FREEING ) {BUG_ON (tm->slot !=0 ); - eb_rewin =alloc_dummy_extent_buffer (eb->start, - fs_info->tree_root->nodesize); + eb_rewin =alloc_dummy_extent_buffer (fs_info, eb->start);if (!eb_rewin) {btrfs_tree_read_unlock_blocking (eb);free_extent_buffer (eb);
@@ -1444,7 +1443,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq) }else if (old_root) {btrfs_tree_read_unlock (eb_root);free_extent_buffer (eb_root); - eb =alloc_dummy_extent_buffer (logical, root->nodesize); + eb =alloc_dummy_extent_buffer (root->fs_info, logical); }else {btrfs_set_lock_blocking_rw (eb_root,BTRFS_READ_LOCK ); eb =btrfs_clone_extent_buffer (eb_root);
fs/btrfs/extent_io.c +18 -5
@@ -4643,7 +4643,7 @@ struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src)struct extent_buffer *new;unsigned long num_pages =num_extent_pages (src->start, src->len); - new =__alloc_extent_buffer (NULL , src->start, src->len); + new =__alloc_extent_buffer (src->fs_info, src->start, src->len);if (new ==NULL )return NULL ;
@@ -4666,13 +4666,26 @@ struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src)return new; } -struct extent_buffer *alloc_dummy_extent_buffer (u64 start,unsigned long len) +struct extent_buffer *alloc_dummy_extent_buffer (struct btrfs_fs_info *fs_info, +u64 start) {struct extent_buffer *eb; -unsigned long num_pages =num_extent_pages (0 , len); +unsigned long len; +unsigned long num_pages;unsigned long i; - eb =__alloc_extent_buffer (NULL , start, len); +if (!fs_info) { +/* +* Called only from tests that don't always have a fs_info +* available, but we know that nodesize is 4096 +*/ + len =4096 ; + }else { + len = fs_info->tree_root->nodesize; + } + num_pages =num_extent_pages (0 , len); + + eb =__alloc_extent_buffer (fs_info, start, len);if (!eb)return NULL ;
@@ -4770,7 +4783,7 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, eb =find_extent_buffer (fs_info, start);if (eb)return eb; - eb =alloc_dummy_extent_buffer (start, len); + eb =alloc_dummy_extent_buffer (fs_info, start);if (!eb)return NULL ; eb->fs_info = fs_info;
fs/btrfs/extent_io.h +2 -1
@@ -263,7 +263,8 @@ void set_page_extent_mapped(struct page *page);struct extent_buffer *alloc_extent_buffer (struct btrfs_fs_info *fs_info,u64 start,unsigned long len); -struct extent_buffer *alloc_dummy_extent_buffer (u64 start,unsigned long len); +struct extent_buffer *alloc_dummy_extent_buffer (struct btrfs_fs_info *fs_info, +u64 start);struct extent_buffer *btrfs_clone_extent_buffer (struct extent_buffer *src);struct extent_buffer *find_extent_buffer (struct btrfs_fs_info *fs_info,u64 start);
fs/btrfs/tests/extent-buffer-tests.c +1 -1
@@ -53,7 +53,7 @@ static int test_btrfs_split_item(void)return -ENOMEM ; } - path->nodes[0 ] = eb =alloc_dummy_extent_buffer (0 ,4096 ); + path->nodes[0 ] = eb =alloc_dummy_extent_buffer (NULL ,4096 );if (!eb) {test_msg ("Could not allocate dummy buffer\n" ); ret = -ENOMEM ;
fs/btrfs/tests/inode-tests.c +2 -2
@@ -255,7 +255,7 @@ static noinline int test_btrfs_get_extent(void) goto out; } - root->node =alloc_dummy_extent_buffer (0 ,4096 ); + root->node =alloc_dummy_extent_buffer (NULL ,4096 );if (!root->node) {test_msg ("Couldn't allocate dummy buffer\n" ); goto out;
@@ -843,7 +843,7 @@ static int test_hole_first(void) goto out; } - root->node =alloc_dummy_extent_buffer (0 ,4096 ); + root->node =alloc_dummy_extent_buffer (NULL ,4096 );if (!root->node) {test_msg ("Couldn't allocate dummy buffer\n" ); goto out;
fs/btrfs/tests/qgroup-tests.c +10 -11
@@ -404,6 +404,16 @@ int btrfs_test_qgroups(void) ret = -ENOMEM ; goto out; } +/* We are using this root as our extent root */ + root->fs_info->extent_root = root; + +/* +* Some of the paths we test assume we have a filled out fs_info, so we +* just need to add the root in there so we don't panic. +*/ + root->fs_info->tree_root = root; + root->fs_info->quota_root = root; + root->fs_info->quota_enabled =1 ;/* * Can't use bytenr 0, some things freak out
@@ -448,17 +458,6 @@ int btrfs_test_qgroups(void) goto out; } -/* We are using this root as our extent root */ - root->fs_info->extent_root = root; - -/* -* Some of the paths we test assume we have a filled out fs_info, so we -* just need to addt he root in there so we don't panic. -*/ - root->fs_info->tree_root = root; - root->fs_info->quota_root = root; - root->fs_info->quota_enabled =1 ; -test_msg ("Running qgroup tests\n" ); ret =test_no_shared_qgroup (root);if (ret)
Signature · 1 line
2.1.3
PATCH 9/9 btrfs: sink parameter len to alloc_extent_buffer
In reply to David SterbaBecause we're using globally known nodesize. Do the same for the sanity test function variant.
--- fs/btrfs/disk-io.c | 5 ++--- fs/btrfs/extent_io.c | 5 +++-- fs/btrfs/extent_io.h | 4 ++-- fs/btrfs/tests/qgroup-tests.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
fs/btrfs/disk-io.c +2 -3
@@ -1128,9 +1128,8 @@ struct extent_buffer *btrfs_find_create_tree_block(struct btrfs_root *root, u64 bytenr) {if (btrfs_test_is_dummy_root (root)) -return alloc_test_extent_buffer (root->fs_info, bytenr, - root->nodesize); -return alloc_extent_buffer (root->fs_info, bytenr, root->nodesize); +return alloc_test_extent_buffer (root->fs_info, bytenr); +return alloc_extent_buffer (root->fs_info, bytenr); }
fs/btrfs/extent_io.c +3 -2
@@ -4775,7 +4775,7 @@ struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info,#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS struct extent_buffer *alloc_test_extent_buffer (struct btrfs_fs_info *fs_info, -u64 start,unsigned long len) +u64 start) {struct extent_buffer *eb, *exists =NULL ;int ret;
@@ -4821,8 +4821,9 @@ free_eb:#endif struct extent_buffer *alloc_extent_buffer (struct btrfs_fs_info *fs_info, -u64 start,unsigned long len) +u64 start) { +unsigned long len = fs_info->tree_root->nodesize;unsigned long num_pages =num_extent_pages (start, len);unsigned long i;unsigned long index = start >>PAGE_CACHE_SHIFT ;
fs/btrfs/extent_io.h +2 -2
@@ -262,7 +262,7 @@ int get_state_private(struct extent_io_tree *tree, u64 start, u64 *private);void set_page_extent_mapped (struct page *page);struct extent_buffer *alloc_extent_buffer (struct btrfs_fs_info *fs_info, -u64 start,unsigned long len); +u64 start);struct extent_buffer *alloc_dummy_extent_buffer (struct btrfs_fs_info *fs_info,u64 start);struct extent_buffer *btrfs_clone_extent_buffer (struct extent_buffer *src);
@@ -378,5 +378,5 @@ noinline u64 find_lock_delalloc_range(struct inode *inode, u64 *end, u64 max_bytes);#endif struct extent_buffer *alloc_test_extent_buffer (struct btrfs_fs_info *fs_info, -u64 start,unsigned long len); +u64 start);#endif
fs/btrfs/tests/qgroup-tests.c +1 -1
@@ -419,7 +419,7 @@ int btrfs_test_qgroups(void)* Can't use bytenr 0, some things freak out * *cough*backref walking code*cough* */ - root->node =alloc_test_extent_buffer (root->fs_info,4096 ,4096 ); + root->node =alloc_test_extent_buffer (root->fs_info,4096 );if (!root->node) {test_msg ("Couldn't allocate dummy buffer\n" ); ret = -ENOMEM ;
Signature · 1 line
2.1.3