aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid1.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-06-03 03:38:06 -0400
committerJens Axboe <axboe@fb.com>2017-06-09 11:27:32 -0400
commit4e4cbee93d56137ebff722be022cae5f70ef84fb (patch)
tree4fa7345155599fc6bdd653fca8c5224ddf90a5be /drivers/md/raid1.c
parentfc17b6534eb8395f0b3133eb31d87deec32c642b (diff)
block: switch bios to blk_status_t
Replace bi_error with a new bi_status to allow for a clear conversion. Note that device mapper overloaded bi_error with a private value, which we'll have to keep arround at least for now and thus propagate to a proper blk_status_t value. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r--drivers/md/raid1.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index af5056d56878..94b87c4d0f7b 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -277,7 +277,7 @@ static void call_bio_endio(struct r1bio *r1_bio)
277 struct r1conf *conf = r1_bio->mddev->private; 277 struct r1conf *conf = r1_bio->mddev->private;
278 278
279 if (!test_bit(R1BIO_Uptodate, &r1_bio->state)) 279 if (!test_bit(R1BIO_Uptodate, &r1_bio->state))
280 bio->bi_error = -EIO; 280 bio->bi_status = BLK_STS_IOERR;
281 281
282 bio_endio(bio); 282 bio_endio(bio);
283 /* 283 /*
@@ -335,7 +335,7 @@ static int find_bio_disk(struct r1bio *r1_bio, struct bio *bio)
335 335
336static void raid1_end_read_request(struct bio *bio) 336static void raid1_end_read_request(struct bio *bio)
337{ 337{
338 int uptodate = !bio->bi_error; 338 int uptodate = !bio->bi_status;
339 struct r1bio *r1_bio = bio->bi_private; 339 struct r1bio *r1_bio = bio->bi_private;
340 struct r1conf *conf = r1_bio->mddev->private; 340 struct r1conf *conf = r1_bio->mddev->private;
341 struct md_rdev *rdev = conf->mirrors[r1_bio->read_disk].rdev; 341 struct md_rdev *rdev = conf->mirrors[r1_bio->read_disk].rdev;
@@ -426,12 +426,12 @@ static void raid1_end_write_request(struct bio *bio)
426 struct md_rdev *rdev = conf->mirrors[mirror].rdev; 426 struct md_rdev *rdev = conf->mirrors[mirror].rdev;
427 bool discard_error; 427 bool discard_error;
428 428
429 discard_error = bio->bi_error && bio_op(bio) == REQ_OP_DISCARD; 429 discard_error = bio->bi_status && bio_op(bio) == REQ_OP_DISCARD;
430 430
431 /* 431 /*
432 * 'one mirror IO has finished' event handler: 432 * 'one mirror IO has finished' event handler:
433 */ 433 */
434 if (bio->bi_error && !discard_error) { 434 if (bio->bi_status && !discard_error) {
435 set_bit(WriteErrorSeen, &rdev->flags); 435 set_bit(WriteErrorSeen, &rdev->flags);
436 if (!test_and_set_bit(WantReplacement, &rdev->flags)) 436 if (!test_and_set_bit(WantReplacement, &rdev->flags))
437 set_bit(MD_RECOVERY_NEEDED, & 437 set_bit(MD_RECOVERY_NEEDED, &
@@ -802,7 +802,7 @@ static void flush_bio_list(struct r1conf *conf, struct bio *bio)
802 bio->bi_next = NULL; 802 bio->bi_next = NULL;
803 bio->bi_bdev = rdev->bdev; 803 bio->bi_bdev = rdev->bdev;
804 if (test_bit(Faulty, &rdev->flags)) { 804 if (test_bit(Faulty, &rdev->flags)) {
805 bio->bi_error = -EIO; 805 bio->bi_status = BLK_STS_IOERR;
806 bio_endio(bio); 806 bio_endio(bio);
807 } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) && 807 } else if (unlikely((bio_op(bio) == REQ_OP_DISCARD) &&
808 !blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) 808 !blk_queue_discard(bdev_get_queue(bio->bi_bdev))))
@@ -1856,7 +1856,7 @@ static void end_sync_read(struct bio *bio)
1856 * or re-read if the read failed. 1856 * or re-read if the read failed.
1857 * We don't do much here, just schedule handling by raid1d 1857 * We don't do much here, just schedule handling by raid1d
1858 */ 1858 */
1859 if (!bio->bi_error) 1859 if (!bio->bi_status)
1860 set_bit(R1BIO_Uptodate, &r1_bio->state); 1860 set_bit(R1BIO_Uptodate, &r1_bio->state);
1861 1861
1862 if (atomic_dec_and_test(&r1_bio->remaining)) 1862 if (atomic_dec_and_test(&r1_bio->remaining))
@@ -1865,7 +1865,7 @@ static void end_sync_read(struct bio *bio)
1865 1865
1866static void end_sync_write(struct bio *bio) 1866static void end_sync_write(struct bio *bio)
1867{ 1867{
1868 int uptodate = !bio->bi_error; 1868 int uptodate = !bio->bi_status;
1869 struct r1bio *r1_bio = get_resync_r1bio(bio); 1869 struct r1bio *r1_bio = get_resync_r1bio(bio);
1870 struct mddev *mddev = r1_bio->mddev; 1870 struct mddev *mddev = r1_bio->mddev;
1871 struct r1conf *conf = mddev->private; 1871 struct r1conf *conf = mddev->private;
@@ -2058,7 +2058,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
2058 idx ++; 2058 idx ++;
2059 } 2059 }
2060 set_bit(R1BIO_Uptodate, &r1_bio->state); 2060 set_bit(R1BIO_Uptodate, &r1_bio->state);
2061 bio->bi_error = 0; 2061 bio->bi_status = 0;
2062 return 1; 2062 return 1;
2063} 2063}
2064 2064
@@ -2082,16 +2082,16 @@ static void process_checks(struct r1bio *r1_bio)
2082 for (i = 0; i < conf->raid_disks * 2; i++) { 2082 for (i = 0; i < conf->raid_disks * 2; i++) {
2083 int j; 2083 int j;
2084 int size; 2084 int size;
2085 int error; 2085 blk_status_t status;
2086 struct bio_vec *bi; 2086 struct bio_vec *bi;
2087 struct bio *b = r1_bio->bios[i]; 2087 struct bio *b = r1_bio->bios[i];
2088 struct resync_pages *rp = get_resync_pages(b); 2088 struct resync_pages *rp = get_resync_pages(b);
2089 if (b->bi_end_io != end_sync_read) 2089 if (b->bi_end_io != end_sync_read)
2090 continue; 2090 continue;
2091 /* fixup the bio for reuse, but preserve errno */ 2091 /* fixup the bio for reuse, but preserve errno */
2092 error = b->bi_error; 2092 status = b->bi_status;
2093 bio_reset(b); 2093 bio_reset(b);
2094 b->bi_error = error; 2094 b->bi_status = status;
2095 b->bi_vcnt = vcnt; 2095 b->bi_vcnt = vcnt;
2096 b->bi_iter.bi_size = r1_bio->sectors << 9; 2096 b->bi_iter.bi_size = r1_bio->sectors << 9;
2097 b->bi_iter.bi_sector = r1_bio->sector + 2097 b->bi_iter.bi_sector = r1_bio->sector +
@@ -2113,7 +2113,7 @@ static void process_checks(struct r1bio *r1_bio)
2113 } 2113 }
2114 for (primary = 0; primary < conf->raid_disks * 2; primary++) 2114 for (primary = 0; primary < conf->raid_disks * 2; primary++)
2115 if (r1_bio->bios[primary]->bi_end_io == end_sync_read && 2115 if (r1_bio->bios[primary]->bi_end_io == end_sync_read &&
2116 !r1_bio->bios[primary]->bi_error) { 2116 !r1_bio->bios[primary]->bi_status) {
2117 r1_bio->bios[primary]->bi_end_io = NULL; 2117 r1_bio->bios[primary]->bi_end_io = NULL;
2118 rdev_dec_pending(conf->mirrors[primary].rdev, mddev); 2118 rdev_dec_pending(conf->mirrors[primary].rdev, mddev);
2119 break; 2119 break;
@@ -2123,7 +2123,7 @@ static void process_checks(struct r1bio *r1_bio)
2123 int j; 2123 int j;
2124 struct bio *pbio = r1_bio->bios[primary]; 2124 struct bio *pbio = r1_bio->bios[primary];
2125 struct bio *sbio = r1_bio->bios[i]; 2125 struct bio *sbio = r1_bio->bios[i];
2126 int error = sbio->bi_error; 2126 blk_status_t status = sbio->bi_status;
2127 struct page **ppages = get_resync_pages(pbio)->pages; 2127 struct page **ppages = get_resync_pages(pbio)->pages;
2128 struct page **spages = get_resync_pages(sbio)->pages; 2128 struct page **spages = get_resync_pages(sbio)->pages;
2129 struct bio_vec *bi; 2129 struct bio_vec *bi;
@@ -2132,12 +2132,12 @@ static void process_checks(struct r1bio *r1_bio)
2132 if (sbio->bi_end_io != end_sync_read) 2132 if (sbio->bi_end_io != end_sync_read)
2133 continue; 2133 continue;
2134 /* Now we can 'fixup' the error value */ 2134 /* Now we can 'fixup' the error value */
2135 sbio->bi_error = 0; 2135 sbio->bi_status = 0;
2136 2136
2137 bio_for_each_segment_all(bi, sbio, j) 2137 bio_for_each_segment_all(bi, sbio, j)
2138 page_len[j] = bi->bv_len; 2138 page_len[j] = bi->bv_len;
2139 2139
2140 if (!error) { 2140 if (!status) {
2141 for (j = vcnt; j-- ; ) { 2141 for (j = vcnt; j-- ; ) {
2142 if (memcmp(page_address(ppages[j]), 2142 if (memcmp(page_address(ppages[j]),
2143 page_address(spages[j]), 2143 page_address(spages[j]),
@@ -2149,7 +2149,7 @@ static void process_checks(struct r1bio *r1_bio)
2149 if (j >= 0) 2149 if (j >= 0)
2150 atomic64_add(r1_bio->sectors, &mddev->resync_mismatches); 2150 atomic64_add(r1_bio->sectors, &mddev->resync_mismatches);
2151 if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery) 2151 if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)
2152 && !error)) { 2152 && !status)) {
2153 /* No need to write to this device. */ 2153 /* No need to write to this device. */
2154 sbio->bi_end_io = NULL; 2154 sbio->bi_end_io = NULL;
2155 rdev_dec_pending(conf->mirrors[i].rdev, mddev); 2155 rdev_dec_pending(conf->mirrors[i].rdev, mddev);
@@ -2400,11 +2400,11 @@ static void handle_sync_write_finished(struct r1conf *conf, struct r1bio *r1_bio
2400 struct bio *bio = r1_bio->bios[m]; 2400 struct bio *bio = r1_bio->bios[m];
2401 if (bio->bi_end_io == NULL) 2401 if (bio->bi_end_io == NULL)
2402 continue; 2402 continue;
2403 if (!bio->bi_error && 2403 if (!bio->bi_status &&
2404 test_bit(R1BIO_MadeGood, &r1_bio->state)) { 2404 test_bit(R1BIO_MadeGood, &r1_bio->state)) {
2405 rdev_clear_badblocks(rdev, r1_bio->sector, s, 0); 2405 rdev_clear_badblocks(rdev, r1_bio->sector, s, 0);
2406 } 2406 }
2407 if (bio->bi_error && 2407 if (bio->bi_status &&
2408 test_bit(R1BIO_WriteError, &r1_bio->state)) { 2408 test_bit(R1BIO_WriteError, &r1_bio->state)) {
2409 if (!rdev_set_badblocks(rdev, r1_bio->sector, s, 0)) 2409 if (!rdev_set_badblocks(rdev, r1_bio->sector, s, 0))
2410 md_error(conf->mddev, rdev); 2410 md_error(conf->mddev, rdev);