Commit 757400c3 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: Remove dependancy on MD_SB_DISKS from raid0

Arrays with type-1 superblock can have more than
MD_SB_DISKS, so we remove the dependancy on that number from
raid0, replacing several fixed sized arrays with one
dynamically allocated array.
parent 50ebb04c
...@@ -80,6 +80,13 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -80,6 +80,13 @@ static int create_strip_zones (mddev_t *mddev)
conf->nr_strip_zones, GFP_KERNEL); conf->nr_strip_zones, GFP_KERNEL);
if (!conf->strip_zone) if (!conf->strip_zone)
return 1; return 1;
conf->devlist = kmalloc(sizeof(mdk_rdev_t*)*
conf->nr_strip_zones*mddev->raid_disks,
GFP_KERNEL);
if (!conf->devlist) {
kfree(conf);
return 1;
}
memset(conf->strip_zone, 0,sizeof(struct strip_zone)* memset(conf->strip_zone, 0,sizeof(struct strip_zone)*
conf->nr_strip_zones); conf->nr_strip_zones);
...@@ -89,6 +96,7 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -89,6 +96,7 @@ static int create_strip_zones (mddev_t *mddev)
zone = &conf->strip_zone[0]; zone = &conf->strip_zone[0];
cnt = 0; cnt = 0;
smallest = NULL; smallest = NULL;
zone->dev = conf->devlist;
ITERATE_RDEV(mddev, rdev1, tmp1) { ITERATE_RDEV(mddev, rdev1, tmp1) {
int j = rdev1->raid_disk; int j = rdev1->raid_disk;
...@@ -122,6 +130,7 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -122,6 +130,7 @@ static int create_strip_zones (mddev_t *mddev)
for (i = 1; i < conf->nr_strip_zones; i++) for (i = 1; i < conf->nr_strip_zones; i++)
{ {
zone = conf->strip_zone + i; zone = conf->strip_zone + i;
zone->dev = conf->strip_zone[i-1].dev + mddev->raid_disks;
printk("raid0: zone %d\n", i); printk("raid0: zone %d\n", i);
zone->dev_offset = current_offset; zone->dev_offset = current_offset;
...@@ -181,6 +190,7 @@ static int create_strip_zones (mddev_t *mddev) ...@@ -181,6 +190,7 @@ static int create_strip_zones (mddev_t *mddev)
printk("raid0: done.\n"); printk("raid0: done.\n");
return 0; return 0;
abort: abort:
kfree(conf->devlist);
kfree(conf->strip_zone); kfree(conf->strip_zone);
return 1; return 1;
} }
...@@ -288,6 +298,7 @@ static int raid0_run (mddev_t *mddev) ...@@ -288,6 +298,7 @@ static int raid0_run (mddev_t *mddev)
conf->strip_zone = NULL; conf->strip_zone = NULL;
out_free_conf: out_free_conf:
kfree (conf->devlist);
kfree(conf); kfree(conf);
mddev->private = NULL; mddev->private = NULL;
out: out:
......
...@@ -9,13 +9,14 @@ struct strip_zone ...@@ -9,13 +9,14 @@ struct strip_zone
sector_t dev_offset; /* Zone offset in real dev */ sector_t dev_offset; /* Zone offset in real dev */
sector_t size; /* Zone size */ sector_t size; /* Zone size */
int nb_dev; /* # of devices attached to the zone */ int nb_dev; /* # of devices attached to the zone */
mdk_rdev_t *dev[MD_SB_DISKS]; /* Devices attached to the zone */ mdk_rdev_t **dev; /* Devices attached to the zone */
}; };
struct raid0_private_data struct raid0_private_data
{ {
struct strip_zone **hash_table; /* Table of indexes into strip_zone */ struct strip_zone **hash_table; /* Table of indexes into strip_zone */
struct strip_zone *strip_zone; struct strip_zone *strip_zone;
mdk_rdev_t **devlist; /* lists of rdevs, pointed to by strip_zone->dev */
int nr_strip_zones; int nr_strip_zones;
sector_t hash_spacing; sector_t hash_spacing;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment