diff options
author | raz ben yehuda <raziebe@gmail.com> | 2009-06-16 17:00:57 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-06-16 17:00:57 +1000 |
commit | 92e59b6ba21845fadd2cce725010a9351740b76e (patch) | |
tree | 01ae5dcf151a8e9e3f578acfac976f59638474ee /drivers/md | |
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>
Diffstat (limited to 'drivers/md')
-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 62fde23bf28..39936a217f9 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -234,6 +234,16 @@ static int create_strip_zones(mddev_t *mddev) mddev->queue->backing_dev_info.congested_fn = raid0_congested; mddev->queue->backing_dev_info.congested_data = mddev; + /* + * now since we have the hard sector sizes, we can make sure + * chunk size is a multiple of that sector size + */ + if (mddev->chunk_size % queue_logical_block_size(mddev->queue)) { + printk(KERN_ERR "%s chunk_size of %d not valid\n", + mdname(mddev), + mddev->chunk_size); + goto abort; + } printk(KERN_INFO "raid0: done.\n"); mddev->private = conf; return 0; @@ -289,8 +299,9 @@ static int raid0_run(mddev_t *mddev) { int ret; - if (mddev->chunk_size == 0) { - printk(KERN_ERR "md/raid0: non-zero chunk size required.\n"); + if (mddev->chunk_size == 0 || + !is_power_of_2(mddev->chunk_size)) { + printk(KERN_ERR "md/raid0: chunk size must be a power of 2.\n"); return -EINVAL; } blk_queue_max_sectors(mddev->queue, mddev->chunk_size >> 9); |