Message ID | 5cfceac9f43f2e296437b01f940dd668208c4b98.1707491248.git.fdmanana@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: cleanups and minor performance change to setting/clearing delalloc | expand |
On 2024/2/10 04:30, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > There's no need to pass a root argument to btrfs_add_delalloc_inodes(), we > can just pass the inode since the root is always the root associated to > the inode in the context it's called. So remove it and have the single > caller pass only the inode. > > Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > fs/btrfs/inode.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index 2d16bb08e905..e3d12d8cf088 100644 > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -2385,10 +2385,10 @@ void btrfs_merge_delalloc_extent(struct btrfs_inode *inode, struct extent_state > spin_unlock(&inode->lock); > } > > -static void btrfs_add_delalloc_inodes(struct btrfs_root *root, > - struct btrfs_inode *inode) > +static void btrfs_add_delalloc_inodes(struct btrfs_inode *inode) > { > - struct btrfs_fs_info *fs_info = inode->root->fs_info; > + struct btrfs_root *root = inode->root; > + struct btrfs_fs_info *fs_info = root->fs_info; > > spin_lock(&root->delalloc_lock); > if (list_empty(&inode->delalloc_inodes)) { > @@ -2451,7 +2451,6 @@ void btrfs_set_delalloc_extent(struct btrfs_inode *inode, struct extent_state *s > * bit, which is only set or cleared with irqs on > */ > if (!(state->state & EXTENT_DELALLOC) && (bits & EXTENT_DELALLOC)) { > - struct btrfs_root *root = inode->root; > u64 len = state->end + 1 - state->start; > u32 num_extents = count_max_extents(fs_info, len); > bool do_list = !btrfs_is_free_space_inode(inode); > @@ -2472,7 +2471,7 @@ void btrfs_set_delalloc_extent(struct btrfs_inode *inode, struct extent_state *s > inode->defrag_bytes += len; > if (do_list && !test_bit(BTRFS_INODE_IN_DELALLOC_LIST, > &inode->runtime_flags)) > - btrfs_add_delalloc_inodes(root, inode); > + btrfs_add_delalloc_inodes(inode); > spin_unlock(&inode->lock); > } >
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 2d16bb08e905..e3d12d8cf088 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2385,10 +2385,10 @@ void btrfs_merge_delalloc_extent(struct btrfs_inode *inode, struct extent_state spin_unlock(&inode->lock); } -static void btrfs_add_delalloc_inodes(struct btrfs_root *root, - struct btrfs_inode *inode) +static void btrfs_add_delalloc_inodes(struct btrfs_inode *inode) { - struct btrfs_fs_info *fs_info = inode->root->fs_info; + struct btrfs_root *root = inode->root; + struct btrfs_fs_info *fs_info = root->fs_info; spin_lock(&root->delalloc_lock); if (list_empty(&inode->delalloc_inodes)) { @@ -2451,7 +2451,6 @@ void btrfs_set_delalloc_extent(struct btrfs_inode *inode, struct extent_state *s * bit, which is only set or cleared with irqs on */ if (!(state->state & EXTENT_DELALLOC) && (bits & EXTENT_DELALLOC)) { - struct btrfs_root *root = inode->root; u64 len = state->end + 1 - state->start; u32 num_extents = count_max_extents(fs_info, len); bool do_list = !btrfs_is_free_space_inode(inode); @@ -2472,7 +2471,7 @@ void btrfs_set_delalloc_extent(struct btrfs_inode *inode, struct extent_state *s inode->defrag_bytes += len; if (do_list && !test_bit(BTRFS_INODE_IN_DELALLOC_LIST, &inode->runtime_flags)) - btrfs_add_delalloc_inodes(root, inode); + btrfs_add_delalloc_inodes(inode); spin_unlock(&inode->lock); }