mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 06:21:31 +00:00
btrfs: move all btree inode initialization into btrfs_init_btree_inode
Move the remaining code that deals with initializing the btree inode into btrfs_init_btree_inode instead of splitting it between that helpers and its only caller. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
19337f8ea3
commit
dcb2137c84
1 changed files with 14 additions and 7 deletions
|
@ -2125,11 +2125,16 @@ static void btrfs_init_balance(struct btrfs_fs_info *fs_info)
|
||||||
atomic_set(&fs_info->reloc_cancel_req, 0);
|
atomic_set(&fs_info->reloc_cancel_req, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info)
|
static int btrfs_init_btree_inode(struct super_block *sb)
|
||||||
{
|
{
|
||||||
struct inode *inode = fs_info->btree_inode;
|
struct btrfs_fs_info *fs_info = btrfs_sb(sb);
|
||||||
unsigned long hash = btrfs_inode_hash(BTRFS_BTREE_INODE_OBJECTID,
|
unsigned long hash = btrfs_inode_hash(BTRFS_BTREE_INODE_OBJECTID,
|
||||||
fs_info->tree_root);
|
fs_info->tree_root);
|
||||||
|
struct inode *inode;
|
||||||
|
|
||||||
|
inode = new_inode(sb);
|
||||||
|
if (!inode)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
inode->i_ino = BTRFS_BTREE_INODE_OBJECTID;
|
inode->i_ino = BTRFS_BTREE_INODE_OBJECTID;
|
||||||
set_nlink(inode, 1);
|
set_nlink(inode, 1);
|
||||||
|
@ -2140,6 +2145,7 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info)
|
||||||
*/
|
*/
|
||||||
inode->i_size = OFFSET_MAX;
|
inode->i_size = OFFSET_MAX;
|
||||||
inode->i_mapping->a_ops = &btree_aops;
|
inode->i_mapping->a_ops = &btree_aops;
|
||||||
|
mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
|
||||||
|
|
||||||
RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node);
|
RB_CLEAR_NODE(&BTRFS_I(inode)->rb_node);
|
||||||
extent_io_tree_init(fs_info, &BTRFS_I(inode)->io_tree,
|
extent_io_tree_init(fs_info, &BTRFS_I(inode)->io_tree,
|
||||||
|
@ -2152,6 +2158,9 @@ static void btrfs_init_btree_inode(struct btrfs_fs_info *fs_info)
|
||||||
BTRFS_I(inode)->location.offset = 0;
|
BTRFS_I(inode)->location.offset = 0;
|
||||||
set_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags);
|
set_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags);
|
||||||
__insert_inode_hash(inode, hash);
|
__insert_inode_hash(inode, hash);
|
||||||
|
fs_info->btree_inode = inode;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void btrfs_init_dev_replace_locks(struct btrfs_fs_info *fs_info)
|
static void btrfs_init_dev_replace_locks(struct btrfs_fs_info *fs_info)
|
||||||
|
@ -3365,13 +3374,11 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs_info->btree_inode = new_inode(sb);
|
ret = btrfs_init_btree_inode(sb);
|
||||||
if (!fs_info->btree_inode) {
|
if (ret) {
|
||||||
err = -ENOMEM;
|
err = ret;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
mapping_set_gfp_mask(fs_info->btree_inode->i_mapping, GFP_NOFS);
|
|
||||||
btrfs_init_btree_inode(fs_info);
|
|
||||||
|
|
||||||
invalidate_bdev(fs_devices->latest_dev->bdev);
|
invalidate_bdev(fs_devices->latest_dev->bdev);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue