diff options
author | NeilBrown <neilb@suse.de> | 2010-05-18 02:17:09 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-05-18 07:28:01 +0200 |
commit | be6800a73aa2f3dc14744c3b80e676d189789f04 (patch) | |
tree | 7db76b4488ad45e923223748c41fa8a61a09aa25 | |
parent | md: simplify updating of event count to sometimes avoid updating spares. (diff) | |
download | linux-be6800a73aa2f3dc14744c3b80e676d189789f04.tar.xz linux-be6800a73aa2f3dc14744c3b80e676d189789f04.zip |
md: don't insist on valid event count for spare devices.
Devices which know that they are spares do not really need to have
an event count that matches the rest of the array, so there are no
data-in-sync issues. It is enough that the uuid matches.
So remove the requirement that the event count is up-to-date.
We currently still write out and event count on spares, but this
allows us in a year or 3 to stop doing that completely.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | drivers/md/md.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 9ef21d9b8e27..26b3d2879d93 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1070,10 +1070,13 @@ static int super_90_validate(mddev_t *mddev, mdk_rdev_t *rdev) mddev->bitmap_info.default_offset; } else if (mddev->pers == NULL) { - /* Insist on good event counter while assembling */ + /* Insist on good event counter while assembling, except + * for spares (which don't need an event count) */ ++ev1; - if (ev1 < mddev->events) - return -EINVAL; + if (sb->disks[rdev->desc_nr].state & ( + (1<<MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE))) + if (ev1 < mddev->events) + return -EINVAL; } else if (mddev->bitmap) { /* if adding to array with a bitmap, then we can accept an * older device ... but not too old. @@ -1469,10 +1472,14 @@ static int super_1_validate(mddev_t *mddev, mdk_rdev_t *rdev) } } else if (mddev->pers == NULL) { - /* Insist of good event counter while assembling */ + /* Insist of good event counter while assembling, except for + * spares (which don't need an event count) */ ++ev1; - if (ev1 < mddev->events) - return -EINVAL; + if (rdev->desc_nr >= 0 && + rdev->desc_nr < le32_to_cpu(sb->max_dev) && + le16_to_cpu(sb->dev_roles[rdev->desc_nr]) < 0xfffe) + if (ev1 < mddev->events) + return -EINVAL; } else if (mddev->bitmap) { /* If adding to array with a bitmap, then we can accept an * older device, but not too old. |