diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-03-18 04:10:40 +0300 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-03-31 07:57:49 +0400 |
commit | 80c3a6ce4ba4470379b9e6a4d9bcd9d2ee26ae03 (patch) | |
tree | de88622f05a7e681ac7bff7714e8f2d8953b66ac /drivers/md/faulty.c | |
parent | 93ed05e2a56b5ee06c0100a169433b11c4aa5d0b (diff) | |
download | linux-80c3a6ce4ba4470379b9e6a4d9bcd9d2ee26ae03.tar.xz |
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) return 0; } +static sector_t faulty_size(mddev_t *mddev, sector_t sectors, int raid_disks) +{ + WARN_ONCE(raid_disks, + "%s does not support generic reshape\n", __func__); + + if (sectors == 0) + return mddev->dev_sectors; + + return sectors; +} + static int run(mddev_t *mddev) { mdk_rdev_t *rdev; @@ -301,7 +312,7 @@ static int run(mddev_t *mddev) list_for_each_entry(rdev, &mddev->disks, same_set) conf->rdev = rdev; - mddev->array_sectors = mddev->dev_sectors; + mddev->array_sectors = faulty_size(mddev, 0, 0); mddev->private = conf; reconfig(mddev, mddev->layout, -1); @@ -328,6 +339,7 @@ static struct mdk_personality faulty_personality = .stop = stop, .status = status, .reconfig = reconfig, + .size = faulty_size, }; static int __init raid_init(void) |