diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-03-17 21:10:40 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-03-30 23:57:49 -0400 |
commit | 80c3a6ce4ba4470379b9e6a4d9bcd9d2ee26ae03 (patch) | |
tree | de88622f05a7e681ac7bff7714e8f2d8953b66ac /drivers/md/faulty.c | |
parent | 93ed05e2a56b5ee06c0100a169433b11c4aa5d0b (diff) |
md: add 'size' as a personality method
In preparation for giving userspace control over ->array_sectors we need
to be able to retrieve the 'default' size, and the 'anticipated' size
when a reshape is requested. For personalities that do not reshape emit
a warning if anything but the default size is requested.
In the raid5 case we need to update ->previous_raid_disks to make the
new 'default' size available.
Reviewed-by: Andre Noll <maan@systemlinux.org>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/md/faulty.c')
-rw-r--r-- | drivers/md/faulty.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index 18793c137278..d76c87f2a831 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c | |||
@@ -283,6 +283,17 @@ static int reconfig(mddev_t *mddev, int layout, int chunk_size) | |||
283 | return 0; | 283 | return 0; |
284 | } | 284 | } |
285 | 285 | ||
286 | static sector_t faulty_size(mddev_t *mddev, sector_t sectors, int raid_disks) | ||
287 | { | ||
288 | WARN_ONCE(raid_disks, | ||
289 | "%s does not support generic reshape\n", __func__); | ||
290 | |||
291 | if (sectors == 0) | ||
292 | return mddev->dev_sectors; | ||
293 | |||
294 | return sectors; | ||
295 | } | ||
296 | |||
286 | static int run(mddev_t *mddev) | 297 | static int run(mddev_t *mddev) |
287 | { | 298 | { |
288 | mdk_rdev_t *rdev; | 299 | mdk_rdev_t *rdev; |
@@ -301,7 +312,7 @@ static int run(mddev_t *mddev) | |||
301 | list_for_each_entry(rdev, &mddev->disks, same_set) | 312 | list_for_each_entry(rdev, &mddev->disks, same_set) |
302 | conf->rdev = rdev; | 313 | conf->rdev = rdev; |
303 | 314 | ||
304 | mddev->array_sectors = mddev->dev_sectors; | 315 | mddev->array_sectors = faulty_size(mddev, 0, 0); |
305 | mddev->private = conf; | 316 | mddev->private = conf; |
306 | 317 | ||
307 | reconfig(mddev, mddev->layout, -1); | 318 | reconfig(mddev, mddev->layout, -1); |
@@ -328,6 +339,7 @@ static struct mdk_personality faulty_personality = | |||
328 | .stop = stop, | 339 | .stop = stop, |
329 | .status = status, | 340 | .status = status, |
330 | .reconfig = reconfig, | 341 | .reconfig = reconfig, |
342 | .size = faulty_size, | ||
331 | }; | 343 | }; |
332 | 344 | ||
333 | static int __init raid_init(void) | 345 | static int __init raid_init(void) |