Loading fs/btrfs/ctree.c +5 −8 Original line number Diff line number Diff line Loading @@ -1371,8 +1371,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); Loading Loading @@ -1452,7 +1451,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); Loading Loading @@ -2290,7 +2289,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++; Loading @@ -2309,7 +2308,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) Loading @@ -2317,7 +2315,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); Loading @@ -2342,9 +2339,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); } Loading fs/btrfs/disk-io.c +8 −9 Original line number Diff line number Diff line Loading @@ -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); if (!buf) return; read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, Loading @@ -1086,7 +1086,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize) 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; Loading @@ -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); if (!buf) return 0; Loading Loading @@ -1125,12 +1125,11 @@ 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); return alloc_test_extent_buffer(root->fs_info, bytenr); return alloc_extent_buffer(root->fs_info, bytenr); } Loading @@ -1152,7 +1151,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; Loading fs/btrfs/disk-io.h +3 −3 Original line number Diff line number Diff line Loading @@ -46,11 +46,11 @@ 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); int reada_tree_block_flagged(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, 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, Loading fs/btrfs/extent-tree.c +6 −7 Original line number Diff line number Diff line Loading @@ -7149,11 +7149,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); if (!buf) return ERR_PTR(-ENOMEM); btrfs_set_header_generation(buf, trans->transid); Loading Loading @@ -7272,7 +7272,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; Loading @@ -7289,8 +7289,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) { Loading Loading @@ -7419,7 +7418,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; Loading Loading @@ -7760,7 +7759,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, Loading fs/btrfs/extent_io.c +24 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(src->fs_info, src->start, src->len); if (new == NULL) return NULL; Loading @@ -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, GFP_NOFS); 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; Loading Loading @@ -4762,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; Loading @@ -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; Loading Loading @@ -4808,8 +4821,9 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, #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; Loading @@ -4824,7 +4838,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; Loading Loading
fs/btrfs/ctree.c +5 −8 Original line number Diff line number Diff line Loading @@ -1371,8 +1371,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); Loading Loading @@ -1452,7 +1451,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); Loading Loading @@ -2290,7 +2289,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++; Loading @@ -2309,7 +2308,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) Loading @@ -2317,7 +2315,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); Loading @@ -2342,9 +2339,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); } Loading
fs/btrfs/disk-io.c +8 −9 Original line number Diff line number Diff line Loading @@ -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); if (!buf) return; read_extent_buffer_pages(&BTRFS_I(btree_inode)->io_tree, Loading @@ -1086,7 +1086,7 @@ void readahead_tree_block(struct btrfs_root *root, u64 bytenr, u32 blocksize) 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; Loading @@ -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); if (!buf) return 0; Loading Loading @@ -1125,12 +1125,11 @@ 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); return alloc_test_extent_buffer(root->fs_info, bytenr); return alloc_extent_buffer(root->fs_info, bytenr); } Loading @@ -1152,7 +1151,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; Loading
fs/btrfs/disk-io.h +3 −3 Original line number Diff line number Diff line Loading @@ -46,11 +46,11 @@ 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); int reada_tree_block_flagged(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, 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, Loading
fs/btrfs/extent-tree.c +6 −7 Original line number Diff line number Diff line Loading @@ -7149,11 +7149,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); if (!buf) return ERR_PTR(-ENOMEM); btrfs_set_header_generation(buf, trans->transid); Loading Loading @@ -7272,7 +7272,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; Loading @@ -7289,8 +7289,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) { Loading Loading @@ -7419,7 +7418,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; Loading Loading @@ -7760,7 +7759,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, Loading
fs/btrfs/extent_io.c +24 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(src->fs_info, src->start, src->len); if (new == NULL) return NULL; Loading @@ -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, GFP_NOFS); 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; Loading Loading @@ -4762,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; Loading @@ -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; Loading Loading @@ -4808,8 +4821,9 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, #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; Loading @@ -4824,7 +4838,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; Loading