diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-23 20:08:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-23 20:08:40 -0400 |
commit | c80ddb526331a72c9e9d1480f85f6fd7c74e3d2d (patch) | |
tree | 0212803a009f171990032abb94fad84156baa153 /drivers/md/raid1.c | |
parent | 2c13bc0f8f0d3e13b42be70bf74fec8e56b58324 (diff) | |
parent | 1dff2b87a34a1ac1d1898ea109bf97ed396aca53 (diff) |
Merge tag 'md-3.5' of git://neil.brown.name/md
Pull md updates from NeilBrown:
"It's been a busy cycle for md - lots of fun stuff here.. if you like
this kind of thing :-)
Main features:
- RAID10 arrays can be reshaped - adding and removing devices and
changing chunks (not 'far' array though)
- allow RAID5 arrays to be reshaped with a backup file (not tested
yet, but the priciple works fine for RAID10).
- arrays can be reshaped while a bitmap is present - you no longer
need to remove it first
- SSSE3 support for RAID6 syndrome calculations
and of course a number of minor fixes etc."
* tag 'md-3.5' of git://neil.brown.name/md: (56 commits)
md/bitmap: record the space available for the bitmap in the superblock.
md/raid10: Remove extras after reshape to smaller number of devices.
md/raid5: improve removal of extra devices after reshape.
md: check the return of mddev_find()
MD RAID1: Further conditionalize 'fullsync'
DM RAID: Use md_error() in place of simply setting Faulty bit
DM RAID: Record and handle missing devices
DM RAID: Set recovery flags on resume
md/raid5: Allow reshape while a bitmap is present.
md/raid10: resize bitmap when required during reshape.
md: allow array to be resized while bitmap is present.
md/bitmap: make sure reshape request are reflected in superblock.
md/bitmap: add bitmap_resize function to allow bitmap resizing.
md/bitmap: use DIV_ROUND_UP instead of open-code
md/bitmap: create a 'struct bitmap_counts' substructure of 'struct bitmap'
md/bitmap: make bitmap bitops atomic.
md/bitmap: make _page_attr bitops atomic.
md/bitmap: merge bitmap_file_unmap and bitmap_file_put.
md/bitmap: remove async freeing of bitmap file.
md/bitmap: convert some spin_lock_irqsave to spin_lock_irq
...
Diffstat (limited to 'drivers/md/raid1.c')
-rw-r--r-- | drivers/md/raid1.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 15dd59b84e94..835de7168cd3 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1859,7 +1859,9 @@ static void fix_read_error(struct r1conf *conf, int read_disk, | |||
1859 | 1859 | ||
1860 | rdev = conf->mirrors[d].rdev; | 1860 | rdev = conf->mirrors[d].rdev; |
1861 | if (rdev && | 1861 | if (rdev && |
1862 | test_bit(In_sync, &rdev->flags) && | 1862 | (test_bit(In_sync, &rdev->flags) || |
1863 | (!test_bit(Faulty, &rdev->flags) && | ||
1864 | rdev->recovery_offset >= sect + s)) && | ||
1863 | is_badblock(rdev, sect, s, | 1865 | is_badblock(rdev, sect, s, |
1864 | &first_bad, &bad_sectors) == 0 && | 1866 | &first_bad, &bad_sectors) == 0 && |
1865 | sync_page_io(rdev, sect, s<<9, | 1867 | sync_page_io(rdev, sect, s<<9, |
@@ -2024,7 +2026,7 @@ static void handle_sync_write_finished(struct r1conf *conf, struct r1bio *r1_bio | |||
2024 | continue; | 2026 | continue; |
2025 | if (test_bit(BIO_UPTODATE, &bio->bi_flags) && | 2027 | if (test_bit(BIO_UPTODATE, &bio->bi_flags) && |
2026 | test_bit(R1BIO_MadeGood, &r1_bio->state)) { | 2028 | test_bit(R1BIO_MadeGood, &r1_bio->state)) { |
2027 | rdev_clear_badblocks(rdev, r1_bio->sector, s); | 2029 | rdev_clear_badblocks(rdev, r1_bio->sector, s, 0); |
2028 | } | 2030 | } |
2029 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags) && | 2031 | if (!test_bit(BIO_UPTODATE, &bio->bi_flags) && |
2030 | test_bit(R1BIO_WriteError, &r1_bio->state)) { | 2032 | test_bit(R1BIO_WriteError, &r1_bio->state)) { |
@@ -2044,7 +2046,7 @@ static void handle_write_finished(struct r1conf *conf, struct r1bio *r1_bio) | |||
2044 | struct md_rdev *rdev = conf->mirrors[m].rdev; | 2046 | struct md_rdev *rdev = conf->mirrors[m].rdev; |
2045 | rdev_clear_badblocks(rdev, | 2047 | rdev_clear_badblocks(rdev, |
2046 | r1_bio->sector, | 2048 | r1_bio->sector, |
2047 | r1_bio->sectors); | 2049 | r1_bio->sectors, 0); |
2048 | rdev_dec_pending(rdev, conf->mddev); | 2050 | rdev_dec_pending(rdev, conf->mddev); |
2049 | } else if (r1_bio->bios[m] != NULL) { | 2051 | } else if (r1_bio->bios[m] != NULL) { |
2050 | /* This drive got a write error. We need to | 2052 | /* This drive got a write error. We need to |
@@ -2598,7 +2600,8 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
2598 | if (!disk->rdev || | 2600 | if (!disk->rdev || |
2599 | !test_bit(In_sync, &disk->rdev->flags)) { | 2601 | !test_bit(In_sync, &disk->rdev->flags)) { |
2600 | disk->head_position = 0; | 2602 | disk->head_position = 0; |
2601 | if (disk->rdev) | 2603 | if (disk->rdev && |
2604 | (disk->rdev->saved_raid_disk < 0)) | ||
2602 | conf->fullsync = 1; | 2605 | conf->fullsync = 1; |
2603 | } else if (conf->last_used < 0) | 2606 | } else if (conf->last_used < 0) |
2604 | /* | 2607 | /* |
@@ -2750,9 +2753,16 @@ static int raid1_resize(struct mddev *mddev, sector_t sectors) | |||
2750 | * any io in the removed space completes, but it hardly seems | 2753 | * any io in the removed space completes, but it hardly seems |
2751 | * worth it. | 2754 | * worth it. |
2752 | */ | 2755 | */ |
2753 | md_set_array_sectors(mddev, raid1_size(mddev, sectors, 0)); | 2756 | sector_t newsize = raid1_size(mddev, sectors, 0); |
2754 | if (mddev->array_sectors > raid1_size(mddev, sectors, 0)) | 2757 | if (mddev->external_size && |
2758 | mddev->array_sectors > newsize) | ||
2755 | return -EINVAL; | 2759 | return -EINVAL; |
2760 | if (mddev->bitmap) { | ||
2761 | int ret = bitmap_resize(mddev->bitmap, newsize, 0, 0); | ||
2762 | if (ret) | ||
2763 | return ret; | ||
2764 | } | ||
2765 | md_set_array_sectors(mddev, newsize); | ||
2756 | set_capacity(mddev->gendisk, mddev->array_sectors); | 2766 | set_capacity(mddev->gendisk, mddev->array_sectors); |
2757 | revalidate_disk(mddev->gendisk); | 2767 | revalidate_disk(mddev->gendisk); |
2758 | if (sectors > mddev->dev_sectors && | 2768 | if (sectors > mddev->dev_sectors && |