Skip to content

Commit 6308d8e

Browse files
GuoqingJiangshligit
authored andcommitted
md: simplify code with bio_io_error
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 <[email protected]> Signed-off-by: Shaohua Li <[email protected]>
1 parent 16d56e2 commit 6308d8e

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

drivers/md/raid1.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,7 @@ static void flush_bio_list(struct r1conf *conf, struct bio *bio)
790790
bio->bi_next = NULL;
791791
bio->bi_bdev = rdev->bdev;
792792
if (test_bit(Faulty, &rdev->flags)) {
793-
bio->bi_status = BLK_STS_IOERR;
794-
bio_endio(bio);
793+
bio_io_error(bio);
795794
} else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
796795
!blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
797796
/* Just ignore it */

drivers/md/raid10.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -905,8 +905,7 @@ static void flush_pending_writes(struct r10conf *conf)
905905
bio->bi_next = NULL;
906906
bio->bi_bdev = rdev->bdev;
907907
if (test_bit(Faulty, &rdev->flags)) {
908-
bio->bi_status = BLK_STS_IOERR;
909-
bio_endio(bio);
908+
bio_io_error(bio);
910909
} else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
911910
!blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
912911
/* Just ignore it */
@@ -1090,8 +1089,7 @@ static void raid10_unplug(struct blk_plug_cb *cb, bool from_schedule)
10901089
bio->bi_next = NULL;
10911090
bio->bi_bdev = rdev->bdev;
10921091
if (test_bit(Faulty, &rdev->flags)) {
1093-
bio->bi_status = BLK_STS_IOERR;
1094-
bio_endio(bio);
1092+
bio_io_error(bio);
10951093
} else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
10961094
!blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
10971095
/* Just ignore it */

drivers/md/raid5.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3381,9 +3381,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
33813381
sh->dev[i].sector + STRIPE_SECTORS) {
33823382
struct bio *nextbi = r5_next_bio(bi, sh->dev[i].sector);
33833383

3384-
bi->bi_status = BLK_STS_IOERR;
33853384
md_write_end(conf->mddev);
3386-
bio_endio(bi);
3385+
bio_io_error(bi);
33873386
bi = nextbi;
33883387
}
33893388
if (bitmap_end)
@@ -3403,9 +3402,8 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
34033402
sh->dev[i].sector + STRIPE_SECTORS) {
34043403
struct bio *bi2 = r5_next_bio(bi, sh->dev[i].sector);
34053404

3406-
bi->bi_status = BLK_STS_IOERR;
34073405
md_write_end(conf->mddev);
3408-
bio_endio(bi);
3406+
bio_io_error(bi);
34093407
bi = bi2;
34103408
}
34113409

@@ -3429,8 +3427,7 @@ handle_failed_stripe(struct r5conf *conf, struct stripe_head *sh,
34293427
struct bio *nextbi =
34303428
r5_next_bio(bi, sh->dev[i].sector);
34313429

3432-
bi->bi_status = BLK_STS_IOERR;
3433-
bio_endio(bi);
3430+
bio_io_error(bi);
34343431
bi = nextbi;
34353432
}
34363433
}

0 commit comments

Comments
 (0)