Skip to content

Commit

Permalink
Enable setting of 'offset' and 'size' of a hot-added spare.
Browse files Browse the repository at this point in the history
offset_store and rdev_size_store allow control of the region of a
device which is to be using in an md/raid array.
They only allow these values to be set when an array is being assembled,
as changing them on an active array could be dangerous.
However when adding a spare device to an array, we might need to
set the offset and size before starting recovery.  So allow
these values to be set also if "->raid_disk < 0" which indicates that
the device is still a spare.

Signed-off-by: Neil Brown <neilb@suse.de>
  • Loading branch information
Neil Brown committed Jun 27, 2008
1 parent 1a0fd49 commit 8ed0a52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,7 @@ offset_store(mdk_rdev_t *rdev, const char *buf, size_t len)
unsigned long long offset = simple_strtoull(buf, &e, 10);
if (e==buf || (*e && *e != '\n'))
return -EINVAL;
if (rdev->mddev->pers)
if (rdev->mddev->pers && rdev->raid_disk >= 0)
return -EBUSY;
if (rdev->size && rdev->mddev->external)
/* Must set offset before size, so overlap checks
Expand Down Expand Up @@ -2023,7 +2023,7 @@ rdev_size_store(mdk_rdev_t *rdev, const char *buf, size_t len)

if (e==buf || (*e && *e != '\n'))
return -EINVAL;
if (my_mddev->pers)
if (my_mddev->pers && rdev->raid_disk >= 0)
return -EBUSY;
rdev->size = size;
if (size > oldsize && rdev->mddev->external) {
Expand Down

0 comments on commit 8ed0a52

Please sign in to comment.