diff mbox series

[02/20] btrfs: move setting the buffer uptodate out of validate_extent_buffer

Message ID 20230309090526.332550-3-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/20] btrfs: mark extent_buffer_under_io static | expand

Commit Message

Christoph Hellwig March 9, 2023, 9:05 a.m. UTC
Setting the buffer uptodate in a function that is named as a validation
helper is a it confusing.  Move the call from validate_extent_buffer to
the one of its two callers that didn't already have a duplicate call
to set_extent_buffer_uptodate.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/btrfs/disk-io.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Johannes Thumshirn March 9, 2023, 11:10 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Qu Wenruo March 10, 2023, 7:27 a.m. UTC | #2
On 2023/3/9 17:05, Christoph Hellwig wrote:
> Setting the buffer uptodate in a function that is named as a validation
> helper is a it confusing.  Move the call from validate_extent_buffer to
> the one of its two callers that didn't already have a duplicate call
> to set_extent_buffer_uptodate.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

Thanks,
Qu
> ---
>   fs/btrfs/disk-io.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index bb864cf2eed60f..7d766eaef4aee7 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -590,9 +590,7 @@ static int validate_extent_buffer(struct extent_buffer *eb,
>   	if (found_level > 0 && btrfs_check_node(eb))
>   		ret = -EIO;
>   
> -	if (!ret)
> -		set_extent_buffer_uptodate(eb);
> -	else
> +	if (ret)
>   		btrfs_err(fs_info,
>   		"read time tree block corruption detected on logical %llu mirror %u",
>   			  eb->start, eb->read_mirror);
> @@ -684,6 +682,8 @@ int btrfs_validate_metadata_buffer(struct btrfs_bio *bbio,
>   		goto err;
>   	}
>   	ret = validate_extent_buffer(eb, &bbio->parent_check);
> +	if (!ret)
> +		set_extent_buffer_uptodate(eb);
>   err:
>   	if (ret) {
>   		/*
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index bb864cf2eed60f..7d766eaef4aee7 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -590,9 +590,7 @@  static int validate_extent_buffer(struct extent_buffer *eb,
 	if (found_level > 0 && btrfs_check_node(eb))
 		ret = -EIO;
 
-	if (!ret)
-		set_extent_buffer_uptodate(eb);
-	else
+	if (ret)
 		btrfs_err(fs_info,
 		"read time tree block corruption detected on logical %llu mirror %u",
 			  eb->start, eb->read_mirror);
@@ -684,6 +682,8 @@  int btrfs_validate_metadata_buffer(struct btrfs_bio *bbio,
 		goto err;
 	}
 	ret = validate_extent_buffer(eb, &bbio->parent_check);
+	if (!ret)
+		set_extent_buffer_uptodate(eb);
 err:
 	if (ret) {
 		/*