diff mbox series

[RFC,2/3] fs/buffer: Drop useless return value of submit_bh

Message ID 77274d2a2030f6ee06901496f9c5fbe8779127a3.1655703467.git.ritesh.list@gmail.com (mailing list archive)
State New, archived
Headers show
Series submit_bh: Drop unnecessary return values and API users | expand

Commit Message

Ritesh Harjani (IBM) June 20, 2022, 5:58 a.m. UTC
submit_bh always returns 0. This patch drops the useless return value of
submit_bh from __sync_dirty_buffer(). Once all of submit_bh callers are
cleaned up, we can make it's return type as void.

Signed-off-by: Ritesh Harjani <ritesh.list@gmail.com>
---
 fs/buffer.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Christoph Hellwig June 20, 2022, 6:39 a.m. UTC | #1
On Mon, Jun 20, 2022 at 11:28:41AM +0530, Ritesh Harjani wrote:
> submit_bh always returns 0. This patch drops the useless return value of
> submit_bh from __sync_dirty_buffer(). Once all of submit_bh callers are
> cleaned up, we can make it's return type as void.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Jan Kara June 20, 2022, 9:40 a.m. UTC | #2
On Mon 20-06-22 11:28:41, Ritesh Harjani wrote:
> submit_bh always returns 0. This patch drops the useless return value of
> submit_bh from __sync_dirty_buffer(). Once all of submit_bh callers are
> cleaned up, we can make it's return type as void.
> 
> Signed-off-by: Ritesh Harjani <ritesh.list@gmail.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/buffer.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 898c7f301b1b..313283af15b6 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -3121,8 +3121,6 @@ EXPORT_SYMBOL(write_dirty_buffer);
>   */
>  int __sync_dirty_buffer(struct buffer_head *bh, int op_flags)
>  {
> -	int ret = 0;
> -
>  	WARN_ON(atomic_read(&bh->b_count) < 1);
>  	lock_buffer(bh);
>  	if (test_clear_buffer_dirty(bh)) {
> @@ -3137,14 +3135,14 @@ int __sync_dirty_buffer(struct buffer_head *bh, int op_flags)
>  
>  		get_bh(bh);
>  		bh->b_end_io = end_buffer_write_sync;
> -		ret = submit_bh(REQ_OP_WRITE, op_flags, bh);
> +		submit_bh(REQ_OP_WRITE, op_flags, bh);
>  		wait_on_buffer(bh);
> -		if (!ret && !buffer_uptodate(bh))
> -			ret = -EIO;
> +		if (!buffer_uptodate(bh))
> +			return -EIO;
>  	} else {
>  		unlock_buffer(bh);
>  	}
> -	return ret;
> +	return 0;
>  }
>  EXPORT_SYMBOL(__sync_dirty_buffer);
>  
> -- 
> 2.35.3
>
diff mbox series

Patch

diff --git a/fs/buffer.c b/fs/buffer.c
index 898c7f301b1b..313283af15b6 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3121,8 +3121,6 @@  EXPORT_SYMBOL(write_dirty_buffer);
  */
 int __sync_dirty_buffer(struct buffer_head *bh, int op_flags)
 {
-	int ret = 0;
-
 	WARN_ON(atomic_read(&bh->b_count) < 1);
 	lock_buffer(bh);
 	if (test_clear_buffer_dirty(bh)) {
@@ -3137,14 +3135,14 @@  int __sync_dirty_buffer(struct buffer_head *bh, int op_flags)
 
 		get_bh(bh);
 		bh->b_end_io = end_buffer_write_sync;
-		ret = submit_bh(REQ_OP_WRITE, op_flags, bh);
+		submit_bh(REQ_OP_WRITE, op_flags, bh);
 		wait_on_buffer(bh);
-		if (!ret && !buffer_uptodate(bh))
-			ret = -EIO;
+		if (!buffer_uptodate(bh))
+			return -EIO;
 	} else {
 		unlock_buffer(bh);
 	}
-	return ret;
+	return 0;
 }
 EXPORT_SYMBOL(__sync_dirty_buffer);