btrfs: Introduce fs_info to extent_io_tree
This patch will add a new member fs_info to extent_io_tree. This provides the basis for later trace events to distinguish the output between different btrfs filesystems. While this increases the size of the structure, we want to know the source of the trace events and passing the fs_info as an argument to all contexts is not possible. The selftests are now allowed to set it to NULL as they don't use the tracepoints. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3b1da515c6
commit
c258d6e364
|
@ -1211,7 +1211,7 @@ static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,
|
|||
root->log_transid_committed = -1;
|
||||
root->last_log_commit = 0;
|
||||
if (!dummy)
|
||||
extent_io_tree_init(&root->dirty_log_pages, NULL);
|
||||
extent_io_tree_init(fs_info, &root->dirty_log_pages, NULL);
|
||||
|
||||
memset(&root->root_key, 0, sizeof(root->root_key));
|
||||
memset(&root->root_item, 0, sizeof(root->root_item));
|
||||
|
@ -2141,7 +2141,7 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info)
|
|||
inode->i_mapping->a_ops = &btree_aops;
|
||||
|
||||
RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node);
|
||||
extent_io_tree_init(&BTRFS_I(inode)->io_tree, inode);
|
||||
extent_io_tree_init(fs_info, &BTRFS_I(inode)->io_tree, inode);
|
||||
BTRFS_I(inode)->io_tree.track_uptodate = 0;
|
||||
extent_map_tree_init(&BTRFS_I(inode)->extent_tree);
|
||||
|
||||
|
@ -2751,8 +2751,8 @@ int open_ctree(struct super_block *sb,
|
|||
fs_info->block_group_cache_tree = RB_ROOT;
|
||||
fs_info->first_logical_byte = (u64)-1;
|
||||
|
||||
extent_io_tree_init(&fs_info->freed_extents[0], NULL);
|
||||
extent_io_tree_init(&fs_info->freed_extents[1], NULL);
|
||||
extent_io_tree_init(fs_info, &fs_info->freed_extents[0], NULL);
|
||||
extent_io_tree_init(fs_info, &fs_info->freed_extents[1], NULL);
|
||||
fs_info->pinned_extents = &fs_info->freed_extents[0];
|
||||
set_bit(BTRFS_FS_BARRIER, &fs_info->flags);
|
||||
|
||||
|
|
|
@ -232,9 +232,10 @@ void __cold extent_io_exit(void)
|
|||
bioset_exit(&btrfs_bioset);
|
||||
}
|
||||
|
||||
void extent_io_tree_init(struct extent_io_tree *tree,
|
||||
void *private_data)
|
||||
void extent_io_tree_init(struct btrfs_fs_info *fs_info,
|
||||
struct extent_io_tree *tree, void *private_data)
|
||||
{
|
||||
tree->fs_info = fs_info;
|
||||
tree->state = RB_ROOT;
|
||||
tree->ops = NULL;
|
||||
tree->dirty_bytes = 0;
|
||||
|
|
|
@ -108,6 +108,7 @@ struct extent_io_ops {
|
|||
|
||||
struct extent_io_tree {
|
||||
struct rb_root state;
|
||||
struct btrfs_fs_info *fs_info;
|
||||
void *private_data;
|
||||
u64 dirty_bytes;
|
||||
int track_uptodate;
|
||||
|
@ -239,7 +240,8 @@ typedef struct extent_map *(get_extent_t)(struct btrfs_inode *inode,
|
|||
u64 start, u64 len,
|
||||
int create);
|
||||
|
||||
void extent_io_tree_init(struct extent_io_tree *tree, void *private_data);
|
||||
void extent_io_tree_init(struct btrfs_fs_info *fs_info,
|
||||
struct extent_io_tree *tree, void *private_data);
|
||||
int try_release_extent_mapping(struct page *page, gfp_t mask);
|
||||
int try_release_extent_buffer(struct page *page);
|
||||
int lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
|
||||
|
|
|
@ -9182,8 +9182,8 @@ struct inode *btrfs_alloc_inode(struct super_block *sb)
|
|||
|
||||
inode = &ei->vfs_inode;
|
||||
extent_map_tree_init(&ei->extent_tree);
|
||||
extent_io_tree_init(&ei->io_tree, inode);
|
||||
extent_io_tree_init(&ei->io_failure_tree, inode);
|
||||
extent_io_tree_init(fs_info, &ei->io_tree, inode);
|
||||
extent_io_tree_init(fs_info, &ei->io_failure_tree, inode);
|
||||
ei->io_tree.track_uptodate = 1;
|
||||
ei->io_failure_tree.track_uptodate = 1;
|
||||
atomic_set(&ei->sync_writers, 0);
|
||||
|
|
|
@ -4222,7 +4222,7 @@ struct inode *create_reloc_inode(struct btrfs_fs_info *fs_info,
|
|||
return inode;
|
||||
}
|
||||
|
||||
static struct reloc_control *alloc_reloc_control(void)
|
||||
static struct reloc_control *alloc_reloc_control(struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
struct reloc_control *rc;
|
||||
|
||||
|
@ -4234,7 +4234,7 @@ static struct reloc_control *alloc_reloc_control(void)
|
|||
INIT_LIST_HEAD(&rc->dirty_subvol_roots);
|
||||
backref_cache_init(&rc->backref_cache);
|
||||
mapping_tree_init(&rc->reloc_root_tree);
|
||||
extent_io_tree_init(&rc->processed_blocks, NULL);
|
||||
extent_io_tree_init(fs_info, &rc->processed_blocks, NULL);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -4276,7 +4276,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
|
|||
return -ETXTBSY;
|
||||
}
|
||||
|
||||
rc = alloc_reloc_control();
|
||||
rc = alloc_reloc_control(fs_info);
|
||||
if (!rc) {
|
||||
btrfs_put_block_group(bg);
|
||||
return -ENOMEM;
|
||||
|
@ -4472,7 +4472,7 @@ int btrfs_recover_relocation(struct btrfs_root *root)
|
|||
if (list_empty(&reloc_roots))
|
||||
goto out;
|
||||
|
||||
rc = alloc_reloc_control();
|
||||
rc = alloc_reloc_control(fs_info);
|
||||
if (!rc) {
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
|
|
|
@ -115,8 +115,8 @@ struct btrfs_fs_info *btrfs_alloc_dummy_fs_info(u32 nodesize, u32 sectorsize)
|
|||
INIT_LIST_HEAD(&fs_info->tree_mod_seq_list);
|
||||
INIT_RADIX_TREE(&fs_info->buffer_radix, GFP_ATOMIC);
|
||||
INIT_RADIX_TREE(&fs_info->fs_roots_radix, GFP_ATOMIC);
|
||||
extent_io_tree_init(&fs_info->freed_extents[0], NULL);
|
||||
extent_io_tree_init(&fs_info->freed_extents[1], NULL);
|
||||
extent_io_tree_init(fs_info, &fs_info->freed_extents[0], NULL);
|
||||
extent_io_tree_init(fs_info, &fs_info->freed_extents[1], NULL);
|
||||
fs_info->pinned_extents = &fs_info->freed_extents[0];
|
||||
set_bit(BTRFS_FS_STATE_DUMMY_FS_INFO, &fs_info->fs_state);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ static int test_find_delalloc(u32 sectorsize)
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
extent_io_tree_init(&tmp, NULL);
|
||||
extent_io_tree_init(NULL, &tmp, NULL);
|
||||
|
||||
/*
|
||||
* First go through and create and mark all of our pages dirty, we pin
|
||||
|
|
|
@ -274,7 +274,7 @@ static noinline int join_transaction(struct btrfs_fs_info *fs_info,
|
|||
INIT_LIST_HEAD(&cur_trans->deleted_bgs);
|
||||
spin_lock_init(&cur_trans->dropped_roots_lock);
|
||||
list_add_tail(&cur_trans->list, &fs_info->trans_list);
|
||||
extent_io_tree_init(&cur_trans->dirty_pages,
|
||||
extent_io_tree_init(fs_info, &cur_trans->dirty_pages,
|
||||
fs_info->btree_inode);
|
||||
fs_info->generation++;
|
||||
cur_trans->transid = fs_info->generation;
|
||||
|
|
Loading…
Reference in New Issue