summaryrefslogtreecommitdiffstats
path: root/drivers/md/linear.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-06-18 08:48:55 +1000
committerNeilBrown <neilb@suse.de>2009-06-18 08:48:55 +1000
commit13f2682b7216ebebd72b3d5868fe7fccec91a92d (patch)
treea5ba7509f0f6d61b2d7b478494a210794a8e55e3 /drivers/md/linear.c
parent1b57f132231593923cb4ab99943ddd777e8745bc (diff)
downloadlinux-13f2682b7216ebebd72b3d5868fe7fccec91a92d.tar.gz
linux-13f2682b7216ebebd72b3d5868fe7fccec91a92d.tar.bz2
linux-13f2682b7216ebebd72b3d5868fe7fccec91a92d.zip
md: raid0/linear: ensure device sizes are rounded to chunk size.
This is currently ensured by common code, but it is more reliable to ensure it where it is needed in personality code. All the other personalities that care already round the size to the chunk_size. raid0 and linear are the only hold-outs. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/linear.c')
-rw-r--r--drivers/md/linear.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index 9f7cec42dd8e..dda2f1b64a6d 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -135,6 +135,7 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
list_for_each_entry(rdev, &mddev->disks, same_set) {
int j = rdev->raid_disk;
dev_info_t *disk = conf->disks + j;
+ sector_t sectors;
if (j < 0 || j >= raid_disks || disk->rdev) {
printk("linear: disk numbering problem. Aborting!\n");
@@ -142,6 +143,11 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
}
disk->rdev = rdev;
+ if (mddev->chunk_sectors) {
+ sectors = rdev->sectors;
+ sector_div(sectors, mddev->chunk_sectors);
+ rdev->sectors = sectors * mddev->chunk_sectors;
+ }
blk_queue_stack_limits(mddev->queue,
rdev->bdev->bd_disk->queue);