diff options
author | NeilBrown <neilb@suse.de> | 2009-11-13 01:40:48 -0500 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-11-13 01:40:48 -0500 |
commit | 0261cd9f1cb42fa44ece314d27868d83742bdf03 (patch) | |
tree | 95954fb2e1a10ee1b20198b8fbefd7a8392dc896 /drivers/md/md.c | |
parent | 5e8651060cea6b44844521ddcac665e2c021f5d8 (diff) |
md: allow v0.91 metadata to record devices as being active but not in-sync.
This is a combination that didn't really make sense before.
However when a reshape is converting e.g. raid5 -> raid6, the extra
device is not fully in-sync, but is certainly active and contains
important data.
So allow that start to be meaningful and in particular get
the 'recovery_offset' value (which is needed for any non-in-sync
active device) from the reshape_position.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 01b9a0fd16e0..b182f86a19dd 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -944,6 +944,14 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev) | |||
944 | desc->raid_disk < mddev->raid_disks */) { | 944 | desc->raid_disk < mddev->raid_disks */) { |
945 | set_bit(In_sync, &rdev->flags); | 945 | set_bit(In_sync, &rdev->flags); |
946 | rdev->raid_disk = desc->raid_disk; | 946 | rdev->raid_disk = desc->raid_disk; |
947 | } else if (desc->state & (1<<MD_DISK_ACTIVE)) { | ||
948 | /* active but not in sync implies recovery up to | ||
949 | * reshape position. We don't know exactly where | ||
950 | * that is, so set to zero for now */ | ||
951 | if (mddev->minor_version >= 91) { | ||
952 | rdev->recovery_offset = 0; | ||
953 | rdev->raid_disk = desc->raid_disk; | ||
954 | } | ||
947 | } | 955 | } |
948 | if (desc->state & (1<<MD_DISK_WRITEMOSTLY)) | 956 | if (desc->state & (1<<MD_DISK_WRITEMOSTLY)) |
949 | set_bit(WriteMostly, &rdev->flags); | 957 | set_bit(WriteMostly, &rdev->flags); |
@@ -1032,8 +1040,19 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1032 | list_for_each_entry(rdev2, &mddev->disks, same_set) { | 1040 | list_for_each_entry(rdev2, &mddev->disks, same_set) { |
1033 | mdp_disk_t *d; | 1041 | mdp_disk_t *d; |
1034 | int desc_nr; | 1042 | int desc_nr; |
1035 | if (rdev2->raid_disk >= 0 && test_bit(In_sync, &rdev2->flags) | 1043 | int is_active = test_bit(In_sync, &rdev2->flags); |
1036 | && !test_bit(Faulty, &rdev2->flags)) | 1044 | |
1045 | if (rdev2->raid_disk >= 0 && | ||
1046 | sb->minor_version >= 91) | ||
1047 | /* we have nowhere to store the recovery_offset, | ||
1048 | * but if it is not below the reshape_position, | ||
1049 | * we can piggy-back on that. | ||
1050 | */ | ||
1051 | is_active = 1; | ||
1052 | if (rdev2->raid_disk < 0 || | ||
1053 | test_bit(Faulty, &rdev2->flags)) | ||
1054 | is_active = 0; | ||
1055 | if (is_active) | ||
1037 | desc_nr = rdev2->raid_disk; | 1056 | desc_nr = rdev2->raid_disk; |
1038 | else | 1057 | else |
1039 | desc_nr = next_spare++; | 1058 | desc_nr = next_spare++; |
@@ -1043,16 +1062,16 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1043 | d->number = rdev2->desc_nr; | 1062 | d->number = rdev2->desc_nr; |
1044 | d->major = MAJOR(rdev2->bdev->bd_dev); | 1063 | d->major = MAJOR(rdev2->bdev->bd_dev); |
1045 | d->minor = MINOR(rdev2->bdev->bd_dev); | 1064 | d->minor = MINOR(rdev2->bdev->bd_dev); |
1046 | if (rdev2->raid_disk >= 0 && test_bit(In_sync, &rdev2->flags) | 1065 | if (is_active) |
1047 | && !test_bit(Faulty, &rdev2->flags)) | ||
1048 | d->raid_disk = rdev2->raid_disk; | 1066 | d->raid_disk = rdev2->raid_disk; |
1049 | else | 1067 | else |
1050 | d->raid_disk = rdev2->desc_nr; /* compatibility */ | 1068 | d->raid_disk = rdev2->desc_nr; /* compatibility */ |
1051 | if (test_bit(Faulty, &rdev2->flags)) | 1069 | if (test_bit(Faulty, &rdev2->flags)) |
1052 | d->state = (1<<MD_DISK_FAULTY); | 1070 | d->state = (1<<MD_DISK_FAULTY); |
1053 | else if (test_bit(In_sync, &rdev2->flags)) { | 1071 | else if (is_active) { |
1054 | d->state = (1<<MD_DISK_ACTIVE); | 1072 | d->state = (1<<MD_DISK_ACTIVE); |
1055 | d->state |= (1<<MD_DISK_SYNC); | 1073 | if (test_bit(In_sync, &rdev2->flags)) |
1074 | d->state |= (1<<MD_DISK_SYNC); | ||
1056 | active++; | 1075 | active++; |
1057 | working++; | 1076 | working++; |
1058 | } else { | 1077 | } else { |