summaryrefslogtreecommitdiffstats
path: root/block/bio.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-03-11 17:34:51 +0100
committerJens Axboe <axboe@fb.com>2016-03-14 08:55:22 -0600
commit38f8baae890561203ba6093f76b14576ce9b271b (patch)
tree14d77bee87ae29c2cfdf9cc6734e75768b771478 /block/bio.c
parentaf3e3a5259e35d7056fbe568a0ffcbd1420e1742 (diff)
downloadop-kernel-dev-38f8baae890561203ba6093f76b14576ce9b271b.zip
op-kernel-dev-38f8baae890561203ba6093f76b14576ce9b271b.tar.gz
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/bio.c')
-rw-r--r--block/bio.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/block/bio.c b/block/bio.c
index 282ca2e..67e51ac 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -296,14 +296,19 @@ void bio_reset(struct bio *bio)
}
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;
if (!parent->bi_error)
parent->bi_error = bio->bi_error;
- bio_endio(parent);
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.
*/
if (bio->bi_end_io == bio_chain_endio) {
- struct bio *parent = bio->bi_private;
-
- if (!parent->bi_error)
- parent->bi_error = bio->bi_error;
- bio_put(bio);
- bio = parent;
+ bio = __bio_chain_endio(bio);
} else {
if (bio->bi_end_io)
bio->bi_end_io(bio);
OpenPOWER on IntegriCloud