diff options
author | Dan Williams <dan.j.williams@intel.com> | 2009-03-18 02:10:40 +0100 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-03-31 05:57:49 +0200 |
commit | 80c3a6ce4ba4470379b9e6a4d9bcd9d2ee26ae03 (patch) | |
tree | de88622f05a7e681ac7bff7714e8f2d8953b66ac /drivers/md/linear.c | |
parent | md: fix typo in FSF address (diff) | |
download | linux-80c3a6ce4ba4470379b9e6a4d9bcd9d2ee26ae03.tar.xz linux-80c3a6ce4ba4470379b9e6a4d9bcd9d2ee26ae03.zip |
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/linear.c')
-rw-r--r-- | drivers/md/linear.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index d5d99290041a..b6bb976123da 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c @@ -101,6 +101,16 @@ static int linear_congested(void *data, int bits) return ret; } +static sector_t linear_size(mddev_t *mddev, sector_t sectors, int raid_disks) +{ + linear_conf_t *conf = mddev_to_conf(mddev); + + WARN_ONCE(sectors || raid_disks, + "%s does not support generic reshape\n", __func__); + + return conf->array_sectors; +} + static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) { linear_conf_t *conf; @@ -253,7 +263,7 @@ static int linear_run (mddev_t *mddev) if (!conf) return 1; mddev->private = conf; - mddev->array_sectors = conf->array_sectors; + mddev->array_sectors = linear_size(mddev, 0, 0); blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); mddev->queue->unplug_fn = linear_unplug; @@ -287,7 +297,7 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev) newconf->prev = mddev_to_conf(mddev); mddev->private = newconf; mddev->raid_disks++; - mddev->array_sectors = newconf->array_sectors; + mddev->array_sectors = linear_size(mddev, 0, 0); set_capacity(mddev->gendisk, mddev->array_sectors); return 0; } @@ -385,6 +395,7 @@ static struct mdk_personality linear_personality = .stop = linear_stop, .status = linear_status, .hot_add_disk = linear_add, + .size = linear_size, }; static int __init linear_init (void) |