aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/linear.c
diff options
context:
space:
mode:
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)