|
@@ -105,12 +105,12 @@ static int create_strip_zones (mddev_t *mddev)
|
|
conf->strip_zone = kzalloc(sizeof(struct strip_zone)*
|
|
conf->strip_zone = kzalloc(sizeof(struct strip_zone)*
|
|
conf->nr_strip_zones, GFP_KERNEL);
|
|
conf->nr_strip_zones, GFP_KERNEL);
|
|
if (!conf->strip_zone)
|
|
if (!conf->strip_zone)
|
|
- return 1;
|
|
|
|
|
|
+ return -ENOMEM;
|
|
conf->devlist = kzalloc(sizeof(mdk_rdev_t*)*
|
|
conf->devlist = kzalloc(sizeof(mdk_rdev_t*)*
|
|
conf->nr_strip_zones*mddev->raid_disks,
|
|
conf->nr_strip_zones*mddev->raid_disks,
|
|
GFP_KERNEL);
|
|
GFP_KERNEL);
|
|
if (!conf->devlist)
|
|
if (!conf->devlist)
|
|
- return 1;
|
|
|
|
|
|
+ return -ENOMEM;
|
|
|
|
|
|
/* The first zone must contain all devices, so here we check that
|
|
/* The first zone must contain all devices, so here we check that
|
|
* there is a proper alignment of slots to devices and find them all
|
|
* there is a proper alignment of slots to devices and find them all
|
|
@@ -207,8 +207,8 @@ static int create_strip_zones (mddev_t *mddev)
|
|
|
|
|
|
printk(KERN_INFO "raid0: done.\n");
|
|
printk(KERN_INFO "raid0: done.\n");
|
|
return 0;
|
|
return 0;
|
|
- abort:
|
|
|
|
- return 1;
|
|
|
|
|
|
+abort:
|
|
|
|
+ return -EINVAL;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -254,6 +254,7 @@ static sector_t raid0_size(mddev_t *mddev, sector_t sectors, int raid_disks)
|
|
static int raid0_run(mddev_t *mddev)
|
|
static int raid0_run(mddev_t *mddev)
|
|
{
|
|
{
|
|
raid0_conf_t *conf;
|
|
raid0_conf_t *conf;
|
|
|
|
+ int ret;
|
|
|
|
|
|
if (mddev->chunk_size == 0) {
|
|
if (mddev->chunk_size == 0) {
|
|
printk(KERN_ERR "md/raid0: non-zero chunk size required.\n");
|
|
printk(KERN_ERR "md/raid0: non-zero chunk size required.\n");
|
|
@@ -269,12 +270,13 @@ static int raid0_run(mddev_t *mddev)
|
|
|
|
|
|
conf = kmalloc(sizeof (raid0_conf_t), GFP_KERNEL);
|
|
conf = kmalloc(sizeof (raid0_conf_t), GFP_KERNEL);
|
|
if (!conf)
|
|
if (!conf)
|
|
- goto out;
|
|
|
|
|
|
+ return -ENOMEM;
|
|
mddev->private = (void *)conf;
|
|
mddev->private = (void *)conf;
|
|
|
|
|
|
conf->strip_zone = NULL;
|
|
conf->strip_zone = NULL;
|
|
conf->devlist = NULL;
|
|
conf->devlist = NULL;
|
|
- if (create_strip_zones (mddev))
|
|
|
|
|
|
+ ret = create_strip_zones(mddev);
|
|
|
|
+ if (ret < 0)
|
|
goto out_free_conf;
|
|
goto out_free_conf;
|
|
|
|
|
|
/* calculate array device size */
|
|
/* calculate array device size */
|
|
@@ -306,8 +308,7 @@ out_free_conf:
|
|
kfree(conf->devlist);
|
|
kfree(conf->devlist);
|
|
kfree(conf);
|
|
kfree(conf);
|
|
mddev->private = NULL;
|
|
mddev->private = NULL;
|
|
-out:
|
|
|
|
- return -ENOMEM;
|
|
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
|
|
static int raid0_stop (mddev_t *mddev)
|
|
static int raid0_stop (mddev_t *mddev)
|