diff mbox series

[3/4] btrfs: return void from csum_tree_block

Message ID c6518711b16ccd373084b8df681db41c198cb1ec.1582832619.git.dsterba@suse.com (mailing list archive)
State New, archived
Headers show
Series Misc cleanups | expand

Commit Message

David Sterba Feb. 27, 2020, 8 p.m. UTC
Now that csum_tree_block is not returning any errors, we can make
csum_tree_block return void and simplify callers.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/disk-io.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

Comments

Johannes Thumshirn Feb. 27, 2020, 10:32 p.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Qu Wenruo Feb. 28, 2020, 8:41 a.m. UTC | #2
On 2020/2/28 上午4:00, David Sterba wrote:
> Now that csum_tree_block is not returning any errors, we can make
> csum_tree_block return void and simplify callers.
> 
> Signed-off-by: David Sterba <dsterba@suse.com>

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

Thanks,
Qu

> ---
>  fs/btrfs/disk-io.c | 13 +++----------
>  1 file changed, 3 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 5f74eb69f2fe..8401852cf9c0 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -253,10 +253,8 @@ struct extent_map *btree_get_extent(struct btrfs_inode *inode,
>  
>  /*
>   * Compute the csum of a btree block and store the result to provided buffer.
> - *
> - * Returns error if the extent buffer cannot be mapped.
>   */
> -static int csum_tree_block(struct extent_buffer *buf, u8 *result)
> +static void csum_tree_block(struct extent_buffer *buf, u8 *result)
>  {
>  	struct btrfs_fs_info *fs_info = buf->fs_info;
>  	const int num_pages = fs_info->nodesize >> PAGE_SHIFT;
> @@ -276,8 +274,6 @@ static int csum_tree_block(struct extent_buffer *buf, u8 *result)
>  	}
>  	memset(result, 0, BTRFS_CSUM_SIZE);
>  	crypto_shash_final(shash, result);
> -
> -	return 0;
>  }
>  
>  /*
> @@ -528,8 +524,7 @@ static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page)
>  				    offsetof(struct btrfs_header, fsid),
>  				    BTRFS_FSID_SIZE) == 0);
>  
> -	if (csum_tree_block(eb, result))
> -		return -EINVAL;
> +	csum_tree_block(eb, result);
>  
>  	if (btrfs_header_level(eb))
>  		ret = btrfs_check_node(eb);
> @@ -640,9 +635,7 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
>  	btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb),
>  				       eb, found_level);
>  
> -	ret = csum_tree_block(eb, result);
> -	if (ret)
> -		goto err;
> +	csum_tree_block(eb, result);
>  
>  	if (memcmp_extent_buffer(eb, result, 0, csum_size)) {
>  		u32 val;
>
diff mbox series

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 5f74eb69f2fe..8401852cf9c0 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -253,10 +253,8 @@  struct extent_map *btree_get_extent(struct btrfs_inode *inode,
 
 /*
  * Compute the csum of a btree block and store the result to provided buffer.
- *
- * Returns error if the extent buffer cannot be mapped.
  */
-static int csum_tree_block(struct extent_buffer *buf, u8 *result)
+static void csum_tree_block(struct extent_buffer *buf, u8 *result)
 {
 	struct btrfs_fs_info *fs_info = buf->fs_info;
 	const int num_pages = fs_info->nodesize >> PAGE_SHIFT;
@@ -276,8 +274,6 @@  static int csum_tree_block(struct extent_buffer *buf, u8 *result)
 	}
 	memset(result, 0, BTRFS_CSUM_SIZE);
 	crypto_shash_final(shash, result);
-
-	return 0;
 }
 
 /*
@@ -528,8 +524,7 @@  static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page)
 				    offsetof(struct btrfs_header, fsid),
 				    BTRFS_FSID_SIZE) == 0);
 
-	if (csum_tree_block(eb, result))
-		return -EINVAL;
+	csum_tree_block(eb, result);
 
 	if (btrfs_header_level(eb))
 		ret = btrfs_check_node(eb);
@@ -640,9 +635,7 @@  static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
 	btrfs_set_buffer_lockdep_class(btrfs_header_owner(eb),
 				       eb, found_level);
 
-	ret = csum_tree_block(eb, result);
-	if (ret)
-		goto err;
+	csum_tree_block(eb, result);
 
 	if (memcmp_extent_buffer(eb, result, 0, csum_size)) {
 		u32 val;