aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-06-16 02:50:52 -0400
committerNeilBrown <neilb@suse.de>2009-06-16 02:50:52 -0400
commitb414579f4573b6dc8583e31b01dcffd13f49fd62 (patch)
tree08358cac251421380642dac0fdeb3bc296a97232 /drivers
parent49f357a22b3fa3eeac042dfa0a6cae920c174e48 (diff)
md: raid0: remove ->dev pointer from strip_zone structure
If we treat conf->devlist more like a 2 dimensional array, we can get the devlist for a particular zone simply by indexing that array, so we don't need to store the pointers to subarrays in strip_zone. This makes strip_zone smaller and so (hopefully) searches faster. Signed-of-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/raid0.c21
-rw-r--r--drivers/md/raid0.h1
2 files changed, 11 insertions, 11 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 07ef936afc71..af0df78223b1 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -27,7 +27,7 @@ static void raid0_unplug(struct request_queue *q)
27{ 27{
28 mddev_t *mddev = q->queuedata; 28 mddev_t *mddev = q->queuedata;
29 raid0_conf_t *conf = mddev_to_conf(mddev); 29 raid0_conf_t *conf = mddev_to_conf(mddev);
30 mdk_rdev_t **devlist = conf->strip_zone[0].dev; 30 mdk_rdev_t **devlist = conf->devlist;
31 int i; 31 int i;
32 32
33 for (i=0; i<mddev->raid_disks; i++) { 33 for (i=0; i<mddev->raid_disks; i++) {
@@ -41,7 +41,7 @@ static int raid0_congested(void *data, int bits)
41{ 41{
42 mddev_t *mddev = data; 42 mddev_t *mddev = data;
43 raid0_conf_t *conf = mddev_to_conf(mddev); 43 raid0_conf_t *conf = mddev_to_conf(mddev);
44 mdk_rdev_t **devlist = conf->strip_zone[0].dev; 44 mdk_rdev_t **devlist = conf->devlist;
45 int i, ret = 0; 45 int i, ret = 0;
46 46
47 for (i = 0; i < mddev->raid_disks && !ret ; i++) { 47 for (i = 0; i < mddev->raid_disks && !ret ; i++) {
@@ -56,7 +56,7 @@ static int create_strip_zones(mddev_t *mddev)
56{ 56{
57 int i, c, j, err; 57 int i, c, j, err;
58 sector_t curr_zone_end, sectors; 58 sector_t curr_zone_end, sectors;
59 mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev; 59 mdk_rdev_t *smallest, *rdev1, *rdev2, *rdev, **dev;
60 struct strip_zone *zone; 60 struct strip_zone *zone;
61 int cnt; 61 int cnt;
62 char b[BDEVNAME_SIZE]; 62 char b[BDEVNAME_SIZE];
@@ -115,7 +115,7 @@ static int create_strip_zones(mddev_t *mddev)
115 zone = &conf->strip_zone[0]; 115 zone = &conf->strip_zone[0];
116 cnt = 0; 116 cnt = 0;
117 smallest = NULL; 117 smallest = NULL;
118 zone->dev = conf->devlist; 118 dev = conf->devlist;
119 err = -EINVAL; 119 err = -EINVAL;
120 list_for_each_entry(rdev1, &mddev->disks, same_set) { 120 list_for_each_entry(rdev1, &mddev->disks, same_set) {
121 int j = rdev1->raid_disk; 121 int j = rdev1->raid_disk;
@@ -125,12 +125,12 @@ static int create_strip_zones(mddev_t *mddev)
125 "aborting!\n", j); 125 "aborting!\n", j);
126 goto abort; 126 goto abort;
127 } 127 }
128 if (zone->dev[j]) { 128 if (dev[j]) {
129 printk(KERN_ERR "raid0: multiple devices for %d - " 129 printk(KERN_ERR "raid0: multiple devices for %d - "
130 "aborting!\n", j); 130 "aborting!\n", j);
131 goto abort; 131 goto abort;
132 } 132 }
133 zone->dev[j] = rdev1; 133 dev[j] = rdev1;
134 134
135 blk_queue_stack_limits(mddev->queue, 135 blk_queue_stack_limits(mddev->queue,
136 rdev1->bdev->bd_disk->queue); 136 rdev1->bdev->bd_disk->queue);
@@ -161,7 +161,7 @@ static int create_strip_zones(mddev_t *mddev)
161 for (i = 1; i < conf->nr_strip_zones; i++) 161 for (i = 1; i < conf->nr_strip_zones; i++)
162 { 162 {
163 zone = conf->strip_zone + i; 163 zone = conf->strip_zone + i;
164 zone->dev = conf->strip_zone[i-1].dev + mddev->raid_disks; 164 dev = conf->devlist + i * mddev->raid_disks;
165 165
166 printk(KERN_INFO "raid0: zone %d\n", i); 166 printk(KERN_INFO "raid0: zone %d\n", i);
167 zone->dev_start = smallest->sectors; 167 zone->dev_start = smallest->sectors;
@@ -170,7 +170,7 @@ static int create_strip_zones(mddev_t *mddev)
170 170
171 for (j=0; j<cnt; j++) { 171 for (j=0; j<cnt; j++) {
172 char b[BDEVNAME_SIZE]; 172 char b[BDEVNAME_SIZE];
173 rdev = conf->strip_zone[0].dev[j]; 173 rdev = conf->devlist[j];
174 printk(KERN_INFO "raid0: checking %s ...", 174 printk(KERN_INFO "raid0: checking %s ...",
175 bdevname(rdev->bdev, b)); 175 bdevname(rdev->bdev, b));
176 if (rdev->sectors <= zone->dev_start) { 176 if (rdev->sectors <= zone->dev_start) {
@@ -178,7 +178,7 @@ static int create_strip_zones(mddev_t *mddev)
178 continue; 178 continue;
179 } 179 }
180 printk(KERN_INFO " contained as device %d\n", c); 180 printk(KERN_INFO " contained as device %d\n", c);
181 zone->dev[c] = rdev; 181 dev[c] = rdev;
182 c++; 182 c++;
183 if (!smallest || rdev->sectors < smallest->sectors) { 183 if (!smallest || rdev->sectors < smallest->sectors) {
184 smallest = rdev; 184 smallest = rdev;
@@ -383,7 +383,8 @@ static int raid0_make_request (struct request_queue *q, struct bio *bio)
383 chunk = x; 383 chunk = x;
384 384
385 x = sector >> chunksect_bits; 385 x = sector >> chunksect_bits;
386 tmp_dev = zone->dev[sector_div(x, zone->nb_dev)]; 386 tmp_dev = conf->devlist[(zone - conf->strip_zone)*mddev->raid_disks
387 + sector_div(x, zone->nb_dev)];
387 } 388 }
388 rsect = (chunk << chunksect_bits) + zone->dev_start + sect_in_chunk; 389 rsect = (chunk << chunksect_bits) + zone->dev_start + sect_in_chunk;
389 390
diff --git a/drivers/md/raid0.h b/drivers/md/raid0.h
index 124ba34c8eed..7b3605e570c0 100644
--- a/drivers/md/raid0.h
+++ b/drivers/md/raid0.h
@@ -6,7 +6,6 @@ struct strip_zone
6 sector_t zone_end; /* Start of the next zone (in sectors) */ 6 sector_t zone_end; /* Start of the next zone (in sectors) */
7 sector_t dev_start; /* Zone offset in real dev (in sectors) */ 7 sector_t dev_start; /* Zone offset in real dev (in sectors) */
8 int nb_dev; /* # of devices attached to the zone */ 8 int nb_dev; /* # of devices attached to the zone */
9 mdk_rdev_t **dev; /* Devices attached to the zone */
10}; 9};
11 10
12struct raid0_private_data 11struct raid0_private_data