Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Btrfs: remove duplicated ino cache's inode lookup

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>

authored by

Filipe David Borba Manana and committed by
Chris Mason
53645a91 d4b4087c

+5 -9
+2 -7
fs/btrfs/free-space-cache.c
··· 2967 2967 2968 2968 int btrfs_write_out_ino_cache(struct btrfs_root *root, 2969 2969 struct btrfs_trans_handle *trans, 2970 - struct btrfs_path *path) 2970 + struct btrfs_path *path, 2971 + struct inode *inode) 2971 2972 { 2972 2973 struct btrfs_free_space_ctl *ctl = root->free_ino_ctl; 2973 - struct inode *inode; 2974 2974 int ret; 2975 2975 2976 2976 if (!btrfs_test_opt(root, INODE_MAP_CACHE)) 2977 - return 0; 2978 - 2979 - inode = lookup_free_ino_inode(root, path); 2980 - if (IS_ERR(inode)) 2981 2977 return 0; 2982 2978 2983 2979 ret = __btrfs_write_out_cache(root, inode, ctl, NULL, trans, path, 0); ··· 2986 2990 #endif 2987 2991 } 2988 2992 2989 - iput(inode); 2990 2993 return ret; 2991 2994 } 2992 2995
+2 -1
fs/btrfs/free-space-cache.h
··· 76 76 struct btrfs_root *root); 77 77 int btrfs_write_out_ino_cache(struct btrfs_root *root, 78 78 struct btrfs_trans_handle *trans, 79 - struct btrfs_path *path); 79 + struct btrfs_path *path, 80 + struct inode *inode); 80 81 81 82 void btrfs_init_free_space_ctl(struct btrfs_block_group_cache *block_group); 82 83 int __btrfs_add_free_space(struct btrfs_free_space_ctl *ctl,
+1 -1
fs/btrfs/inode-map.c
··· 503 503 } 504 504 btrfs_free_reserved_data_space(inode, prealloc); 505 505 506 - ret = btrfs_write_out_ino_cache(root, trans, path); 506 + ret = btrfs_write_out_ino_cache(root, trans, path, inode); 507 507 out_put: 508 508 iput(inode); 509 509 out_release: