diff mbox series

[4/9] btrfs: open code set_extent_dirty

Message ID 2d4be0b36bb199c70308f945320def249512b0d9.1684967923.git.dsterba@suse.com (mailing list archive)
State New, archived
Headers show
Series Parameter cleanups in extent state helpers | expand

Commit Message

David Sterba May 24, 2023, 11:04 p.m. UTC
The helper is used a few times, that it's setting the DIRTY extent bit
is still clear.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/block-group.c    |  7 ++++---
 fs/btrfs/extent-io-tree.h |  6 ------
 fs/btrfs/extent-tree.c    | 15 +++++++++------
 3 files changed, 13 insertions(+), 15 deletions(-)

Comments

Christoph Hellwig May 25, 2023, 9 a.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Qu Wenruo May 25, 2023, 10:33 a.m. UTC | #2
On 2023/5/25 07:04, David Sterba wrote:
> The helper is used a few times, that it's setting the DIRTY extent bit
> is still clear.
>
> Signed-off-by: David Sterba <dsterba@suse.com>

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

Thanks,
Qu
> ---
>   fs/btrfs/block-group.c    |  7 ++++---
>   fs/btrfs/extent-io-tree.h |  6 ------
>   fs/btrfs/extent-tree.c    | 15 +++++++++------
>   3 files changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
> index 590b03560265..ec463f8d83ec 100644
> --- a/fs/btrfs/block-group.c
> +++ b/fs/btrfs/block-group.c
> @@ -3521,9 +3521,10 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans,
>   			spin_unlock(&cache->lock);
>   			spin_unlock(&space_info->lock);
>
> -			set_extent_dirty(&trans->transaction->pinned_extents,
> -					 bytenr, bytenr + num_bytes - 1,
> -					 GFP_NOFS | __GFP_NOFAIL);
> +			set_extent_bit(&trans->transaction->pinned_extents,
> +				       bytenr, bytenr + num_bytes - 1,
> +				       EXTENT_DIRTY, NULL,
> +				       GFP_NOFS | __GFP_NOFAIL);
>   		}
>
>   		spin_lock(&trans->transaction->dirty_bgs_lock);
> diff --git a/fs/btrfs/extent-io-tree.h b/fs/btrfs/extent-io-tree.h
> index 293e49377104..0fc54546a63d 100644
> --- a/fs/btrfs/extent-io-tree.h
> +++ b/fs/btrfs/extent-io-tree.h
> @@ -175,12 +175,6 @@ static inline int clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
>   				  cached_state, GFP_NOFS, NULL);
>   }
>
> -static inline int set_extent_dirty(struct extent_io_tree *tree, u64 start,
> -		u64 end, gfp_t mask)
> -{
> -	return set_extent_bit(tree, start, end, EXTENT_DIRTY, NULL, mask);
> -}
> -
>   static inline int clear_extent_dirty(struct extent_io_tree *tree, u64 start,
>   				     u64 end, struct extent_state **cached)
>   {
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 5c7c72042193..47cfb694cdbf 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2507,8 +2507,9 @@ static int pin_down_extent(struct btrfs_trans_handle *trans,
>   	spin_unlock(&cache->lock);
>   	spin_unlock(&cache->space_info->lock);
>
> -	set_extent_dirty(&trans->transaction->pinned_extents, bytenr,
> -			 bytenr + num_bytes - 1, GFP_NOFS | __GFP_NOFAIL);
> +	set_extent_bit(&trans->transaction->pinned_extents, bytenr,
> +		       bytenr + num_bytes - 1, EXTENT_DIRTY, NULL,
> +		       GFP_NOFS | __GFP_NOFAIL);
>   	return 0;
>   }
>
> @@ -4829,16 +4830,18 @@ btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
>   		 * EXTENT bit to differentiate dirty pages.
>   		 */
>   		if (buf->log_index == 0)
> -			set_extent_dirty(&root->dirty_log_pages, buf->start,
> -					buf->start + buf->len - 1, GFP_NOFS);
> +			set_extent_bit(&root->dirty_log_pages, buf->start,
> +				       buf->start + buf->len - 1,
> +				       EXTENT_DIRTY, NULL, GFP_NOFS);
>   		else
>   			set_extent_bit(&root->dirty_log_pages, buf->start,
>   				       buf->start + buf->len - 1,
>   				       EXTENT_NEW, NULL, GFP_NOFS);
>   	} else {
>   		buf->log_index = -1;
> -		set_extent_dirty(&trans->transaction->dirty_pages, buf->start,
> -			 buf->start + buf->len - 1, GFP_NOFS);
> +		set_extent_bit(&trans->transaction->dirty_pages, buf->start,
> +			       buf->start + buf->len - 1, EXTENT_DIRTY, NULL,
> +			       GFP_NOFS);
>   	}
>   	/* this returns a buffer locked for blocking */
>   	return buf;
diff mbox series

Patch

diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c
index 590b03560265..ec463f8d83ec 100644
--- a/fs/btrfs/block-group.c
+++ b/fs/btrfs/block-group.c
@@ -3521,9 +3521,10 @@  int btrfs_update_block_group(struct btrfs_trans_handle *trans,
 			spin_unlock(&cache->lock);
 			spin_unlock(&space_info->lock);
 
-			set_extent_dirty(&trans->transaction->pinned_extents,
-					 bytenr, bytenr + num_bytes - 1,
-					 GFP_NOFS | __GFP_NOFAIL);
+			set_extent_bit(&trans->transaction->pinned_extents,
+				       bytenr, bytenr + num_bytes - 1,
+				       EXTENT_DIRTY, NULL,
+				       GFP_NOFS | __GFP_NOFAIL);
 		}
 
 		spin_lock(&trans->transaction->dirty_bgs_lock);
diff --git a/fs/btrfs/extent-io-tree.h b/fs/btrfs/extent-io-tree.h
index 293e49377104..0fc54546a63d 100644
--- a/fs/btrfs/extent-io-tree.h
+++ b/fs/btrfs/extent-io-tree.h
@@ -175,12 +175,6 @@  static inline int clear_extent_uptodate(struct extent_io_tree *tree, u64 start,
 				  cached_state, GFP_NOFS, NULL);
 }
 
-static inline int set_extent_dirty(struct extent_io_tree *tree, u64 start,
-		u64 end, gfp_t mask)
-{
-	return set_extent_bit(tree, start, end, EXTENT_DIRTY, NULL, mask);
-}
-
 static inline int clear_extent_dirty(struct extent_io_tree *tree, u64 start,
 				     u64 end, struct extent_state **cached)
 {
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 5c7c72042193..47cfb694cdbf 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2507,8 +2507,9 @@  static int pin_down_extent(struct btrfs_trans_handle *trans,
 	spin_unlock(&cache->lock);
 	spin_unlock(&cache->space_info->lock);
 
-	set_extent_dirty(&trans->transaction->pinned_extents, bytenr,
-			 bytenr + num_bytes - 1, GFP_NOFS | __GFP_NOFAIL);
+	set_extent_bit(&trans->transaction->pinned_extents, bytenr,
+		       bytenr + num_bytes - 1, EXTENT_DIRTY, NULL,
+		       GFP_NOFS | __GFP_NOFAIL);
 	return 0;
 }
 
@@ -4829,16 +4830,18 @@  btrfs_init_new_buffer(struct btrfs_trans_handle *trans, struct btrfs_root *root,
 		 * EXTENT bit to differentiate dirty pages.
 		 */
 		if (buf->log_index == 0)
-			set_extent_dirty(&root->dirty_log_pages, buf->start,
-					buf->start + buf->len - 1, GFP_NOFS);
+			set_extent_bit(&root->dirty_log_pages, buf->start,
+				       buf->start + buf->len - 1,
+				       EXTENT_DIRTY, NULL, GFP_NOFS);
 		else
 			set_extent_bit(&root->dirty_log_pages, buf->start,
 				       buf->start + buf->len - 1,
 				       EXTENT_NEW, NULL, GFP_NOFS);
 	} else {
 		buf->log_index = -1;
-		set_extent_dirty(&trans->transaction->dirty_pages, buf->start,
-			 buf->start + buf->len - 1, GFP_NOFS);
+		set_extent_bit(&trans->transaction->dirty_pages, buf->start,
+			       buf->start + buf->len - 1, EXTENT_DIRTY, NULL,
+			       GFP_NOFS);
 	}
 	/* this returns a buffer locked for blocking */
 	return buf;