All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/3] submit_bh: Drop unnecessary return values and API users
@ 2022-06-20  5:58 Ritesh Harjani
  2022-06-20  5:58 ` [RFC 1/3] jbd2: Drop useless return value of submit_bh Ritesh Harjani
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Ritesh Harjani @ 2022-06-20  5:58 UTC (permalink / raw)
  To: linux-ext4, linux-fsdevel; +Cc: Jan Kara, Alexander Viro, Ritesh Harjani

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.


Ritesh Harjani (3):
  jbd2: Drop useless return value of submit_bh
  fs/buffer: Drop useless return value of submit_bh
  fs/buffer: Make submit_bh & submit_bh_wbc return type as void

 fs/buffer.c                 | 19 ++++++++-----------
 fs/jbd2/commit.c            | 11 +++++------
 fs/jbd2/journal.c           |  6 ++----
 include/linux/buffer_head.h |  2 +-
 4 files changed, 16 insertions(+), 22 deletions(-)

--
2.35.3


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [RFC 1/3] jbd2: Drop useless return value of submit_bh
  2022-06-20  5:58 [RFC 0/3] submit_bh: Drop unnecessary return values and API users Ritesh Harjani
@ 2022-06-20  5:58 ` Ritesh Harjani
  2022-06-20  6:39   ` Christoph Hellwig
                     ` (2 more replies)
  2022-06-20  5:58 ` [RFC 2/3] fs/buffer: " Ritesh Harjani
  2022-06-20  5:58 ` [RFC 3/3] fs/buffer: Make submit_bh & submit_bh_wbc return type as void Ritesh Harjani
  2 siblings, 3 replies; 13+ messages in thread
From: Ritesh Harjani @ 2022-06-20  5:58 UTC (permalink / raw)
  To: linux-ext4, linux-fsdevel; +Cc: Jan Kara, Alexander Viro, Ritesh Harjani

submit_bh always returns 0. This patch cleans up 2 of it's caller
in jbd2 to drop submit_bh's useless return value.
Once all 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/jbd2/commit.c  | 11 +++++------
 fs/jbd2/journal.c |  6 ++----
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index eb315e81f1a6..688fd960d01f 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -122,8 +122,8 @@ static int journal_submit_commit_record(journal_t *journal,
 {
 	struct commit_header *tmp;
 	struct buffer_head *bh;
-	int ret;
 	struct timespec64 now;
+	int write_flags = REQ_SYNC;
 
 	*cbh = NULL;
 
@@ -155,13 +155,12 @@ static int journal_submit_commit_record(journal_t *journal,
 
 	if (journal->j_flags & JBD2_BARRIER &&
 	    !jbd2_has_feature_async_commit(journal))
-		ret = submit_bh(REQ_OP_WRITE,
-			REQ_SYNC | REQ_PREFLUSH | REQ_FUA, bh);
-	else
-		ret = submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
+		write_flags |= REQ_PREFLUSH | REQ_FUA;
+
+	submit_bh(REQ_OP_WRITE, write_flags, bh);
 
 	*cbh = bh;
-	return ret;
+	return 0;
 }
 
 /*
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index c0cbeeaec2d1..81a282e676bc 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -1606,7 +1606,7 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
 {
 	struct buffer_head *bh = journal->j_sb_buffer;
 	journal_superblock_t *sb = journal->j_superblock;
-	int ret;
+	int ret = 0;
 
 	/* Buffer got discarded which means block device got invalidated */
 	if (!buffer_mapped(bh)) {
@@ -1636,14 +1636,12 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
 		sb->s_checksum = jbd2_superblock_csum(journal, sb);
 	get_bh(bh);
 	bh->b_end_io = end_buffer_write_sync;
-	ret = submit_bh(REQ_OP_WRITE, write_flags, bh);
+	submit_bh(REQ_OP_WRITE, write_flags, bh);
 	wait_on_buffer(bh);
 	if (buffer_write_io_error(bh)) {
 		clear_buffer_write_io_error(bh);
 		set_buffer_uptodate(bh);
 		ret = -EIO;
-	}
-	if (ret) {
 		printk(KERN_ERR "JBD2: Error %d detected when updating "
 		       "journal superblock for %s.\n", ret,
 		       journal->j_devname);
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RFC 2/3] fs/buffer: Drop useless return value of submit_bh
  2022-06-20  5:58 [RFC 0/3] submit_bh: Drop unnecessary return values and API users Ritesh Harjani
  2022-06-20  5:58 ` [RFC 1/3] jbd2: Drop useless return value of submit_bh Ritesh Harjani
@ 2022-06-20  5:58 ` Ritesh Harjani
  2022-06-20  6:39   ` Christoph Hellwig
  2022-06-20  9:40   ` Jan Kara
  2022-06-20  5:58 ` [RFC 3/3] fs/buffer: Make submit_bh & submit_bh_wbc return type as void Ritesh Harjani
  2 siblings, 2 replies; 13+ messages in thread
From: Ritesh Harjani @ 2022-06-20  5:58 UTC (permalink / raw)
  To: linux-ext4, linux-fsdevel; +Cc: Jan Kara, Alexander Viro, Ritesh Harjani

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(-)

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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [RFC 3/3] fs/buffer: Make submit_bh & submit_bh_wbc return type as void
  2022-06-20  5:58 [RFC 0/3] submit_bh: Drop unnecessary return values and API users Ritesh Harjani
  2022-06-20  5:58 ` [RFC 1/3] jbd2: Drop useless return value of submit_bh Ritesh Harjani
  2022-06-20  5:58 ` [RFC 2/3] fs/buffer: " Ritesh Harjani
@ 2022-06-20  5:58 ` Ritesh Harjani
  2022-06-20  6:40   ` Christoph Hellwig
  2022-06-20  9:41   ` Jan Kara
  2 siblings, 2 replies; 13+ messages in thread
From: Ritesh Harjani @ 2022-06-20  5:58 UTC (permalink / raw)
  To: linux-ext4, linux-fsdevel; +Cc: Jan Kara, Alexander Viro, Ritesh Harjani

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(-)

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


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] jbd2: Drop useless return value of submit_bh
  2022-06-20  5:58 ` [RFC 1/3] jbd2: Drop useless return value of submit_bh Ritesh Harjani
@ 2022-06-20  6:39   ` Christoph Hellwig
  2022-06-20  9:39   ` Jan Kara
  2022-06-21  1:39   ` Matthew Wilcox
  2 siblings, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2022-06-20  6:39 UTC (permalink / raw)
  To: Ritesh Harjani; +Cc: linux-ext4, linux-fsdevel, Jan Kara, Alexander Viro

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 2/3] fs/buffer: Drop useless return value of submit_bh
  2022-06-20  5:58 ` [RFC 2/3] fs/buffer: " Ritesh Harjani
@ 2022-06-20  6:39   ` Christoph Hellwig
  2022-06-20  9:40   ` Jan Kara
  1 sibling, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2022-06-20  6:39 UTC (permalink / raw)
  To: Ritesh Harjani; +Cc: linux-ext4, linux-fsdevel, Jan Kara, Alexander Viro

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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 3/3] fs/buffer: Make submit_bh & submit_bh_wbc return type as void
  2022-06-20  5:58 ` [RFC 3/3] fs/buffer: Make submit_bh & submit_bh_wbc return type as void Ritesh Harjani
@ 2022-06-20  6:40   ` Christoph Hellwig
  2022-06-20  9:41   ` Jan Kara
  1 sibling, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2022-06-20  6:40 UTC (permalink / raw)
  To: Ritesh Harjani; +Cc: linux-ext4, linux-fsdevel, Jan Kara, Alexander Viro

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>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] jbd2: Drop useless return value of submit_bh
  2022-06-20  5:58 ` [RFC 1/3] jbd2: Drop useless return value of submit_bh Ritesh Harjani
  2022-06-20  6:39   ` Christoph Hellwig
@ 2022-06-20  9:39   ` Jan Kara
  2022-06-21  1:39   ` Matthew Wilcox
  2 siblings, 0 replies; 13+ messages in thread
From: Jan Kara @ 2022-06-20  9:39 UTC (permalink / raw)
  To: Ritesh Harjani; +Cc: linux-ext4, linux-fsdevel, Jan Kara, Alexander Viro

On Mon 20-06-22 11:28:40, Ritesh Harjani wrote:
> submit_bh always returns 0. This patch cleans up 2 of it's caller
> in jbd2 to drop submit_bh's useless return value.
> Once all 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/jbd2/commit.c  | 11 +++++------
>  fs/jbd2/journal.c |  6 ++----
>  2 files changed, 7 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
> index eb315e81f1a6..688fd960d01f 100644
> --- a/fs/jbd2/commit.c
> +++ b/fs/jbd2/commit.c
> @@ -122,8 +122,8 @@ static int journal_submit_commit_record(journal_t *journal,
>  {
>  	struct commit_header *tmp;
>  	struct buffer_head *bh;
> -	int ret;
>  	struct timespec64 now;
> +	int write_flags = REQ_SYNC;
>  
>  	*cbh = NULL;
>  
> @@ -155,13 +155,12 @@ static int journal_submit_commit_record(journal_t *journal,
>  
>  	if (journal->j_flags & JBD2_BARRIER &&
>  	    !jbd2_has_feature_async_commit(journal))
> -		ret = submit_bh(REQ_OP_WRITE,
> -			REQ_SYNC | REQ_PREFLUSH | REQ_FUA, bh);
> -	else
> -		ret = submit_bh(REQ_OP_WRITE, REQ_SYNC, bh);
> +		write_flags |= REQ_PREFLUSH | REQ_FUA;
> +
> +	submit_bh(REQ_OP_WRITE, write_flags, bh);
>  
>  	*cbh = bh;
> -	return ret;
> +	return 0;
>  }
>  
>  /*
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index c0cbeeaec2d1..81a282e676bc 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -1606,7 +1606,7 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
>  {
>  	struct buffer_head *bh = journal->j_sb_buffer;
>  	journal_superblock_t *sb = journal->j_superblock;
> -	int ret;
> +	int ret = 0;
>  
>  	/* Buffer got discarded which means block device got invalidated */
>  	if (!buffer_mapped(bh)) {
> @@ -1636,14 +1636,12 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
>  		sb->s_checksum = jbd2_superblock_csum(journal, sb);
>  	get_bh(bh);
>  	bh->b_end_io = end_buffer_write_sync;
> -	ret = submit_bh(REQ_OP_WRITE, write_flags, bh);
> +	submit_bh(REQ_OP_WRITE, write_flags, bh);
>  	wait_on_buffer(bh);
>  	if (buffer_write_io_error(bh)) {
>  		clear_buffer_write_io_error(bh);
>  		set_buffer_uptodate(bh);
>  		ret = -EIO;
> -	}
> -	if (ret) {
>  		printk(KERN_ERR "JBD2: Error %d detected when updating "
>  		       "journal superblock for %s.\n", ret,
>  		       journal->j_devname);
> -- 
> 2.35.3
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 2/3] fs/buffer: Drop useless return value of submit_bh
  2022-06-20  5:58 ` [RFC 2/3] fs/buffer: " Ritesh Harjani
  2022-06-20  6:39   ` Christoph Hellwig
@ 2022-06-20  9:40   ` Jan Kara
  1 sibling, 0 replies; 13+ messages in thread
From: Jan Kara @ 2022-06-20  9:40 UTC (permalink / raw)
  To: Ritesh Harjani; +Cc: linux-ext4, linux-fsdevel, Jan Kara, Alexander Viro

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
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 3/3] fs/buffer: Make submit_bh & submit_bh_wbc return type as void
  2022-06-20  5:58 ` [RFC 3/3] fs/buffer: Make submit_bh & submit_bh_wbc return type as void Ritesh Harjani
  2022-06-20  6:40   ` Christoph Hellwig
@ 2022-06-20  9:41   ` Jan Kara
  1 sibling, 0 replies; 13+ messages in thread
From: Jan Kara @ 2022-06-20  9:41 UTC (permalink / raw)
  To: Ritesh Harjani; +Cc: linux-ext4, linux-fsdevel, Jan Kara, Alexander Viro

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
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] jbd2: Drop useless return value of submit_bh
  2022-06-20  5:58 ` [RFC 1/3] jbd2: Drop useless return value of submit_bh Ritesh Harjani
  2022-06-20  6:39   ` Christoph Hellwig
  2022-06-20  9:39   ` Jan Kara
@ 2022-06-21  1:39   ` Matthew Wilcox
  2022-07-04  9:01     ` Ritesh Harjani
  2 siblings, 1 reply; 13+ messages in thread
From: Matthew Wilcox @ 2022-06-21  1:39 UTC (permalink / raw)
  To: Ritesh Harjani; +Cc: linux-ext4, linux-fsdevel, Jan Kara, Alexander Viro

On Mon, Jun 20, 2022 at 11:28:40AM +0530, Ritesh Harjani wrote:
> @@ -1636,14 +1636,12 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
>  		sb->s_checksum = jbd2_superblock_csum(journal, sb);
>  	get_bh(bh);
>  	bh->b_end_io = end_buffer_write_sync;
> -	ret = submit_bh(REQ_OP_WRITE, write_flags, bh);
> +	submit_bh(REQ_OP_WRITE, write_flags, bh);
>  	wait_on_buffer(bh);
>  	if (buffer_write_io_error(bh)) {
>  		clear_buffer_write_io_error(bh);
>  		set_buffer_uptodate(bh);
>  		ret = -EIO;
> -	}
> -	if (ret) {
>  		printk(KERN_ERR "JBD2: Error %d detected when updating "
>  		       "journal superblock for %s.\n", ret,
>  		       journal->j_devname);

Maybe rephrase the error message?  And join it together to match the
current preferred style.

		printk(KERN_ERR "JBD2: I/O error when updating journal superblock for %s.\n",
				journal->j_devname);

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] jbd2: Drop useless return value of submit_bh
  2022-06-21  1:39   ` Matthew Wilcox
@ 2022-07-04  9:01     ` Ritesh Harjani
  2022-07-18 17:55       ` Ritesh Harjani
  0 siblings, 1 reply; 13+ messages in thread
From: Ritesh Harjani @ 2022-07-04  9:01 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: linux-ext4, linux-fsdevel, Jan Kara, Alexander Viro

On 22/06/21 02:39AM, Matthew Wilcox wrote:
> On Mon, Jun 20, 2022 at 11:28:40AM +0530, Ritesh Harjani wrote:
> > @@ -1636,14 +1636,12 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
> >  		sb->s_checksum = jbd2_superblock_csum(journal, sb);
> >  	get_bh(bh);
> >  	bh->b_end_io = end_buffer_write_sync;
> > -	ret = submit_bh(REQ_OP_WRITE, write_flags, bh);
> > +	submit_bh(REQ_OP_WRITE, write_flags, bh);
> >  	wait_on_buffer(bh);
> >  	if (buffer_write_io_error(bh)) {
> >  		clear_buffer_write_io_error(bh);
> >  		set_buffer_uptodate(bh);
> >  		ret = -EIO;
> > -	}
> > -	if (ret) {
> >  		printk(KERN_ERR "JBD2: Error %d detected when updating "
> >  		       "journal superblock for %s.\n", ret,
> >  		       journal->j_devname);
>
> Maybe rephrase the error message?  And join it together to match the
> current preferred style.
>
> 		printk(KERN_ERR "JBD2: I/O error when updating journal superblock for %s.\n",
> 				journal->j_devname);

Sure, I will update the printk message like above and send out a v3
(since I haven't receieved any other comments so I think v3 should be good to be
picked up now)

-ritesh


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [RFC 1/3] jbd2: Drop useless return value of submit_bh
  2022-07-04  9:01     ` Ritesh Harjani
@ 2022-07-18 17:55       ` Ritesh Harjani
  0 siblings, 0 replies; 13+ messages in thread
From: Ritesh Harjani @ 2022-07-18 17:55 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-ext4, linux-fsdevel, Jan Kara, Alexander Viro

On 22/07/04 02:31PM, Ritesh Harjani wrote:
> On 22/06/21 02:39AM, Matthew Wilcox wrote:
> > On Mon, Jun 20, 2022 at 11:28:40AM +0530, Ritesh Harjani wrote:
> > > @@ -1636,14 +1636,12 @@ static int jbd2_write_superblock(journal_t *journal, int write_flags)
> > >  		sb->s_checksum = jbd2_superblock_csum(journal, sb);
> > >  	get_bh(bh);
> > >  	bh->b_end_io = end_buffer_write_sync;
> > > -	ret = submit_bh(REQ_OP_WRITE, write_flags, bh);
> > > +	submit_bh(REQ_OP_WRITE, write_flags, bh);
> > >  	wait_on_buffer(bh);
> > >  	if (buffer_write_io_error(bh)) {
> > >  		clear_buffer_write_io_error(bh);
> > >  		set_buffer_uptodate(bh);
> > >  		ret = -EIO;
> > > -	}
> > > -	if (ret) {
> > >  		printk(KERN_ERR "JBD2: Error %d detected when updating "
> > >  		       "journal superblock for %s.\n", ret,
> > >  		       journal->j_devname);
> >
> > Maybe rephrase the error message?  And join it together to match the
> > current preferred style.
> >
> > 		printk(KERN_ERR "JBD2: I/O error when updating journal superblock for %s.\n",
> > 				journal->j_devname);
>
> Sure, I will update the printk message like above and send out a v3
> (since I haven't receieved any other comments so I think v3 should be good to be
> picked up now)


We were planning to send this patch series via ext4 tree.
But it seems this might conflict with the below mentioned patches sitting in
linux-next. So let me rebase my patches on top of these and maybe hold to this
series until the current set of changes land in linux tree to avoid any merge
conflicts later.
But either ways do let me know if you would like to take any other preferred
route. Since this is not critical, so I am fine with either ways you suggest.


-ritesh

author Bart Van Assche <bvanassche@acm.org> Thu Jul 14 11:07:13 2022 -0700

fs/buffer: Combine two submit_bh() and ll_rw_block() arguments

Both submit_bh() and ll_rw_block() accept a request operation type and
request flags as their first two arguments. Micro-optimize these two
functions by combining these first two arguments into a single argument.
This patch does not change the behavior of any of the modified code.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-07-18 17:55 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20  5:58 [RFC 0/3] submit_bh: Drop unnecessary return values and API users Ritesh Harjani
2022-06-20  5:58 ` [RFC 1/3] jbd2: Drop useless return value of submit_bh Ritesh Harjani
2022-06-20  6:39   ` Christoph Hellwig
2022-06-20  9:39   ` Jan Kara
2022-06-21  1:39   ` Matthew Wilcox
2022-07-04  9:01     ` Ritesh Harjani
2022-07-18 17:55       ` Ritesh Harjani
2022-06-20  5:58 ` [RFC 2/3] fs/buffer: " Ritesh Harjani
2022-06-20  6:39   ` Christoph Hellwig
2022-06-20  9:40   ` Jan Kara
2022-06-20  5:58 ` [RFC 3/3] fs/buffer: Make submit_bh & submit_bh_wbc return type as void Ritesh Harjani
2022-06-20  6:40   ` Christoph Hellwig
2022-06-20  9:41   ` Jan Kara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.