diff options
| author | Christoph Hellwig <hch@lst.de> | 2026-04-07 17:05:25 +0300 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-04-07 17:22:24 +0300 |
| commit | 65565ca5f99b42fe62b9a10117cca04f4311dc66 (patch) | |
| tree | 17ae22a0c40497f1746addca006a0700cb70145d | |
| parent | 452c8f6cbd0ef1408474a875c5c4149a02c7610f (diff) | |
| download | linux-65565ca5f99b42fe62b9a10117cca04f4311dc66.tar.xz | |
block: unify the synchronous bi_end_io callbacks
Put the bio in bio_await_chain after waiting for the completion, and
share the now identical callbacks between submit_bio_wait and
bio_await_chain.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Link: https://patch.msgid.link/20260407140538.633364-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
| -rw-r--r-- | block/bio.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/block/bio.c b/block/bio.c index c8234d347fc5..434e41182c05 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1462,7 +1462,7 @@ void bio_iov_iter_unbounce(struct bio *bio, bool is_error, bool mark_dirty) bio_iov_iter_unbounce_read(bio, is_error, mark_dirty); } -static void submit_bio_wait_endio(struct bio *bio) +static void bio_wait_end_io(struct bio *bio) { complete(bio->bi_private); } @@ -1484,7 +1484,7 @@ int submit_bio_wait(struct bio *bio) bio->bi_bdev->bd_disk->lockdep_map); bio->bi_private = &done; - bio->bi_end_io = submit_bio_wait_endio; + bio->bi_end_io = bio_wait_end_io; bio->bi_opf |= REQ_SYNC; submit_bio(bio); blk_wait_io(&done); @@ -1523,12 +1523,6 @@ int bdev_rw_virt(struct block_device *bdev, sector_t sector, void *data, } EXPORT_SYMBOL_GPL(bdev_rw_virt); -static void bio_wait_end_io(struct bio *bio) -{ - complete(bio->bi_private); - bio_put(bio); -} - /* * bio_await_chain - ends @bio and waits for every chained bio to complete */ @@ -1541,6 +1535,7 @@ void bio_await_chain(struct bio *bio) bio->bi_end_io = bio_wait_end_io; bio_endio(bio); blk_wait_io(&done); + bio_put(bio); } void __bio_advance(struct bio *bio, unsigned bytes) |
