btrfs: Remove fs_info argument from __add_to_free_space_tree
authorNikolay Borisov <nborisov@suse.com>
Thu, 10 May 2018 12:44:43 +0000 (15:44 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:07:33 +0000 (18:07 +0200)
This function already takes a transaction handle which contains a
reference to fs_info.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/free-space-tree.c
fs/btrfs/free-space-tree.h
fs/btrfs/tests/free-space-tree-tests.c

index a1ff604456b7f11446457ddbb85f9e7627305a78..501769b941a8251c6f66d91c0e58b296d4555300 100644 (file)
@@ -976,10 +976,10 @@ out:
 }
 
 int __add_to_free_space_tree(struct btrfs_trans_handle *trans,
-                            struct btrfs_fs_info *fs_info,
                             struct btrfs_block_group_cache *block_group,
                             struct btrfs_path *path, u64 start, u64 size)
 {
+       struct btrfs_fs_info *fs_info = trans->fs_info;
        struct btrfs_free_space_info *info;
        u32 flags;
        int ret;
@@ -1030,8 +1030,7 @@ int add_to_free_space_tree(struct btrfs_trans_handle *trans,
        }
 
        mutex_lock(&block_group->free_space_lock);
-       ret = __add_to_free_space_tree(trans, fs_info, block_group, path, start,
-                                      size);
+       ret = __add_to_free_space_tree(trans, block_group, path, start, size);
        mutex_unlock(&block_group->free_space_lock);
 
        btrfs_put_block_group(block_group);
@@ -1101,7 +1100,7 @@ static int populate_free_space_tree(struct btrfs_trans_handle *trans,
                                break;
 
                        if (start < key.objectid) {
-                               ret = __add_to_free_space_tree(trans, fs_info,
+                               ret = __add_to_free_space_tree(trans,
                                                               block_group,
                                                               path2, start,
                                                               key.objectid -
@@ -1126,8 +1125,8 @@ static int populate_free_space_tree(struct btrfs_trans_handle *trans,
                        break;
        }
        if (start < end) {
-               ret = __add_to_free_space_tree(trans, fs_info, block_group,
-                                              path2, start, end - start);
+               ret = __add_to_free_space_tree(trans, block_group, path2,
+                                              start, end - start);
                if (ret)
                        goto out_locked;
        }
@@ -1282,8 +1281,7 @@ static int __add_block_group_free_space(struct btrfs_trans_handle *trans,
        if (ret)
                return ret;
 
-       return __add_to_free_space_tree(trans, trans->fs_info, block_group,
-                                       path,
+       return __add_to_free_space_tree(trans, block_group, path,
                                        block_group->key.objectid,
                                        block_group->key.offset);
 }
index e0abc265dc5938f2eee9d0fa86151f089cce89c2..7555f64d673102f35b09b2b7847923b9791b9b04 100644 (file)
@@ -37,7 +37,6 @@ search_free_space_info(struct btrfs_trans_handle *trans,
                       struct btrfs_block_group_cache *block_group,
                       struct btrfs_path *path, int cow);
 int __add_to_free_space_tree(struct btrfs_trans_handle *trans,
-                            struct btrfs_fs_info *fs_info,
                             struct btrfs_block_group_cache *block_group,
                             struct btrfs_path *path, u64 start, u64 size);
 int __remove_from_free_space_tree(struct btrfs_trans_handle *trans,
index f3dfd9fc762fa187412c07e6f7ccda70a44e3c1a..6d2b8f7360202dfcffa964340fa6f68322ef33e1 100644 (file)
@@ -274,14 +274,14 @@ static int test_merge_left(struct btrfs_trans_handle *trans,
                return ret;
        }
 
-       ret = __add_to_free_space_tree(trans, fs_info, cache, path,
-                                      cache->key.objectid, alignment);
+       ret = __add_to_free_space_tree(trans, cache, path, cache->key.objectid,
+                                      alignment);
        if (ret) {
                test_msg("Could not add free space\n");
                return ret;
        }
 
-       ret = __add_to_free_space_tree(trans, fs_info, cache, path,
+       ret = __add_to_free_space_tree(trans, cache, path,
                                       cache->key.objectid + alignment,
                                       alignment);
        if (ret) {
@@ -312,7 +312,7 @@ static int test_merge_right(struct btrfs_trans_handle *trans,
                return ret;
        }
 
-       ret = __add_to_free_space_tree(trans, fs_info, cache, path,
+       ret = __add_to_free_space_tree(trans, cache, path,
                                       cache->key.objectid + 2 * alignment,
                                       alignment);
        if (ret) {
@@ -320,7 +320,7 @@ static int test_merge_right(struct btrfs_trans_handle *trans,
                return ret;
        }
 
-       ret = __add_to_free_space_tree(trans, fs_info, cache, path,
+       ret = __add_to_free_space_tree(trans, cache, path,
                                       cache->key.objectid + alignment,
                                       alignment);
        if (ret) {
@@ -351,14 +351,14 @@ static int test_merge_both(struct btrfs_trans_handle *trans,
                return ret;
        }
 
-       ret = __add_to_free_space_tree(trans, fs_info, cache, path,
-                                      cache->key.objectid, alignment);
+       ret = __add_to_free_space_tree(trans, cache, path, cache->key.objectid,
+                                      alignment);
        if (ret) {
                test_msg("Could not add free space\n");
                return ret;
        }
 
-       ret = __add_to_free_space_tree(trans, fs_info, cache, path,
+       ret = __add_to_free_space_tree(trans, cache, path,
                                       cache->key.objectid + 2 * alignment,
                                       alignment);
        if (ret) {
@@ -366,7 +366,7 @@ static int test_merge_both(struct btrfs_trans_handle *trans,
                return ret;
        }
 
-       ret = __add_to_free_space_tree(trans, fs_info, cache, path,
+       ret = __add_to_free_space_tree(trans, cache, path,
                                       cache->key.objectid + alignment,
                                       alignment);
        if (ret) {
@@ -399,14 +399,14 @@ static int test_merge_none(struct btrfs_trans_handle *trans,
                return ret;
        }
 
-       ret = __add_to_free_space_tree(trans, fs_info, cache, path,
-                                      cache->key.objectid, alignment);
+       ret = __add_to_free_space_tree(trans, cache, path, cache->key.objectid,
+                                      alignment);
        if (ret) {
                test_msg("Could not add free space\n");
                return ret;
        }
 
-       ret = __add_to_free_space_tree(trans, fs_info, cache, path,
+       ret = __add_to_free_space_tree(trans, cache, path,
                                       cache->key.objectid + 4 * alignment,
                                       alignment);
        if (ret) {
@@ -414,7 +414,7 @@ static int test_merge_none(struct btrfs_trans_handle *trans,
                return ret;
        }
 
-       ret = __add_to_free_space_tree(trans, fs_info, cache, path,
+       ret = __add_to_free_space_tree(trans, cache, path,
                                       cache->key.objectid + 2 * alignment,
                                       alignment);
        if (ret) {