diff options
Diffstat (limited to 'drivers/md/raid0.c')
-rw-r--r-- | drivers/md/raid0.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index fece3277c2a5..abbca150202b 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -113,21 +113,16 @@ static int create_strip_zones (mddev_t *mddev) | |||
113 | } | 113 | } |
114 | printk("raid0: FINAL %d zones\n", conf->nr_strip_zones); | 114 | printk("raid0: FINAL %d zones\n", conf->nr_strip_zones); |
115 | 115 | ||
116 | conf->strip_zone = kmalloc(sizeof(struct strip_zone)* | 116 | conf->strip_zone = kzalloc(sizeof(struct strip_zone)* |
117 | conf->nr_strip_zones, GFP_KERNEL); | 117 | conf->nr_strip_zones, GFP_KERNEL); |
118 | if (!conf->strip_zone) | 118 | if (!conf->strip_zone) |
119 | return 1; | 119 | return 1; |
120 | conf->devlist = kmalloc(sizeof(mdk_rdev_t*)* | 120 | conf->devlist = kzalloc(sizeof(mdk_rdev_t*)* |
121 | conf->nr_strip_zones*mddev->raid_disks, | 121 | conf->nr_strip_zones*mddev->raid_disks, |
122 | GFP_KERNEL); | 122 | GFP_KERNEL); |
123 | if (!conf->devlist) | 123 | if (!conf->devlist) |
124 | return 1; | 124 | return 1; |
125 | 125 | ||
126 | memset(conf->strip_zone, 0,sizeof(struct strip_zone)* | ||
127 | conf->nr_strip_zones); | ||
128 | memset(conf->devlist, 0, | ||
129 | sizeof(mdk_rdev_t*) * conf->nr_strip_zones * mddev->raid_disks); | ||
130 | |||
131 | /* The first zone must contain all devices, so here we check that | 126 | /* The first zone must contain all devices, so here we check that |
132 | * there is a proper alignment of slots to devices and find them all | 127 | * there is a proper alignment of slots to devices and find them all |
133 | */ | 128 | */ |
@@ -280,7 +275,11 @@ static int raid0_run (mddev_t *mddev) | |||
280 | mdk_rdev_t *rdev; | 275 | mdk_rdev_t *rdev; |
281 | struct list_head *tmp; | 276 | struct list_head *tmp; |
282 | 277 | ||
283 | printk("%s: setting max_sectors to %d, segment boundary to %d\n", | 278 | if (mddev->chunk_size == 0) { |
279 | printk(KERN_ERR "md/raid0: non-zero chunk size required.\n"); | ||
280 | return -EINVAL; | ||
281 | } | ||
282 | printk(KERN_INFO "%s: setting max_sectors to %d, segment boundary to %d\n", | ||
284 | mdname(mddev), | 283 | mdname(mddev), |
285 | mddev->chunk_size >> 9, | 284 | mddev->chunk_size >> 9, |
286 | (mddev->chunk_size>>1)-1); | 285 | (mddev->chunk_size>>1)-1); |
@@ -361,7 +360,7 @@ static int raid0_run (mddev_t *mddev) | |||
361 | * chunksize should be used in that case. | 360 | * chunksize should be used in that case. |
362 | */ | 361 | */ |
363 | { | 362 | { |
364 | int stripe = mddev->raid_disks * mddev->chunk_size / PAGE_CACHE_SIZE; | 363 | int stripe = mddev->raid_disks * mddev->chunk_size / PAGE_SIZE; |
365 | if (mddev->queue->backing_dev_info.ra_pages < 2* stripe) | 364 | if (mddev->queue->backing_dev_info.ra_pages < 2* stripe) |
366 | mddev->queue->backing_dev_info.ra_pages = 2* stripe; | 365 | mddev->queue->backing_dev_info.ra_pages = 2* stripe; |
367 | } | 366 | } |
@@ -512,9 +511,10 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev) | |||
512 | return; | 511 | return; |
513 | } | 512 | } |
514 | 513 | ||
515 | static mdk_personality_t raid0_personality= | 514 | static struct mdk_personality raid0_personality= |
516 | { | 515 | { |
517 | .name = "raid0", | 516 | .name = "raid0", |
517 | .level = 0, | ||
518 | .owner = THIS_MODULE, | 518 | .owner = THIS_MODULE, |
519 | .make_request = raid0_make_request, | 519 | .make_request = raid0_make_request, |
520 | .run = raid0_run, | 520 | .run = raid0_run, |
@@ -524,15 +524,17 @@ static mdk_personality_t raid0_personality= | |||
524 | 524 | ||
525 | static int __init raid0_init (void) | 525 | static int __init raid0_init (void) |
526 | { | 526 | { |
527 | return register_md_personality (RAID0, &raid0_personality); | 527 | return register_md_personality (&raid0_personality); |
528 | } | 528 | } |
529 | 529 | ||
530 | static void raid0_exit (void) | 530 | static void raid0_exit (void) |
531 | { | 531 | { |
532 | unregister_md_personality (RAID0); | 532 | unregister_md_personality (&raid0_personality); |
533 | } | 533 | } |
534 | 534 | ||
535 | module_init(raid0_init); | 535 | module_init(raid0_init); |
536 | module_exit(raid0_exit); | 536 | module_exit(raid0_exit); |
537 | MODULE_LICENSE("GPL"); | 537 | MODULE_LICENSE("GPL"); |
538 | MODULE_ALIAS("md-personality-2"); /* RAID0 */ | 538 | MODULE_ALIAS("md-personality-2"); /* RAID0 */ |
539 | MODULE_ALIAS("md-raid0"); | ||
540 | MODULE_ALIAS("md-level-0"); | ||