aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/linear.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-03-17 21:10:40 -0400
committerDan Williams <dan.j.williams@intel.com>2009-03-30 23:57:49 -0400
commit80c3a6ce4ba4470379b9e6a4d9bcd9d2ee26ae03 (patch)
treede88622f05a7e681ac7bff7714e8f2d8953b66ac /drivers/md/linear.c
parent93ed05e2a56b5ee06c0100a169433b11c4aa5d0b (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/linear.c')
-rw-r--r--drivers/md/linear.c15
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)
101 return ret; 101 return ret;
102} 102}
103 103
104static sector_t linear_size(mddev_t *mddev, sector_t sectors, int raid_disks)
105{
106 linear_conf_t *conf = mddev_to_conf(mddev);
107
108 WARN_ONCE(sectors || raid_disks,
109 "%s does not support generic reshape\n", __func__);
110
111 return conf->array_sectors;
112}
113
104static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) 114static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
105{ 115{
106 linear_conf_t *conf; 116 linear_conf_t *conf;
@@ -253,7 +263,7 @@ static int linear_run (mddev_t *mddev)
253 if (!conf) 263 if (!conf)
254 return 1; 264 return 1;
255 mddev->private = conf; 265 mddev->private = conf;
256 mddev->array_sectors = conf->array_sectors; 266 mddev->array_sectors = linear_size(mddev, 0, 0);
257 267
258 blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); 268 blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec);
259 mddev->queue->unplug_fn = linear_unplug; 269 mddev->queue->unplug_fn = linear_unplug;
@@ -287,7 +297,7 @@ static int linear_add(mddev_t *mddev, mdk_rdev_t *rdev)
287 newconf->prev = mddev_to_conf(mddev); 297 newconf->prev = mddev_to_conf(mddev);
288 mddev->private = newconf; 298 mddev->private = newconf;
289 mddev->raid_disks++; 299 mddev->raid_disks++;
290 mddev->array_sectors = newconf->array_sectors; 300 mddev->array_sectors = linear_size(mddev, 0, 0);
291 set_capacity(mddev->gendisk, mddev->array_sectors); 301 set_capacity(mddev->gendisk, mddev->array_sectors);
292 return 0; 302 return 0;
293} 303}
@@ -385,6 +395,7 @@ static struct mdk_personality linear_personality =
385 .stop = linear_stop, 395 .stop = linear_stop,
386 .status = linear_status, 396 .status = linear_status,
387 .hot_add_disk = linear_add, 397 .hot_add_disk = linear_add,
398 .size = linear_size,
388}; 399};
389 400
390static int __init linear_init (void) 401static int __init linear_init (void)