diff options
author | Christoph Hellwig <hch@lst.de> | 2016-03-11 11:34:51 -0500 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2016-03-14 10:55:22 -0400 |
commit | 38f8baae890561203ba6093f76b14576ce9b271b (patch) | |
tree | 14d77bee87ae29c2cfdf9cc6734e75768b771478 /block | |
parent | af3e3a5259e35d7056fbe568a0ffcbd1420e1742 (diff) |
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>
Diffstat (limited to 'block')
-rw-r--r-- | block/bio.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/block/bio.c b/block/bio.c index 282ca2e5aaf2..67e51ace1b77 100644 --- a/block/bio.c +++ b/block/bio.c | |||
@@ -296,14 +296,19 @@ void bio_reset(struct bio *bio) | |||
296 | } | 296 | } |
297 | EXPORT_SYMBOL(bio_reset); | 297 | EXPORT_SYMBOL(bio_reset); |
298 | 298 | ||
299 | static void bio_chain_endio(struct bio *bio) | 299 | static struct bio *__bio_chain_endio(struct bio *bio) |
300 | { | 300 | { |
301 | struct bio *parent = bio->bi_private; | 301 | struct bio *parent = bio->bi_private; |
302 | 302 | ||
303 | if (!parent->bi_error) | 303 | if (!parent->bi_error) |
304 | parent->bi_error = bio->bi_error; | 304 | parent->bi_error = bio->bi_error; |
305 | bio_endio(parent); | ||
306 | bio_put(bio); | 305 | 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)); | ||
307 | } | 312 | } |
308 | 313 | ||
309 | /* | 314 | /* |
@@ -1753,12 +1758,7 @@ void bio_endio(struct bio *bio) | |||
1753 | * pointers also disables gcc's sibling call optimization. | 1758 | * pointers also disables gcc's sibling call optimization. |
1754 | */ | 1759 | */ |
1755 | if (bio->bi_end_io == bio_chain_endio) { | 1760 | if (bio->bi_end_io == bio_chain_endio) { |
1756 | struct bio *parent = bio->bi_private; | 1761 | bio = __bio_chain_endio(bio); |
1757 | |||
1758 | if (!parent->bi_error) | ||
1759 | parent->bi_error = bio->bi_error; | ||
1760 | bio_put(bio); | ||
1761 | bio = parent; | ||
1762 | } else { | 1762 | } else { |
1763 | if (bio->bi_end_io) | 1763 | if (bio->bi_end_io) |
1764 | bio->bi_end_io(bio); | 1764 | bio->bi_end_io(bio); |