diff options
-rw-r--r-- | drivers/md/raid0.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 62fde23bf281..39936a217f95 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -234,6 +234,16 @@ static int create_strip_zones(mddev_t *mddev) | |||
234 | mddev->queue->backing_dev_info.congested_fn = raid0_congested; | 234 | mddev->queue->backing_dev_info.congested_fn = raid0_congested; |
235 | mddev->queue->backing_dev_info.congested_data = mddev; | 235 | mddev->queue->backing_dev_info.congested_data = mddev; |
236 | 236 | ||
237 | /* | ||
238 | * now since we have the hard sector sizes, we can make sure | ||
239 | * chunk size is a multiple of that sector size | ||
240 | */ | ||
241 | if (mddev->chunk_size % queue_logical_block_size(mddev->queue)) { | ||
242 | printk(KERN_ERR "%s chunk_size of %d not valid\n", | ||
243 | mdname(mddev), | ||
244 | mddev->chunk_size); | ||
245 | goto abort; | ||
246 | } | ||
237 | printk(KERN_INFO "raid0: done.\n"); | 247 | printk(KERN_INFO "raid0: done.\n"); |
238 | mddev->private = conf; | 248 | mddev->private = conf; |
239 | return 0; | 249 | return 0; |
@@ -289,8 +299,9 @@ static int raid0_run(mddev_t *mddev) | |||
289 | { | 299 | { |
290 | int ret; | 300 | int ret; |
291 | 301 | ||
292 | if (mddev->chunk_size == 0) { | 302 | if (mddev->chunk_size == 0 || |
293 | printk(KERN_ERR "md/raid0: non-zero chunk size required.\n"); | 303 | !is_power_of_2(mddev->chunk_size)) { |
304 | printk(KERN_ERR "md/raid0: chunk size must be a power of 2.\n"); | ||
294 | return -EINVAL; | 305 | return -EINVAL; |
295 | } | 306 | } |
296 | blk_queue_max_sectors(mddev->queue, mddev->chunk_size >> 9); | 307 | blk_queue_max_sectors(mddev->queue, mddev->chunk_size >> 9); |