]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
md: simplify code with bio_io_error
authorGuoqing Jiang <gqjiang@suse.com>
Fri, 21 Jul 2017 08:33:44 +0000 (16:33 +0800)
committerShaohua Li <shli@fb.com>
Fri, 21 Jul 2017 20:16:52 +0000 (13:16 -0700)
Since bio_io_error sets bi_status to BLK_STS_IOERR,
and calls bio_endio, so we can use it directly.

And as mentioned by Shaohua, there are also two
places in raid5.c can use bio_io_error either.

Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
drivers/md/raid1.c
drivers/md/raid10.c
drivers/md/raid5.c

index 1d235cc8b402a170e7da33c1e01c0d7c1d6ff3a8..f50958ded9f0c4dd9982c440b20d4e8854697b0d 100644 (file)
@@ -790,8 +790,7 @@ static void flush_bio_list(struct r1conf *conf, struct bio *bio)
                bio->bi_next = NULL;
                bio->bi_bdev = rdev->bdev;
                if (test_bit(Faulty, &rdev->flags)) {
-                       bio->bi_status = BLK_STS_IOERR;
-                       bio_endio(bio);
+                       bio_io_error(bio);
                } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
                                    !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
                        /* Just ignore it */
index e2617d0f37dca8dcb24ed224101b640ce115048a..f55d4cc085f60daa6b25c9f398e462420dbc6c18 100644 (file)
@@ -905,8 +905,7 @@ static void flush_pending_writes(struct r10conf *conf)
                        bio->bi_next = NULL;
                        bio->bi_bdev = rdev->bdev;
                        if (test_bit(Faulty, &rdev->flags)) {
-                               bio->bi_status = BLK_STS_IOERR;
-                               bio_endio(bio);
+                               bio_io_error(bio);
                        } else if (unlikely((bio_op(bio) ==  REQ_OP_DISCARD) &&
                                            !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
                                /* Just ignore it */
@@ -1090,8 +1089,7 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
                bio->bi_next = NULL;
                bio->bi_bdev = rdev->bdev;
                if (test_bit(Faulty, &rdev->flags)) {
-                       bio->bi_status = BLK_STS_IOERR;
-                       bio_endio(bio);
+                       bio_io_error(bio);
                } else if (unlikely((bio_op(bio) ==  REQ_OP_DISCARD) &&
                                    !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
                        /* Just ignore it */
index aeeb8d6854e2610dd2e006aa419264415d950da7..4904dffec915e7cf5f3d486f3d902e659ac78c7e 100644 (file)
@@ -3381,9 +3381,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
                        sh->dev[i].sector + STRIPE_SECTORS) {
                        struct bio *nextbi = r5_next_bio(bi, sh->dev[i].sector);
 
-                       bi->bi_status = BLK_STS_IOERR;
                        md_write_end(conf->mddev);
-                       bio_endio(bi);
+                       bio_io_error(bi);
                        bi = nextbi;
                }
                if (bitmap_end)
@@ -3403,9 +3402,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
                       sh->dev[i].sector + STRIPE_SECTORS) {
                        struct bio *bi2 = r5_next_bio(bi, sh->dev[i].sector);
 
-                       bi->bi_status = BLK_STS_IOERR;
                        md_write_end(conf->mddev);
-                       bio_endio(bi);
+                       bio_io_error(bi);
                        bi = bi2;
                }
 
@@ -3429,8 +3427,7 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
                                struct bio *nextbi =
                                        r5_next_bio(bi, sh->dev[i].sector);
 
-                               bi->bi_status = BLK_STS_IOERR;
-                               bio_endio(bi);
+                               bio_io_error(bi);
                                bi = nextbi;
                        }
                }