diff mbox series

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

Message ID c943cf4b01e5e27d04c0cf8dbf58d9f2ff8119af.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 has a rather confusing name, so remove it and
directly use btrfs_is_free_space_inode() instead.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 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 has a rather confusing name, so remove it and
> directly use btrfs_is_free_space_inode() instead.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

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

Thanks,
Qu

> ---
>   fs/btrfs/inode.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 17b6ab71584a..5bb61d4aa2cb 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -2525,7 +2525,6 @@ void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
>   	if ((state->state & EXTENT_DELALLOC) && (bits & EXTENT_DELALLOC)) {
>   		struct btrfs_root *root = inode->root;
>   		u64 new_delalloc_bytes;
> -		bool do_list = !btrfs_is_free_space_inode(inode);
>
>   		spin_lock(&inode->lock);
>   		btrfs_mod_outstanding_extents(inode, -num_extents);
> @@ -2545,7 +2544,8 @@ void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
>   			return;
>
>   		if (!btrfs_is_data_reloc_root(root) &&
> -		    do_list && !(state->state & EXTENT_NORESERVE) &&
> +		    !btrfs_is_free_space_inode(inode) &&
> +		    !(state->state & EXTENT_NORESERVE) &&
>   		    (bits & EXTENT_CLEAR_DATA_RESV))
>   			btrfs_free_reserved_data_space_noquota(fs_info, len);
>
> @@ -2562,7 +2562,7 @@ void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
>   		 * and are therefore protected against concurrent calls of this
>   		 * function and btrfs_set_delalloc_extent().
>   		 */
> -		if (do_list && new_delalloc_bytes == 0)
> +		if (!btrfs_is_free_space_inode(inode) && new_delalloc_bytes == 0)
>   			btrfs_del_delalloc_inode(inode);
>   	}
>
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 17b6ab71584a..5bb61d4aa2cb 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -2525,7 +2525,6 @@  void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
 	if ((state->state & EXTENT_DELALLOC) && (bits & EXTENT_DELALLOC)) {
 		struct btrfs_root *root = inode->root;
 		u64 new_delalloc_bytes;
-		bool do_list = !btrfs_is_free_space_inode(inode);
 
 		spin_lock(&inode->lock);
 		btrfs_mod_outstanding_extents(inode, -num_extents);
@@ -2545,7 +2544,8 @@  void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
 			return;
 
 		if (!btrfs_is_data_reloc_root(root) &&
-		    do_list && !(state->state & EXTENT_NORESERVE) &&
+		    !btrfs_is_free_space_inode(inode) &&
+		    !(state->state & EXTENT_NORESERVE) &&
 		    (bits & EXTENT_CLEAR_DATA_RESV))
 			btrfs_free_reserved_data_space_noquota(fs_info, len);
 
@@ -2562,7 +2562,7 @@  void btrfs_clear_delalloc_extent(struct btrfs_inode *inode,
 		 * and are therefore protected against concurrent calls of this
 		 * function and btrfs_set_delalloc_extent().
 		 */
-		if (do_list && new_delalloc_bytes == 0)
+		if (!btrfs_is_free_space_inode(inode) && new_delalloc_bytes == 0)
 			btrfs_del_delalloc_inode(inode);
 	}