Message ID | 6f3a5b0048ea27c88a69e4861e2b6b86afd284f9.1695333082.git.fdmanana@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: some cleanups around inode update and helpers | expand |
On 2023/9/22 20:07, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > 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. > > Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > fs/btrfs/inode.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index 54647b7fb600..52576deda654 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -4800,9 +4800,9 @@ int btrfs_truncate_block(struct btrfs_inode *inode, loff_t from, loff_t len, > 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; >
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 54647b7fb600..52576deda654 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4800,9 +4800,9 @@ int btrfs_truncate_block(struct btrfs_inode *inode, loff_t from, loff_t len, 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;