btrfs: get fs_info from block group in lookup_free_space_inode
authorDavid Sterba <dsterba@suse.com>
Wed, 20 Mar 2019 12:40:19 +0000 (13:40 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 29 Apr 2019 17:02:45 +0000 (19:02 +0200)
We can read fs_info from the block group cache structure and can drop it
from the parameters.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c
fs/btrfs/free-space-cache.c
fs/btrfs/free-space-cache.h
fs/btrfs/relocation.c

index a8b0434641e501db0ad3d3b5af21eaad2c9ba858..e881c20b975afa3dfe0ffd8f3358309942b42895 100644 (file)
@@ -3312,7 +3312,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,
        if (trans->aborted)
                return 0;
 again:
        if (trans->aborted)
                return 0;
 again:
-       inode = lookup_free_space_inode(fs_info, block_group, path);
+       inode = lookup_free_space_inode(block_group, path);
        if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) {
                ret = PTR_ERR(inode);
                btrfs_release_path(path);
        if (IS_ERR(inode) && PTR_ERR(inode) != -ENOENT) {
                ret = PTR_ERR(inode);
                btrfs_release_path(path);
@@ -10699,7 +10699,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
         * get the inode first so any iput calls done for the io_list
         * aren't the final iput (no unlinks allowed now)
         */
         * get the inode first so any iput calls done for the io_list
         * aren't the final iput (no unlinks allowed now)
         */
-       inode = lookup_free_space_inode(fs_info, block_group, path);
+       inode = lookup_free_space_inode(block_group, path);
 
        mutex_lock(&trans->transaction->cache_write_mutex);
        /*
 
        mutex_lock(&trans->transaction->cache_write_mutex);
        /*
index c3120df95c8acf67a8f652ccf858fedd573dbfca..f30c1bc1dced826d667acbf0b740d35a1615f2ad 100644 (file)
@@ -88,10 +88,11 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,
        return inode;
 }
 
        return inode;
 }
 
-struct inode *lookup_free_space_inode(struct btrfs_fs_info *fs_info,
-                                     struct btrfs_block_group_cache
-                                     *block_group, struct btrfs_path *path)
+struct inode *lookup_free_space_inode(
+               struct btrfs_block_group_cache *block_group,
+               struct btrfs_path *path)
 {
 {
+       struct btrfs_fs_info *fs_info = block_group->fs_info;
        struct inode *inode = NULL;
        u32 flags = BTRFS_INODE_NODATASUM | BTRFS_INODE_NODATACOW;
 
        struct inode *inode = NULL;
        u32 flags = BTRFS_INODE_NODATASUM | BTRFS_INODE_NODATACOW;
 
@@ -857,7 +858,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
         * once created get their ->cached field set to BTRFS_CACHE_FINISHED so
         * we will never try to read their inode item while the fs is mounted.
         */
         * once created get their ->cached field set to BTRFS_CACHE_FINISHED so
         * we will never try to read their inode item while the fs is mounted.
         */
-       inode = lookup_free_space_inode(fs_info, block_group, path);
+       inode = lookup_free_space_inode(block_group, path);
        if (IS_ERR(inode)) {
                btrfs_free_path(path);
                return 0;
        if (IS_ERR(inode)) {
                btrfs_free_path(path);
                return 0;
@@ -1385,7 +1386,7 @@ int btrfs_write_out_cache(struct btrfs_trans_handle *trans,
        }
        spin_unlock(&block_group->lock);
 
        }
        spin_unlock(&block_group->lock);
 
-       inode = lookup_free_space_inode(fs_info, block_group, path);
+       inode = lookup_free_space_inode(block_group, path);
        if (IS_ERR(inode))
                return 0;
 
        if (IS_ERR(inode))
                return 0;
 
index b3a4fce7946ad3eb135ba11dfb6b40dc43c89231..ab387c219bb0f4a3c106cd3c780b74febd41777f 100644 (file)
@@ -38,9 +38,9 @@ struct btrfs_free_space_op {
 
 struct btrfs_io_ctl;
 
 
 struct btrfs_io_ctl;
 
-struct inode *lookup_free_space_inode(struct btrfs_fs_info *fs_info,
-                                     struct btrfs_block_group_cache
-                                     *block_group, struct btrfs_path *path);
+struct inode *lookup_free_space_inode(
+               struct btrfs_block_group_cache *block_group,
+               struct btrfs_path *path);
 int create_free_space_inode(struct btrfs_trans_handle *trans,
                            struct btrfs_block_group_cache *block_group,
                            struct btrfs_path *path);
 int create_free_space_inode(struct btrfs_trans_handle *trans,
                            struct btrfs_block_group_cache *block_group,
                            struct btrfs_path *path);
index 2246aa2e30e33bc962f16ba0471d7a4573eafe81..9babbc74d14536a0b17eb071f3114f42b2481353 100644 (file)
@@ -4299,7 +4299,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
                goto out;
        }
 
                goto out;
        }
 
-       inode = lookup_free_space_inode(fs_info, rc->block_group, path);
+       inode = lookup_free_space_inode(rc->block_group, path);
        btrfs_free_path(path);
 
        if (!IS_ERR(inode))
        btrfs_free_path(path);
 
        if (!IS_ERR(inode))