aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-06-17 18:48:55 -0400
committerNeilBrown <neilb@suse.de>2009-06-17 18:48:55 -0400
commit13f2682b7216ebebd72b3d5868fe7fccec91a92d (patch)
treea5ba7509f0f6d61b2d7b478494a210794a8e55e3 /drivers
parent1b57f132231593923cb4ab99943ddd777e8745bc (diff)
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')
-rw-r--r--drivers/md/linear.c6
-rw-r--r--drivers/md/raid0.c6
2 files changed, 12 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)
135 list_for_each_entry(rdev, &mddev->disks, same_set) { 135 list_for_each_entry(rdev, &mddev->disks, same_set) {
136 int j = rdev->raid_disk; 136 int j = rdev->raid_disk;
137 dev_info_t *disk = conf->disks + j; 137 dev_info_t *disk = conf->disks + j;
138 sector_t sectors;
138 139
139 if (j < 0 || j >= raid_disks || disk->rdev) { 140 if (j < 0 || j >= raid_disks || disk->rdev) {
140 printk("linear: disk numbering problem. Aborting!\n"); 141 printk("linear: disk numbering problem. Aborting!\n");
@@ -142,6 +143,11 @@ static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
142 } 143 }
143 144
144 disk->rdev = rdev; 145 disk->rdev = rdev;
146 if (mddev->chunk_sectors) {
147 sectors = rdev->sectors;
148 sector_div(sectors, mddev->chunk_sectors);
149 rdev->sectors = sectors * mddev->chunk_sectors;
150 }
145 151
146 blk_queue_stack_limits(mddev->queue, 152 blk_queue_stack_limits(mddev->queue,
147 rdev->bdev->bd_disk->queue); 153 rdev->bdev->bd_disk->queue);
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 11e384253718..717e64a4af9a 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -100,6 +100,12 @@ static int create_strip_zones(mddev_t *mddev)
100 printk(KERN_INFO "raid0: looking at %s\n", 100 printk(KERN_INFO "raid0: looking at %s\n",
101 bdevname(rdev1->bdev,b)); 101 bdevname(rdev1->bdev,b));
102 c = 0; 102 c = 0;
103
104 /* round size to chunk_size */
105 sectors = rdev1->sectors;
106 sector_div(sectors, mddev->chunk_sectors);
107 rdev1->sectors = sectors * mddev->chunk_sectors;
108
103 list_for_each_entry(rdev2, &mddev->disks, same_set) { 109 list_for_each_entry(rdev2, &mddev->disks, same_set) {
104 printk(KERN_INFO "raid0: comparing %s(%llu)", 110 printk(KERN_INFO "raid0: comparing %s(%llu)",
105 bdevname(rdev1->bdev,b), 111 bdevname(rdev1->bdev,b),