diff options
author | Jonathan Brassow <jbrassow@redhat.com> | 2011-01-13 17:14:33 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-01-13 17:14:33 -0500 |
commit | ccebd4c4159462c96397ae9af9c667bb394d7b70 (patch) | |
tree | 04554f0e7607d906c6b09f31a995fca0dd40c5b5 /drivers | |
parent | 57b2caa394393f8870ed41bdcc38a7542593018f (diff) |
md-new-param-to_sync_page_io
Add new parameter to 'sync_page_io'.
The new parameter allows us to distinguish between metadata and data
operations. This becomes important later when we add the ability to
use separate devices for data and metadata.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/bitmap.c | 4 | ||||
-rw-r--r-- | drivers/md/md.c | 9 | ||||
-rw-r--r-- | drivers/md/md.h | 4 | ||||
-rw-r--r-- | drivers/md/raid1.c | 28 | ||||
-rw-r--r-- | drivers/md/raid10.c | 12 |
5 files changed, 28 insertions, 29 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 5a1ffe3527aa..1977765ff964 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -210,11 +210,11 @@ static struct page *read_sb_page(mddev_t *mddev, loff_t offset, | |||
210 | || test_bit(Faulty, &rdev->flags)) | 210 | || test_bit(Faulty, &rdev->flags)) |
211 | continue; | 211 | continue; |
212 | 212 | ||
213 | target = rdev->sb_start + offset + index * (PAGE_SIZE/512); | 213 | target = offset + index * (PAGE_SIZE/512); |
214 | 214 | ||
215 | if (sync_page_io(rdev, target, | 215 | if (sync_page_io(rdev, target, |
216 | roundup(size, bdev_logical_block_size(rdev->bdev)), | 216 | roundup(size, bdev_logical_block_size(rdev->bdev)), |
217 | page, READ)) { | 217 | page, READ, true)) { |
218 | page->index = index; | 218 | page->index = index; |
219 | attach_page_buffers(page, NULL); /* so that free_buffer will | 219 | attach_page_buffers(page, NULL); /* so that free_buffer will |
220 | * quietly no-op */ | 220 | * quietly no-op */ |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 0a0d7c2f2ff6..0bc10cc4b961 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -795,7 +795,7 @@ static void bi_complete(struct bio *bio, int error) | |||
795 | } | 795 | } |
796 | 796 | ||
797 | int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size, | 797 | int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size, |
798 | struct page *page, int rw) | 798 | struct page *page, int rw, bool metadata_op) |
799 | { | 799 | { |
800 | struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev); | 800 | struct bio *bio = bio_alloc_mddev(GFP_NOIO, 1, rdev->mddev); |
801 | struct completion event; | 801 | struct completion event; |
@@ -804,7 +804,10 @@ int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size, | |||
804 | rw |= REQ_SYNC | REQ_UNPLUG; | 804 | rw |= REQ_SYNC | REQ_UNPLUG; |
805 | 805 | ||
806 | bio->bi_bdev = rdev->bdev; | 806 | bio->bi_bdev = rdev->bdev; |
807 | bio->bi_sector = sector; | 807 | if (metadata_op) |
808 | bio->bi_sector = sector + rdev->sb_start; | ||
809 | else | ||
810 | bio->bi_sector = sector + rdev->data_offset; | ||
808 | bio_add_page(bio, page, size, 0); | 811 | bio_add_page(bio, page, size, 0); |
809 | init_completion(&event); | 812 | init_completion(&event); |
810 | bio->bi_private = &event; | 813 | bio->bi_private = &event; |
@@ -829,7 +832,7 @@ static int read_disk_sb(mdk_rdev_t * rdev, int size) | |||
829 | return 0; | 832 | return 0; |
830 | 833 | ||
831 | 834 | ||
832 | if (!sync_page_io(rdev, rdev->sb_start, size, rdev->sb_page, READ)) | 835 | if (!sync_page_io(rdev, 0, size, rdev->sb_page, READ, true)) |
833 | goto fail; | 836 | goto fail; |
834 | rdev->sb_loaded = 1; | 837 | rdev->sb_loaded = 1; |
835 | return 0; | 838 | return 0; |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 229675a604f7..7e4f358a26a6 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -498,8 +498,8 @@ extern void md_flush_request(mddev_t *mddev, struct bio *bio); | |||
498 | extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, | 498 | extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, |
499 | sector_t sector, int size, struct page *page); | 499 | sector_t sector, int size, struct page *page); |
500 | extern void md_super_wait(mddev_t *mddev); | 500 | extern void md_super_wait(mddev_t *mddev); |
501 | extern int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size, | 501 | extern int sync_page_io(mdk_rdev_t *rdev, sector_t sector, int size, |
502 | struct page *page, int rw); | 502 | struct page *page, int rw, bool metadata_op); |
503 | extern void md_do_sync(mddev_t *mddev); | 503 | extern void md_do_sync(mddev_t *mddev); |
504 | extern void md_new_event(mddev_t *mddev); | 504 | extern void md_new_event(mddev_t *mddev); |
505 | extern int md_allow_write(mddev_t *mddev); | 505 | extern int md_allow_write(mddev_t *mddev); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d50056ba596b..a23ffa397ba9 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1365,10 +1365,10 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
1365 | */ | 1365 | */ |
1366 | rdev = conf->mirrors[d].rdev; | 1366 | rdev = conf->mirrors[d].rdev; |
1367 | if (sync_page_io(rdev, | 1367 | if (sync_page_io(rdev, |
1368 | sect + rdev->data_offset, | 1368 | sect, |
1369 | s<<9, | 1369 | s<<9, |
1370 | bio->bi_io_vec[idx].bv_page, | 1370 | bio->bi_io_vec[idx].bv_page, |
1371 | READ)) { | 1371 | READ, false)) { |
1372 | success = 1; | 1372 | success = 1; |
1373 | break; | 1373 | break; |
1374 | } | 1374 | } |
@@ -1391,10 +1391,10 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
1391 | rdev = conf->mirrors[d].rdev; | 1391 | rdev = conf->mirrors[d].rdev; |
1392 | atomic_add(s, &rdev->corrected_errors); | 1392 | atomic_add(s, &rdev->corrected_errors); |
1393 | if (sync_page_io(rdev, | 1393 | if (sync_page_io(rdev, |
1394 | sect + rdev->data_offset, | 1394 | sect, |
1395 | s<<9, | 1395 | s<<9, |
1396 | bio->bi_io_vec[idx].bv_page, | 1396 | bio->bi_io_vec[idx].bv_page, |
1397 | WRITE) == 0) | 1397 | WRITE, false) == 0) |
1398 | md_error(mddev, rdev); | 1398 | md_error(mddev, rdev); |
1399 | } | 1399 | } |
1400 | d = start; | 1400 | d = start; |
@@ -1406,10 +1406,10 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
1406 | continue; | 1406 | continue; |
1407 | rdev = conf->mirrors[d].rdev; | 1407 | rdev = conf->mirrors[d].rdev; |
1408 | if (sync_page_io(rdev, | 1408 | if (sync_page_io(rdev, |
1409 | sect + rdev->data_offset, | 1409 | sect, |
1410 | s<<9, | 1410 | s<<9, |
1411 | bio->bi_io_vec[idx].bv_page, | 1411 | bio->bi_io_vec[idx].bv_page, |
1412 | READ) == 0) | 1412 | READ, false) == 0) |
1413 | md_error(mddev, rdev); | 1413 | md_error(mddev, rdev); |
1414 | } | 1414 | } |
1415 | } else { | 1415 | } else { |
@@ -1489,10 +1489,8 @@ static void fix_read_error(conf_t *conf, int read_disk, | |||
1489 | rdev = conf->mirrors[d].rdev; | 1489 | rdev = conf->mirrors[d].rdev; |
1490 | if (rdev && | 1490 | if (rdev && |
1491 | test_bit(In_sync, &rdev->flags) && | 1491 | test_bit(In_sync, &rdev->flags) && |
1492 | sync_page_io(rdev, | 1492 | sync_page_io(rdev, sect, s<<9, |
1493 | sect + rdev->data_offset, | 1493 | conf->tmppage, READ, false)) |
1494 | s<<9, | ||
1495 | conf->tmppage, READ)) | ||
1496 | success = 1; | 1494 | success = 1; |
1497 | else { | 1495 | else { |
1498 | d++; | 1496 | d++; |
@@ -1515,9 +1513,8 @@ static void fix_read_error(conf_t *conf, int read_disk, | |||
1515 | rdev = conf->mirrors[d].rdev; | 1513 | rdev = conf->mirrors[d].rdev; |
1516 | if (rdev && | 1514 | if (rdev && |
1517 | test_bit(In_sync, &rdev->flags)) { | 1515 | test_bit(In_sync, &rdev->flags)) { |
1518 | if (sync_page_io(rdev, | 1516 | if (sync_page_io(rdev, sect, s<<9, |
1519 | sect + rdev->data_offset, | 1517 | conf->tmppage, WRITE, false) |
1520 | s<<9, conf->tmppage, WRITE) | ||
1521 | == 0) | 1518 | == 0) |
1522 | /* Well, this device is dead */ | 1519 | /* Well, this device is dead */ |
1523 | md_error(mddev, rdev); | 1520 | md_error(mddev, rdev); |
@@ -1532,9 +1529,8 @@ static void fix_read_error(conf_t *conf, int read_disk, | |||
1532 | rdev = conf->mirrors[d].rdev; | 1529 | rdev = conf->mirrors[d].rdev; |
1533 | if (rdev && | 1530 | if (rdev && |
1534 | test_bit(In_sync, &rdev->flags)) { | 1531 | test_bit(In_sync, &rdev->flags)) { |
1535 | if (sync_page_io(rdev, | 1532 | if (sync_page_io(rdev, sect, s<<9, |
1536 | sect + rdev->data_offset, | 1533 | conf->tmppage, READ, false) |
1537 | s<<9, conf->tmppage, READ) | ||
1538 | == 0) | 1534 | == 0) |
1539 | /* Well, this device is dead */ | 1535 | /* Well, this device is dead */ |
1540 | md_error(mddev, rdev); | 1536 | md_error(mddev, rdev); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 03825cbce2d4..69b659544390 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1560,9 +1560,9 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio) | |||
1560 | rcu_read_unlock(); | 1560 | rcu_read_unlock(); |
1561 | success = sync_page_io(rdev, | 1561 | success = sync_page_io(rdev, |
1562 | r10_bio->devs[sl].addr + | 1562 | r10_bio->devs[sl].addr + |
1563 | sect + rdev->data_offset, | 1563 | sect, |
1564 | s<<9, | 1564 | s<<9, |
1565 | conf->tmppage, READ); | 1565 | conf->tmppage, READ, false); |
1566 | rdev_dec_pending(rdev, mddev); | 1566 | rdev_dec_pending(rdev, mddev); |
1567 | rcu_read_lock(); | 1567 | rcu_read_lock(); |
1568 | if (success) | 1568 | if (success) |
@@ -1599,8 +1599,8 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio) | |||
1599 | atomic_add(s, &rdev->corrected_errors); | 1599 | atomic_add(s, &rdev->corrected_errors); |
1600 | if (sync_page_io(rdev, | 1600 | if (sync_page_io(rdev, |
1601 | r10_bio->devs[sl].addr + | 1601 | r10_bio->devs[sl].addr + |
1602 | sect + rdev->data_offset, | 1602 | sect, |
1603 | s<<9, conf->tmppage, WRITE) | 1603 | s<<9, conf->tmppage, WRITE, false) |
1604 | == 0) { | 1604 | == 0) { |
1605 | /* Well, this device is dead */ | 1605 | /* Well, this device is dead */ |
1606 | printk(KERN_NOTICE | 1606 | printk(KERN_NOTICE |
@@ -1636,9 +1636,9 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio) | |||
1636 | rcu_read_unlock(); | 1636 | rcu_read_unlock(); |
1637 | if (sync_page_io(rdev, | 1637 | if (sync_page_io(rdev, |
1638 | r10_bio->devs[sl].addr + | 1638 | r10_bio->devs[sl].addr + |
1639 | sect + rdev->data_offset, | 1639 | sect, |
1640 | s<<9, conf->tmppage, | 1640 | s<<9, conf->tmppage, |
1641 | READ) == 0) { | 1641 | READ, false) == 0) { |
1642 | /* Well, this device is dead */ | 1642 | /* Well, this device is dead */ |
1643 | printk(KERN_NOTICE | 1643 | printk(KERN_NOTICE |
1644 | "md/raid10:%s: unable to read back " | 1644 | "md/raid10:%s: unable to read back " |