2022-08-18 05:12:33

by Ritesh Harjani

[permalink] [raw]
Subject: [PATCHv3 3/4] fs/buffer: Drop useless return value of submit_bh

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 (IBM) <[email protected]>
---
fs/buffer.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index 55e762a58eb6..c21b72c06eb0 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2801,8 +2801,6 @@ EXPORT_SYMBOL(write_dirty_buffer);
*/
int __sync_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags)
{
- int ret = 0;
-
WARN_ON(atomic_read(&bh->b_count) < 1);
lock_buffer(bh);
if (test_clear_buffer_dirty(bh)) {
@@ -2817,14 +2815,14 @@ int __sync_dirty_buffer(struct buffer_head *bh, blk_opf_t 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


2022-08-18 14:28:45

by Jan Kara

[permalink] [raw]
Subject: Re: [PATCHv3 3/4] fs/buffer: Drop useless return value of submit_bh

On Thu 18-08-22 10:34:39, Ritesh Harjani (IBM) 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 (IBM) <[email protected]>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

Honza

> ---
> fs/buffer.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 55e762a58eb6..c21b72c06eb0 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -2801,8 +2801,6 @@ EXPORT_SYMBOL(write_dirty_buffer);
> */
> int __sync_dirty_buffer(struct buffer_head *bh, blk_opf_t op_flags)
> {
> - int ret = 0;
> -
> WARN_ON(atomic_read(&bh->b_count) < 1);
> lock_buffer(bh);
> if (test_clear_buffer_dirty(bh)) {
> @@ -2817,14 +2815,14 @@ int __sync_dirty_buffer(struct buffer_head *bh, blk_opf_t 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 <[email protected]>
SUSE Labs, CR