mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
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>
This commit is contained in:
parent
5e8651060c
commit
0261cd9f1c
@ -944,6 +944,14 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev)
|
|||||||
desc->raid_disk < mddev->raid_disks */) {
|
desc->raid_disk < mddev->raid_disks */) {
|
||||||
set_bit(In_sync, &rdev->flags);
|
set_bit(In_sync, &rdev->flags);
|
||||||
rdev->raid_disk = desc->raid_disk;
|
rdev->raid_disk = desc->raid_disk;
|
||||||
|
} else if (desc->state & (1<<MD_DISK_ACTIVE)) {
|
||||||
|
/* active but not in sync implies recovery up to
|
||||||
|
* reshape position. We don't know exactly where
|
||||||
|
* that is, so set to zero for now */
|
||||||
|
if (mddev->minor_version >= 91) {
|
||||||
|
rdev->recovery_offset = 0;
|
||||||
|
rdev->raid_disk = desc->raid_disk;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (desc->state & (1<<MD_DISK_WRITEMOSTLY))
|
if (desc->state & (1<<MD_DISK_WRITEMOSTLY))
|
||||||
set_bit(WriteMostly, &rdev->flags);
|
set_bit(WriteMostly, &rdev->flags);
|
||||||
@ -1032,8 +1040,19 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
|
|||||||
list_for_each_entry(rdev2, &mddev->disks, same_set) {
|
list_for_each_entry(rdev2, &mddev->disks, same_set) {
|
||||||
mdp_disk_t *d;
|
mdp_disk_t *d;
|
||||||
int desc_nr;
|
int desc_nr;
|
||||||
if (rdev2->raid_disk >= 0 && test_bit(In_sync, &rdev2->flags)
|
int is_active = test_bit(In_sync, &rdev2->flags);
|
||||||
&& !test_bit(Faulty, &rdev2->flags))
|
|
||||||
|
if (rdev2->raid_disk >= 0 &&
|
||||||
|
sb->minor_version >= 91)
|
||||||
|
/* we have nowhere to store the recovery_offset,
|
||||||
|
* but if it is not below the reshape_position,
|
||||||
|
* we can piggy-back on that.
|
||||||
|
*/
|
||||||
|
is_active = 1;
|
||||||
|
if (rdev2->raid_disk < 0 ||
|
||||||
|
test_bit(Faulty, &rdev2->flags))
|
||||||
|
is_active = 0;
|
||||||
|
if (is_active)
|
||||||
desc_nr = rdev2->raid_disk;
|
desc_nr = rdev2->raid_disk;
|
||||||
else
|
else
|
||||||
desc_nr = next_spare++;
|
desc_nr = next_spare++;
|
||||||
@ -1043,16 +1062,16 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev)
|
|||||||
d->number = rdev2->desc_nr;
|
d->number = rdev2->desc_nr;
|
||||||
d->major = MAJOR(rdev2->bdev->bd_dev);
|
d->major = MAJOR(rdev2->bdev->bd_dev);
|
||||||
d->minor = MINOR(rdev2->bdev->bd_dev);
|
d->minor = MINOR(rdev2->bdev->bd_dev);
|
||||||
if (rdev2->raid_disk >= 0 && test_bit(In_sync, &rdev2->flags)
|
if (is_active)
|
||||||
&& !test_bit(Faulty, &rdev2->flags))
|
|
||||||
d->raid_disk = rdev2->raid_disk;
|
d->raid_disk = rdev2->raid_disk;
|
||||||
else
|
else
|
||||||
d->raid_disk = rdev2->desc_nr; /* compatibility */
|
d->raid_disk = rdev2->desc_nr; /* compatibility */
|
||||||
if (test_bit(Faulty, &rdev2->flags))
|
if (test_bit(Faulty, &rdev2->flags))
|
||||||
d->state = (1<<MD_DISK_FAULTY);
|
d->state = (1<<MD_DISK_FAULTY);
|
||||||
else if (test_bit(In_sync, &rdev2->flags)) {
|
else if (is_active) {
|
||||||
d->state = (1<<MD_DISK_ACTIVE);
|
d->state = (1<<MD_DISK_ACTIVE);
|
||||||
d->state |= (1<<MD_DISK_SYNC);
|
if (test_bit(In_sync, &rdev2->flags))
|
||||||
|
d->state |= (1<<MD_DISK_SYNC);
|
||||||
active++;
|
active++;
|
||||||
working++;
|
working++;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user