Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] erofs: get rid of raw bi_end_io() usage
@ 2025-11-27  8:02 Gao Xiang
  2025-11-27  8:07 ` [PATCH v2] " Gao Xiang
  0 siblings, 1 reply; 7+ messages in thread
From: Gao Xiang @ 2025-11-27  8:02 UTC (permalink / raw)
  To: linux-erofs; +Cc: LKML, Christoph Hellwig, Ming Lei, Stephen Zhang, Gao Xiang

These BIOs are actually harmless in practice, as they are all pseudo
BIOs and do not use advanced features like chaining.  Using the BIO
interface is a more friendly and unified approach for both bdev and
and file-backed I/Os.

Let's use bio_endio() instead.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/erofs/fileio.c  | 2 +-
 fs/erofs/fscache.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/erofs/fileio.c b/fs/erofs/fileio.c
index b7b3432a9882..a65f86dc79b6 100644
--- a/fs/erofs/fileio.c
+++ b/fs/erofs/fileio.c
@@ -34,7 +34,7 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret)
 	if (rq->bio.bi_end_io) {
 		if (ret < 0 && !rq->bio.bi_status)
 			rq->bio.bi_status = errno_to_blk_status(ret);
-		rq->bio.bi_end_io(&rq->bio);
+		bio_endio(&rq->bio);
 	} else {
 		bio_for_each_folio_all(fi, &rq->bio) {
 			DBG_BUGON(folio_test_uptodate(fi.folio));
diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
index 362acf828279..7a346e20f7b7 100644
--- a/fs/erofs/fscache.c
+++ b/fs/erofs/fscache.c
@@ -185,7 +185,7 @@ static void erofs_fscache_bio_endio(void *priv, ssize_t transferred_or_error)
 
 	if (IS_ERR_VALUE(transferred_or_error))
 		io->bio.bi_status = errno_to_blk_status(transferred_or_error);
-	io->bio.bi_end_io(&io->bio);
+	bio_endio(&io->bio);
 	BUILD_BUG_ON(offsetof(struct erofs_fscache_bio, io) != 0);
 	erofs_fscache_io_put(&io->io);
 }
@@ -216,7 +216,7 @@ void erofs_fscache_submit_bio(struct bio *bio)
 	if (!ret)
 		return;
 	bio->bi_status = errno_to_blk_status(ret);
-	bio->bi_end_io(bio);
+	bio_endio(bio);
 }
 
 static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio)
-- 
2.43.5



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

* [PATCH v2] erofs: get rid of raw bi_end_io() usage
  2025-11-27  8:02 [PATCH] erofs: get rid of raw bi_end_io() usage Gao Xiang
@ 2025-11-27  8:07 ` Gao Xiang
  2025-11-27 14:52   ` Christoph Hellwig
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Gao Xiang @ 2025-11-27  8:07 UTC (permalink / raw)
  To: linux-erofs; +Cc: LKML, Christoph Hellwig, Ming Lei, Stephen Zhang, Gao Xiang

These BIOs are actually harmless in practice, as they are all pseudo
BIOs and do not use advanced features like chaining.  Using the BIO
interface is a more friendly and unified approach for both bdev and
and file-backed I/Os.

Let's use bio_endio() instead.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
v2:
 - call bio_endio() unconditionally in erofs_fileio_ki_complete().

 fs/erofs/fileio.c  | 2 +-
 fs/erofs/fscache.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/erofs/fileio.c b/fs/erofs/fileio.c
index b7b3432a9882..301647b84ca9 100644
--- a/fs/erofs/fileio.c
+++ b/fs/erofs/fileio.c
@@ -34,13 +34,13 @@ static void erofs_fileio_ki_complete(struct kiocb *iocb, long ret)
 	if (rq->bio.bi_end_io) {
 		if (ret < 0 && !rq->bio.bi_status)
 			rq->bio.bi_status = errno_to_blk_status(ret);
-		rq->bio.bi_end_io(&rq->bio);
 	} else {
 		bio_for_each_folio_all(fi, &rq->bio) {
 			DBG_BUGON(folio_test_uptodate(fi.folio));
 			erofs_onlinefolio_end(fi.folio, ret, false);
 		}
 	}
+	bio_endio(&rq->bio);
 	bio_uninit(&rq->bio);
 	kfree(rq);
 }
diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
index 362acf828279..7a346e20f7b7 100644
--- a/fs/erofs/fscache.c
+++ b/fs/erofs/fscache.c
@@ -185,7 +185,7 @@ static void erofs_fscache_bio_endio(void *priv, ssize_t transferred_or_error)
 
 	if (IS_ERR_VALUE(transferred_or_error))
 		io->bio.bi_status = errno_to_blk_status(transferred_or_error);
-	io->bio.bi_end_io(&io->bio);
+	bio_endio(&io->bio);
 	BUILD_BUG_ON(offsetof(struct erofs_fscache_bio, io) != 0);
 	erofs_fscache_io_put(&io->io);
 }
@@ -216,7 +216,7 @@ void erofs_fscache_submit_bio(struct bio *bio)
 	if (!ret)
 		return;
 	bio->bi_status = errno_to_blk_status(ret);
-	bio->bi_end_io(bio);
+	bio_endio(bio);
 }
 
 static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio)
-- 
2.43.5



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

* Re: [PATCH v2] erofs: get rid of raw bi_end_io() usage
  2025-11-27  8:07 ` [PATCH v2] " Gao Xiang
@ 2025-11-27 14:52   ` Christoph Hellwig
  2025-11-28  0:58   ` Ming Lei
  2025-11-28 11:44   ` Chao Yu
  2 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2025-11-27 14:52 UTC (permalink / raw)
  To: Gao Xiang; +Cc: linux-erofs, LKML, Christoph Hellwig, Ming Lei, Stephen Zhang

On Thu, Nov 27, 2025 at 04:07:56PM +0800, Gao Xiang wrote:
> These BIOs are actually harmless in practice, as they are all pseudo
> BIOs and do not use advanced features like chaining.  Using the BIO
> interface is a more friendly and unified approach for both bdev and
> and file-backed I/Os.
> 
> Let's use bio_endio() instead.

Looks good:

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



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

* Re: [PATCH v2] erofs: get rid of raw bi_end_io() usage
  2025-11-27  8:07 ` [PATCH v2] " Gao Xiang
  2025-11-27 14:52   ` Christoph Hellwig
@ 2025-11-28  0:58   ` Ming Lei
  2025-11-28  1:40     ` Gao Xiang
  2025-11-28 11:44   ` Chao Yu
  2 siblings, 1 reply; 7+ messages in thread
From: Ming Lei @ 2025-11-28  0:58 UTC (permalink / raw)
  To: Gao Xiang; +Cc: linux-erofs, LKML, Christoph Hellwig, Stephen Zhang

On Thu, Nov 27, 2025 at 04:07:56PM +0800, Gao Xiang wrote:
> These BIOs are actually harmless in practice, as they are all pseudo
> BIOs and do not use advanced features like chaining.  Using the BIO
> interface is a more friendly and unified approach for both bdev and
> and file-backed I/Os.
> 
> Let's use bio_endio() instead.
> 
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
> v2:
>  - call bio_endio() unconditionally in erofs_fileio_ki_complete().

bio_endio() can cover bio not submitted yet, so:

Reviewed-by: Ming Lei <ming.lei@redhat.com>


Thanks,
Ming



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

* Re: [PATCH v2] erofs: get rid of raw bi_end_io() usage
  2025-11-28  0:58   ` Ming Lei
@ 2025-11-28  1:40     ` Gao Xiang
  2025-11-28  1:57       ` Gao Xiang
  0 siblings, 1 reply; 7+ messages in thread
From: Gao Xiang @ 2025-11-28  1:40 UTC (permalink / raw)
  To: Ming Lei, Christoph Hellwig; +Cc: linux-erofs, LKML, Stephen Zhang



On 2025/11/28 08:58, Ming Lei wrote:
> On Thu, Nov 27, 2025 at 04:07:56PM +0800, Gao Xiang wrote:
>> These BIOs are actually harmless in practice, as they are all pseudo
>> BIOs and do not use advanced features like chaining.  Using the BIO
>> interface is a more friendly and unified approach for both bdev and
>> and file-backed I/Os.
>>
>> Let's use bio_endio() instead.
>>
>> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
>> ---
>> v2:
>>   - call bio_endio() unconditionally in erofs_fileio_ki_complete().
> 
> bio_endio() can cover bio not submitted yet, so:
> 
> Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thank you and Christoph for review!

Thanks,
Gao Xiang


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

* Re: [PATCH v2] erofs: get rid of raw bi_end_io() usage
  2025-11-28  1:40     ` Gao Xiang
@ 2025-11-28  1:57       ` Gao Xiang
  0 siblings, 0 replies; 7+ messages in thread
From: Gao Xiang @ 2025-11-28  1:57 UTC (permalink / raw)
  To: Ming Lei, Christoph Hellwig; +Cc: linux-erofs, LKML, Stephen Zhang



On 2025/11/28 09:40, Gao Xiang wrote:
> 
> 
> On 2025/11/28 08:58, Ming Lei wrote:
>> On Thu, Nov 27, 2025 at 04:07:56PM +0800, Gao Xiang wrote:
>>> These BIOs are actually harmless in practice, as they are all pseudo
>>> BIOs and do not use advanced features like chaining.  Using the BIO
>>> interface is a more friendly and unified approach for both bdev and
>>> and file-backed I/Os.
>>>
>>> Let's use bio_endio() instead.
>>>
>>> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
>>> ---
>>> v2:
>>>   - call bio_endio() unconditionally in erofs_fileio_ki_complete().
>>
>> bio_endio() can cover bio not submitted yet, so:

( btw, nevertheless, it's not submitted, just with or without
   a given bio callback. )

I believe that is ok anyway.

>>
>> Reviewed-by: Ming Lei <ming.lei@redhat.com>
> 
> Thank you and Christoph for review!
> 
> Thanks,
> Gao Xiang



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

* Re: [PATCH v2] erofs: get rid of raw bi_end_io() usage
  2025-11-27  8:07 ` [PATCH v2] " Gao Xiang
  2025-11-27 14:52   ` Christoph Hellwig
  2025-11-28  0:58   ` Ming Lei
@ 2025-11-28 11:44   ` Chao Yu
  2 siblings, 0 replies; 7+ messages in thread
From: Chao Yu @ 2025-11-28 11:44 UTC (permalink / raw)
  To: Gao Xiang, linux-erofs
  Cc: chao, LKML, Christoph Hellwig, Ming Lei, Stephen Zhang

On 11/27/25 16:07, Gao Xiang wrote:
> These BIOs are actually harmless in practice, as they are all pseudo
> BIOs and do not use advanced features like chaining.  Using the BIO
> interface is a more friendly and unified approach for both bdev and
> and file-backed I/Os.
> 
> Let's use bio_endio() instead.
> 
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


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

end of thread, other threads:[~2025-11-28 11:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-27  8:02 [PATCH] erofs: get rid of raw bi_end_io() usage Gao Xiang
2025-11-27  8:07 ` [PATCH v2] " Gao Xiang
2025-11-27 14:52   ` Christoph Hellwig
2025-11-28  0:58   ` Ming Lei
2025-11-28  1:40     ` Gao Xiang
2025-11-28  1:57       ` Gao Xiang
2025-11-28 11:44   ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox