diff mbox series

[8/9] btrfs: remove do_list variable at btrfs_set_delalloc_extent()

Message ID f8cf816e7c4d397c41bb2872ef75cd1fa7bdfd44.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

Commit Message

Filipe Manana Feb. 9, 2024, 6 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

The "do_list" variable is only used once, plus its name/meaning is a bit
confusing, so remove it and directory use btrfs_is_free_space_inode().

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Qu Wenruo Feb. 10, 2024, 7:49 a.m. UTC | #1
On 2024/2/10 04:30, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> The "do_list" variable is only used once, plus its name/meaning is a bit
> confusing, so remove it and directory use btrfs_is_free_space_inode().
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>   fs/btrfs/inode.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index fe962a6045fd..17b6ab71584a 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -2462,7 +2462,6 @@ void btrfs_set_delalloc_extent(struct btrfs_inode *inode, struct extent_state *s
>   		u64 len = state->end + 1 - state->start;
>   		u64 prev_delalloc_bytes;
>   		u32 num_extents = count_max_extents(fs_info, len);
> -		bool do_list = !btrfs_is_free_space_inode(inode);
>
>   		spin_lock(&inode->lock);
>   		btrfs_mod_outstanding_extents(inode, num_extents);
> @@ -2487,7 +2486,7 @@ void btrfs_set_delalloc_extent(struct btrfs_inode *inode, struct extent_state *s
>   		 * and are therefore protected against concurrent calls of this
>   		 * function and btrfs_clear_delalloc_extent().
>   		 */
> -		if (do_list && prev_delalloc_bytes == 0)
> +		if (!btrfs_is_free_space_inode(inode) && prev_delalloc_bytes == 0)
>   			btrfs_add_delalloc_inode(inode);
>   	}
>
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index fe962a6045fd..17b6ab71584a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2462,7 +2462,6 @@  void btrfs_set_delalloc_extent(struct btrfs_inode *inode, struct extent_state *s
 		u64 len = state->end + 1 - state->start;
 		u64 prev_delalloc_bytes;
 		u32 num_extents = count_max_extents(fs_info, len);
-		bool do_list = !btrfs_is_free_space_inode(inode);
 
 		spin_lock(&inode->lock);
 		btrfs_mod_outstanding_extents(inode, num_extents);
@@ -2487,7 +2486,7 @@  void btrfs_set_delalloc_extent(struct btrfs_inode *inode, struct extent_state *s
 		 * and are therefore protected against concurrent calls of this
 		 * function and btrfs_clear_delalloc_extent().
 		 */
-		if (do_list && prev_delalloc_bytes == 0)
+		if (!btrfs_is_free_space_inode(inode) && prev_delalloc_bytes == 0)
 			btrfs_add_delalloc_inode(inode);
 	}