Skip to content

Commit 38f8baa

Browse files
Christoph Hellwigaxboe
authored andcommitted
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>
1 parent af3e3a5 commit 38f8baa

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

block/bio.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,19 @@ void bio_reset(struct bio *bio)
296296
}
297297
EXPORT_SYMBOL(bio_reset);
298298

299-
static void bio_chain_endio(struct bio *bio)
299+
static struct bio *__bio_chain_endio(struct bio *bio)
300300
{
301301
struct bio *parent = bio->bi_private;
302302

303303
if (!parent->bi_error)
304304
parent->bi_error = bio->bi_error;
305-
bio_endio(parent);
306305
bio_put(bio);
306+
return parent;
307+
}
308+
309+
static void bio_chain_endio(struct bio *bio)
310+
{
311+
bio_endio(__bio_chain_endio(bio));
307312
}
308313

309314
/*
@@ -1753,12 +1758,7 @@ void bio_endio(struct bio *bio)
17531758
* pointers also disables gcc's sibling call optimization.
17541759
*/
17551760
if (bio->bi_end_io == bio_chain_endio) {
1756-
struct bio *parent = bio->bi_private;
1757-
1758-
if (!parent->bi_error)
1759-
parent->bi_error = bio->bi_error;
1760-
bio_put(bio);
1761-
bio = parent;
1761+
bio = __bio_chain_endio(bio);
17621762
} else {
17631763
if (bio->bi_end_io)
17641764
bio->bi_end_io(bio);

0 commit comments

Comments
 (0)