Skip to content

Commit 65565ca

Browse files
Christoph Hellwigaxboe
authored andcommitted
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>
1 parent 452c8f6 commit 65565ca

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

block/bio.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,7 @@ void bio_iov_iter_unbounce(struct bio *bio, bool is_error, bool mark_dirty)
14621462
bio_iov_iter_unbounce_read(bio, is_error, mark_dirty);
14631463
}
14641464

1465-
static void submit_bio_wait_endio(struct bio *bio)
1465+
static void bio_wait_end_io(struct bio *bio)
14661466
{
14671467
complete(bio->bi_private);
14681468
}
@@ -1484,7 +1484,7 @@ int submit_bio_wait(struct bio *bio)
14841484
bio->bi_bdev->bd_disk->lockdep_map);
14851485

14861486
bio->bi_private = &done;
1487-
bio->bi_end_io = submit_bio_wait_endio;
1487+
bio->bi_end_io = bio_wait_end_io;
14881488
bio->bi_opf |= REQ_SYNC;
14891489
submit_bio(bio);
14901490
blk_wait_io(&done);
@@ -1523,12 +1523,6 @@ int bdev_rw_virt(struct block_device *bdev, sector_t sector, void *data,
15231523
}
15241524
EXPORT_SYMBOL_GPL(bdev_rw_virt);
15251525

1526-
static void bio_wait_end_io(struct bio *bio)
1527-
{
1528-
complete(bio->bi_private);
1529-
bio_put(bio);
1530-
}
1531-
15321526
/*
15331527
* bio_await_chain - ends @bio and waits for every chained bio to complete
15341528
*/
@@ -1541,6 +1535,7 @@ void bio_await_chain(struct bio *bio)
15411535
bio->bi_end_io = bio_wait_end_io;
15421536
bio_endio(bio);
15431537
blk_wait_io(&done);
1538+
bio_put(bio);
15441539
}
15451540

15461541
void __bio_advance(struct bio *bio, unsigned bytes)

0 commit comments

Comments
 (0)