diff options
author | raz ben yehuda <raziebe@gmail.com> | 2009-06-16 03:00:57 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-06-16 03:00:57 -0400 |
commit | 92e59b6ba21845fadd2cce725010a9351740b76e (patch) | |
tree | 01ae5dcf151a8e9e3f578acfac976f59638474ee | |
parent | 46994191ae8fdf1cbcc1f29282576b269a638c69 (diff) |
md: raid0: chunk size check in raid0_run
have raid0 check chunk size in run method instead of in md.
This is part of a series moving the checks from common code to
the personalities where they belong.
hardsect is short and chunksize is an int, so it is safe to use %.
Signed-off-by: raziebe@gmail.com
Signed-off-by: NeilBrown <neilb@suse.de>
-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); |