Btrfs: remove duplicated ino cache's inode lookup
authorFilipe David Borba Manana <fdmanana@gmail.com>
Fri, 20 Sep 2013 13:43:28 +0000 (14:43 +0100)
committerChris Mason <chris.mason@fusionio.com>
Tue, 12 Nov 2013 02:51:24 +0000 (21:51 -0500)
We're doing a unnecessary extra lookup of the ino cache's
inode when we already have it (and holding a reference)
during the process of saving the ino cache contents to disk.
Therefore remove this extra lookup.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/free-space-cache.c
fs/btrfs/free-space-cache.h
fs/btrfs/inode-map.c

index b4f9904c4c6b2ed5f0da30ad664baf33100a879c..9a1e371a6eba524b82b2f31d3e911b1c731fd0bd 100644 (file)
@@ -2967,19 +2967,15 @@ out:
 
 int btrfs_write_out_ino_cache(struct btrfs_root *root,
                              struct btrfs_trans_handle *trans,
-                             struct btrfs_path *path)
+                             struct btrfs_path *path,
+                             struct inode *inode)
 {
        struct btrfs_free_space_ctl *ctl = root->free_ino_ctl;
-       struct inode *inode;
        int ret;
 
        if (!btrfs_test_opt(root, INODE_MAP_CACHE))
                return 0;
 
-       inode = lookup_free_ino_inode(root, path);
-       if (IS_ERR(inode))
-               return 0;
-
        ret = __btrfs_write_out_cache(root, inode, ctl, NULL, trans, path, 0);
        if (ret) {
                btrfs_delalloc_release_metadata(inode, inode->i_size);
@@ -2990,7 +2986,6 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root,
 #endif
        }
 
-       iput(inode);
        return ret;
 }
 
index e737f92cf6d0b69ffbcc1e94882abc8693c3e3a5..ba8d5a1b64b5316566dfa9b66231fe812615bac9 100644 (file)
@@ -76,7 +76,8 @@ int load_free_ino_cache(struct btrfs_fs_info *fs_info,
                        struct btrfs_root *root);
 int btrfs_write_out_ino_cache(struct btrfs_root *root,
                              struct btrfs_trans_handle *trans,
-                             struct btrfs_path *path);
+                             struct btrfs_path *path,
+                             struct inode *inode);
 
 void btrfs_init_free_space_ctl(struct btrfs_block_group_cache *block_group);
 int __btrfs_add_free_space(struct btrfs_free_space_ctl *ctl,
index d11e1c6610b6262b15e1c0263e30feb4475acef5..b863e45d373b440e45ef1e7033174378730bd3a9 100644 (file)
@@ -503,7 +503,7 @@ again:
        }
        btrfs_free_reserved_data_space(inode, prealloc);
 
-       ret = btrfs_write_out_ino_cache(root, trans, path);
+       ret = btrfs_write_out_ino_cache(root, trans, path, inode);
 out_put:
        iput(inode);
 out_release: