mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-16 18:08:20 +00:00
block: factor out chained bio completion
Factor common code between bio_chain_endio and bio_endio into a common helper. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
This commit is contained in:
parent
af3e3a5259
commit
38f8baae89
16
block/bio.c
16
block/bio.c
@ -296,14 +296,19 @@ void bio_reset(struct bio *bio)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(bio_reset);
|
EXPORT_SYMBOL(bio_reset);
|
||||||
|
|
||||||
static void bio_chain_endio(struct bio *bio)
|
static struct bio *__bio_chain_endio(struct bio *bio)
|
||||||
{
|
{
|
||||||
struct bio *parent = bio->bi_private;
|
struct bio *parent = bio->bi_private;
|
||||||
|
|
||||||
if (!parent->bi_error)
|
if (!parent->bi_error)
|
||||||
parent->bi_error = bio->bi_error;
|
parent->bi_error = bio->bi_error;
|
||||||
bio_endio(parent);
|
|
||||||
bio_put(bio);
|
bio_put(bio);
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void bio_chain_endio(struct bio *bio)
|
||||||
|
{
|
||||||
|
bio_endio(__bio_chain_endio(bio));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1753,12 +1758,7 @@ void bio_endio(struct bio *bio)
|
|||||||
* pointers also disables gcc's sibling call optimization.
|
* pointers also disables gcc's sibling call optimization.
|
||||||
*/
|
*/
|
||||||
if (bio->bi_end_io == bio_chain_endio) {
|
if (bio->bi_end_io == bio_chain_endio) {
|
||||||
struct bio *parent = bio->bi_private;
|
bio = __bio_chain_endio(bio);
|
||||||
|
|
||||||
if (!parent->bi_error)
|
|
||||||
parent->bi_error = bio->bi_error;
|
|
||||||
bio_put(bio);
|
|
||||||
bio = parent;
|
|
||||||
} else {
|
} else {
|
||||||
if (bio->bi_end_io)
|
if (bio->bi_end_io)
|
||||||
bio->bi_end_io(bio);
|
bio->bi_end_io(bio);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user