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

btrfs: remove super block argument from btrfs_iget()

It's pointless to pass a super block argument to btrfs_iget() because we
always pass a root and from it we can get the super block through:

root->fs_info->sb

So remove the super block argument.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Filipe Manana and committed by
David Sterba
d13240dd 90df2c10

+19 -22
+1 -1
fs/btrfs/btrfs_inode.h
··· 576 576 void __cold btrfs_destroy_cachep(void); 577 577 struct inode *btrfs_iget_path(struct super_block *s, u64 ino, 578 578 struct btrfs_root *root, struct btrfs_path *path); 579 - struct inode *btrfs_iget(struct super_block *s, u64 ino, struct btrfs_root *root); 579 + struct inode *btrfs_iget(u64 ino, struct btrfs_root *root); 580 580 struct extent_map *btrfs_get_extent(struct btrfs_inode *inode, 581 581 struct page *page, u64 start, u64 len); 582 582 int btrfs_update_inode(struct btrfs_trans_handle *trans,
+1 -1
fs/btrfs/defrag.c
··· 255 255 goto cleanup; 256 256 } 257 257 258 - inode = btrfs_iget(fs_info->sb, defrag->ino, inode_root); 258 + inode = btrfs_iget(defrag->ino, inode_root); 259 259 btrfs_put_root(inode_root); 260 260 if (IS_ERR(inode)) { 261 261 ret = PTR_ERR(inode);
+2 -2
fs/btrfs/export.c
··· 84 84 if (IS_ERR(root)) 85 85 return ERR_CAST(root); 86 86 87 - inode = btrfs_iget(sb, objectid, root); 87 + inode = btrfs_iget(objectid, root); 88 88 btrfs_put_root(root); 89 89 if (IS_ERR(inode)) 90 90 return ERR_CAST(inode); ··· 210 210 found_key.offset, 0); 211 211 } 212 212 213 - return d_obtain_alias(btrfs_iget(fs_info->sb, key.objectid, root)); 213 + return d_obtain_alias(btrfs_iget(key.objectid, root)); 214 214 fail: 215 215 btrfs_free_path(path); 216 216 return ERR_PTR(ret);
+6 -7
fs/btrfs/inode.c
··· 3577 3577 found_key.objectid = found_key.offset; 3578 3578 found_key.type = BTRFS_INODE_ITEM_KEY; 3579 3579 found_key.offset = 0; 3580 - inode = btrfs_iget(fs_info->sb, last_objectid, root); 3580 + inode = btrfs_iget(last_objectid, root); 3581 3581 if (IS_ERR(inode)) { 3582 3582 ret = PTR_ERR(inode); 3583 3583 inode = NULL; ··· 5630 5630 return ERR_PTR(ret); 5631 5631 } 5632 5632 5633 - struct inode *btrfs_iget(struct super_block *s, u64 ino, struct btrfs_root *root) 5633 + struct inode *btrfs_iget(u64 ino, struct btrfs_root *root) 5634 5634 { 5635 - return btrfs_iget_path(s, ino, root, NULL); 5635 + return btrfs_iget_path(root->fs_info->sb, ino, root, NULL); 5636 5636 } 5637 5637 5638 5638 static struct inode *new_simple_dir(struct inode *dir, ··· 5704 5704 return ERR_PTR(ret); 5705 5705 5706 5706 if (location.type == BTRFS_INODE_ITEM_KEY) { 5707 - inode = btrfs_iget(dir->i_sb, location.objectid, root); 5707 + inode = btrfs_iget(location.objectid, root); 5708 5708 if (IS_ERR(inode)) 5709 5709 return inode; 5710 5710 ··· 5728 5728 else 5729 5729 inode = new_simple_dir(dir, &location, root); 5730 5730 } else { 5731 - inode = btrfs_iget(dir->i_sb, location.objectid, sub_root); 5731 + inode = btrfs_iget(location.objectid, sub_root); 5732 5732 btrfs_put_root(sub_root); 5733 5733 5734 5734 if (IS_ERR(inode)) ··· 6403 6403 * Subvolumes inherit properties from their parent subvolume, 6404 6404 * not the directory they were created in. 6405 6405 */ 6406 - parent = btrfs_iget(fs_info->sb, BTRFS_FIRST_FREE_OBJECTID, 6407 - BTRFS_I(dir)->root); 6406 + parent = btrfs_iget(BTRFS_FIRST_FREE_OBJECTID, BTRFS_I(dir)->root); 6408 6407 if (IS_ERR(parent)) { 6409 6408 ret = PTR_ERR(parent); 6410 6409 } else {
+1 -2
fs/btrfs/ioctl.c
··· 1914 1914 struct btrfs_ioctl_ino_lookup_user_args *args) 1915 1915 { 1916 1916 struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info; 1917 - struct super_block *sb = inode->i_sb; 1918 1917 u64 upper_limit = btrfs_ino(BTRFS_I(inode)); 1919 1918 u64 treeid = btrfs_root_id(BTRFS_I(inode)->root); 1920 1919 u64 dirid = args->dirid; ··· 2002 2003 * btree and lock the same leaf. 2003 2004 */ 2004 2005 btrfs_release_path(path); 2005 - temp_inode = btrfs_iget(sb, key2.objectid, root); 2006 + temp_inode = btrfs_iget(key2.objectid, root); 2006 2007 if (IS_ERR(temp_inode)) { 2007 2008 ret = PTR_ERR(temp_inode); 2008 2009 goto out_put;
+2 -2
fs/btrfs/relocation.c
··· 3376 3376 if (inode) 3377 3377 goto truncate; 3378 3378 3379 - inode = btrfs_iget(fs_info->sb, ino, root); 3379 + inode = btrfs_iget(ino, root); 3380 3380 if (IS_ERR(inode)) 3381 3381 return -ENOENT; 3382 3382 ··· 3913 3913 if (ret) 3914 3914 goto out; 3915 3915 3916 - inode = btrfs_iget(fs_info->sb, objectid, root); 3916 + inode = btrfs_iget(objectid, root); 3917 3917 if (IS_ERR(inode)) { 3918 3918 delete_orphan_inode(trans, root, objectid); 3919 3919 ret = PTR_ERR(inode);
+4 -5
fs/btrfs/send.c
··· 5188 5188 static int process_verity(struct send_ctx *sctx) 5189 5189 { 5190 5190 int ret = 0; 5191 - struct btrfs_fs_info *fs_info = sctx->send_root->fs_info; 5192 5191 struct inode *inode; 5193 5192 struct fs_path *p; 5194 5193 5195 - inode = btrfs_iget(fs_info->sb, sctx->cur_ino, sctx->send_root); 5194 + inode = btrfs_iget(sctx->cur_ino, sctx->send_root); 5196 5195 if (IS_ERR(inode)) 5197 5196 return PTR_ERR(inode); 5198 5197 ··· 5549 5550 size_t inline_size; 5550 5551 int ret; 5551 5552 5552 - inode = btrfs_iget(fs_info->sb, sctx->cur_ino, root); 5553 + inode = btrfs_iget(sctx->cur_ino, root); 5553 5554 if (IS_ERR(inode)) 5554 5555 return PTR_ERR(inode); 5555 5556 ··· 5616 5617 u32 crc; 5617 5618 int ret; 5618 5619 5619 - inode = btrfs_iget(fs_info->sb, sctx->cur_ino, root); 5620 + inode = btrfs_iget(sctx->cur_ino, root); 5620 5621 if (IS_ERR(inode)) 5621 5622 return PTR_ERR(inode); 5622 5623 ··· 5745 5746 if (sctx->cur_inode == NULL) { 5746 5747 struct btrfs_root *root = sctx->send_root; 5747 5748 5748 - sctx->cur_inode = btrfs_iget(root->fs_info->sb, sctx->cur_ino, root); 5749 + sctx->cur_inode = btrfs_iget(sctx->cur_ino, root); 5749 5750 if (IS_ERR(sctx->cur_inode)) { 5750 5751 int err = PTR_ERR(sctx->cur_inode); 5751 5752
+1 -1
fs/btrfs/super.c
··· 949 949 return err; 950 950 } 951 951 952 - inode = btrfs_iget(sb, BTRFS_FIRST_FREE_OBJECTID, fs_info->fs_root); 952 + inode = btrfs_iget(BTRFS_FIRST_FREE_OBJECTID, fs_info->fs_root); 953 953 if (IS_ERR(inode)) { 954 954 err = PTR_ERR(inode); 955 955 btrfs_handle_fs_error(fs_info, err, NULL);
+1 -1
fs/btrfs/tree-log.c
··· 151 151 * attempt a transaction commit, resulting in a deadlock. 152 152 */ 153 153 nofs_flag = memalloc_nofs_save(); 154 - inode = btrfs_iget(root->fs_info->sb, objectid, root); 154 + inode = btrfs_iget(objectid, root); 155 155 memalloc_nofs_restore(nofs_flag); 156 156 157 157 return inode;