]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - drivers/md/bcache/request.c
block: add a bi_error field to struct bio
[mirror_ubuntu-zesty-kernel.git] / drivers / md / bcache / request.c
index f292790997d72b98fc633dd3da089d93443fbdfa..a09b9462ff49a4925b78f6e2ef08987f10356f2a 100644 (file)
@@ -173,22 +173,22 @@ static void bch_data_insert_error(struct closure *cl)
        bch_data_insert_keys(cl);
 }
 
-static void bch_data_insert_endio(struct bio *bio, int error)
+static void bch_data_insert_endio(struct bio *bio)
 {
        struct closure *cl = bio->bi_private;
        struct data_insert_op *op = container_of(cl, struct data_insert_op, cl);
 
-       if (error) {
+       if (bio->bi_error) {
                /* TODO: We could try to recover from this. */
                if (op->writeback)
-                       op->error = error;
+                       op->error = bio->bi_error;
                else if (!op->replace)
                        set_closure_fn(cl, bch_data_insert_error, op->wq);
                else
                        set_closure_fn(cl, NULL, NULL);
        }
 
-       bch_bbio_endio(op->c, bio, error, "writing data to cache");
+       bch_bbio_endio(op->c, bio, bio->bi_error, "writing data to cache");
 }
 
 static void bch_data_insert_start(struct closure *cl)
@@ -477,7 +477,7 @@ struct search {
        struct data_insert_op   iop;
 };
 
-static void bch_cache_read_endio(struct bio *bio, int error)
+static void bch_cache_read_endio(struct bio *bio)
 {
        struct bbio *b = container_of(bio, struct bbio, bio);
        struct closure *cl = bio->bi_private;
@@ -490,15 +490,15 @@ static void bch_cache_read_endio(struct bio *bio, int error)
         * from the backing device.
         */
 
-       if (error)
-               s->iop.error = error;
+       if (bio->bi_error)
+               s->iop.error = bio->bi_error;
        else if (!KEY_DIRTY(&b->key) &&
                 ptr_stale(s->iop.c, &b->key, 0)) {
                atomic_long_inc(&s->iop.c->cache_read_races);
                s->iop.error = -EINTR;
        }
 
-       bch_bbio_endio(s->iop.c, bio, error, "reading from cache");
+       bch_bbio_endio(s->iop.c, bio, bio->bi_error, "reading from cache");
 }
 
 /*
@@ -591,13 +591,13 @@ static void cache_lookup(struct closure *cl)
 
 /* Common code for the make_request functions */
 
-static void request_endio(struct bio *bio, int error)
+static void request_endio(struct bio *bio)
 {
        struct closure *cl = bio->bi_private;
 
-       if (error) {
+       if (bio->bi_error) {
                struct search *s = container_of(cl, struct search, cl);
-               s->iop.error = error;
+               s->iop.error = bio->bi_error;
                /* Only cache read errors are recoverable */
                s->recoverable = false;
        }
@@ -613,7 +613,8 @@ static void bio_complete(struct search *s)
                                    &s->d->disk->part0, s->start_time);
 
                trace_bcache_request_end(s->d, s->orig_bio);
-               bio_endio(s->orig_bio, s->iop.error);
+               s->orig_bio->bi_error = s->iop.error;
+               bio_endio(s->orig_bio);
                s->orig_bio = NULL;
        }
 }
@@ -992,7 +993,7 @@ static void cached_dev_make_request(struct request_queue *q, struct bio *bio)
        } else {
                if ((bio->bi_rw & REQ_DISCARD) &&
                    !blk_queue_discard(bdev_get_queue(dc->bdev)))
-                       bio_endio(bio, 0);
+                       bio_endio(bio);
                else
                        bch_generic_make_request(bio, &d->bio_split_hook);
        }