btrfs: remove redundant root argument from maybe_insert_hole()
authorFilipe Manana <fdmanana@suse.com>
Fri, 22 Sep 2023 10:37:25 +0000 (11:37 +0100)
committerDavid Sterba <dsterba@suse.com>
Thu, 12 Oct 2023 14:44:12 +0000 (16:44 +0200)
The root argument for maybe_insert_hole() always matches the root of the
given inode, so remove the root argument and get it from the inode
argument.

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>
fs/btrfs/inode.c

index 54647b7fb6009b2a15d839d487bd1000c1fcce65..52576deda654c2b3ecd8d9555612ca3546927437 100644 (file)
@@ -4800,9 +4800,9 @@ out:
        return ret;
 }
 
-static int maybe_insert_hole(struct btrfs_root *root, struct btrfs_inode *inode,
-                            u64 offset, u64 len)
+static int maybe_insert_hole(struct btrfs_inode *inode, u64 offset, u64 len)
 {
+       struct btrfs_root *root = inode->root;
        struct btrfs_fs_info *fs_info = root->fs_info;
        struct btrfs_trans_handle *trans;
        struct btrfs_drop_extents_args drop_args = { 0 };
@@ -4898,8 +4898,7 @@ int btrfs_cont_expand(struct btrfs_inode *inode, loff_t oldsize, loff_t size)
                if (!test_bit(EXTENT_FLAG_PREALLOC, &em->flags)) {
                        struct extent_map *hole_em;
 
-                       err = maybe_insert_hole(root, inode, cur_offset,
-                                               hole_size);
+                       err = maybe_insert_hole(inode, cur_offset, hole_size);
                        if (err)
                                break;