diff mbox series

[RFC,3/3] fs/buffer: Make submit_bh & submit_bh_wbc return type as void

Message ID ba89f469a59cfaca49478ee391e6bc9dde456e19.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/submit_bh_wbc are non-blocking functions which just submits
the bio and returns. The caller of submit_bh/submit_bh_wbc needs to wait
on buffer till I/O completion and then check buffer head's b_state field
to know if there was any I/O error.

Hence there is no need for these functions to have any return type.
Even now they always returns 0. Hence drop the return value and make
their return type as void to avoid any confusion.

Signed-off-by: Ritesh Harjani <ritesh.list@gmail.com>
---
 fs/buffer.c                 | 9 ++++-----
 include/linux/buffer_head.h | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

Comments

Christoph Hellwig June 20, 2022, 6:40 a.m. UTC | #1
On Mon, Jun 20, 2022 at 11:28:42AM +0530, Ritesh Harjani wrote:
> submit_bh/submit_bh_wbc are non-blocking functions which just submits

s/submits/submit/

> the bio and returns. The caller of submit_bh/submit_bh_wbc needs to wait

s/retuns/return/

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Jan Kara June 20, 2022, 9:41 a.m. UTC | #2
On Mon 20-06-22 11:28:42, Ritesh Harjani wrote:
> submit_bh/submit_bh_wbc are non-blocking functions which just submits
> the bio and returns. The caller of submit_bh/submit_bh_wbc needs to wait
> on buffer till I/O completion and then check buffer head's b_state field
> to know if there was any I/O error.
> 
> Hence there is no need for these functions to have any return type.
> Even now they always returns 0. Hence drop the return value and make
> their return type as void to avoid any confusion.
> 
> 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                 | 9 ++++-----
>  include/linux/buffer_head.h | 2 +-
>  2 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 313283af15b6..6671abc98e21 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -52,7 +52,7 @@
>  #include "internal.h"
>  
>  static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
> -static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
> +static void submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
>  			 struct writeback_control *wbc);
>  
>  #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
> @@ -2994,7 +2994,7 @@ static void end_bio_bh_io_sync(struct bio *bio)
>  	bio_put(bio);
>  }
>  
> -static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
> +static void submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
>  			 struct writeback_control *wbc)
>  {
>  	struct bio *bio;
> @@ -3037,12 +3037,11 @@ static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
>  	}
>  
>  	submit_bio(bio);
> -	return 0;
>  }
>  
> -int submit_bh(int op, int op_flags, struct buffer_head *bh)
> +void submit_bh(int op, int op_flags, struct buffer_head *bh)
>  {
> -	return submit_bh_wbc(op, op_flags, bh, NULL);
> +	submit_bh_wbc(op, op_flags, bh, NULL);
>  }
>  EXPORT_SYMBOL(submit_bh);
>  
> diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
> index c9d1463bb20f..392d7d5aec05 100644
> --- a/include/linux/buffer_head.h
> +++ b/include/linux/buffer_head.h
> @@ -205,7 +205,7 @@ void ll_rw_block(int, int, int, struct buffer_head * bh[]);
>  int sync_dirty_buffer(struct buffer_head *bh);
>  int __sync_dirty_buffer(struct buffer_head *bh, int op_flags);
>  void write_dirty_buffer(struct buffer_head *bh, int op_flags);
> -int submit_bh(int, int, struct buffer_head *);
> +void submit_bh(int op, int op_flags, struct buffer_head *bh);
>  void write_boundary_block(struct block_device *bdev,
>  			sector_t bblock, unsigned blocksize);
>  int bh_uptodate_or_lock(struct buffer_head *bh);
> -- 
> 2.35.3
>
diff mbox series

Patch

diff --git a/fs/buffer.c b/fs/buffer.c
index 313283af15b6..6671abc98e21 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -52,7 +52,7 @@ 
 #include "internal.h"
 
 static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
-static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
+static void submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
 			 struct writeback_control *wbc);
 
 #define BH_ENTRY(list) list_entry((list), struct buffer_head, b_assoc_buffers)
@@ -2994,7 +2994,7 @@  static void end_bio_bh_io_sync(struct bio *bio)
 	bio_put(bio);
 }
 
-static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
+static void submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
 			 struct writeback_control *wbc)
 {
 	struct bio *bio;
@@ -3037,12 +3037,11 @@  static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
 	}
 
 	submit_bio(bio);
-	return 0;
 }
 
-int submit_bh(int op, int op_flags, struct buffer_head *bh)
+void submit_bh(int op, int op_flags, struct buffer_head *bh)
 {
-	return submit_bh_wbc(op, op_flags, bh, NULL);
+	submit_bh_wbc(op, op_flags, bh, NULL);
 }
 EXPORT_SYMBOL(submit_bh);
 
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index c9d1463bb20f..392d7d5aec05 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -205,7 +205,7 @@  void ll_rw_block(int, int, int, struct buffer_head * bh[]);
 int sync_dirty_buffer(struct buffer_head *bh);
 int __sync_dirty_buffer(struct buffer_head *bh, int op_flags);
 void write_dirty_buffer(struct buffer_head *bh, int op_flags);
-int submit_bh(int, int, struct buffer_head *);
+void submit_bh(int op, int op_flags, struct buffer_head *bh);
 void write_boundary_block(struct block_device *bdev,
 			sector_t bblock, unsigned blocksize);
 int bh_uptodate_or_lock(struct buffer_head *bh);