diff options
Diffstat (limited to 'drivers/md/raid0.c')
-rw-r--r-- | drivers/md/raid0.c | 110 |
1 files changed, 65 insertions, 45 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 9f9c6b76ca7c..dc38c1a45166 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -75,10 +75,10 @@ static void dump_zones(mddev_t *mddev) | |||
75 | for (j = 0; j < conf->nr_strip_zones; j++) { | 75 | for (j = 0; j < conf->nr_strip_zones; j++) { |
76 | printk(KERN_INFO "zone%d=[", j); | 76 | printk(KERN_INFO "zone%d=[", j); |
77 | for (k = 0; k < conf->strip_zone[j].nb_dev; k++) | 77 | for (k = 0; k < conf->strip_zone[j].nb_dev; k++) |
78 | printk("%s/", | 78 | printk(KERN_CONT "%s/", |
79 | bdevname(conf->devlist[j*raid_disks | 79 | bdevname(conf->devlist[j*raid_disks |
80 | + k]->bdev, b)); | 80 | + k]->bdev, b)); |
81 | printk("]\n"); | 81 | printk(KERN_CONT "]\n"); |
82 | 82 | ||
83 | zone_size = conf->strip_zone[j].zone_end - zone_start; | 83 | zone_size = conf->strip_zone[j].zone_end - zone_start; |
84 | printk(KERN_INFO " zone offset=%llukb " | 84 | printk(KERN_INFO " zone offset=%llukb " |
@@ -104,8 +104,9 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
104 | if (!conf) | 104 | if (!conf) |
105 | return -ENOMEM; | 105 | return -ENOMEM; |
106 | list_for_each_entry(rdev1, &mddev->disks, same_set) { | 106 | list_for_each_entry(rdev1, &mddev->disks, same_set) { |
107 | printk(KERN_INFO "raid0: looking at %s\n", | 107 | printk(KERN_INFO "md/raid0:%s: looking at %s\n", |
108 | bdevname(rdev1->bdev,b)); | 108 | mdname(mddev), |
109 | bdevname(rdev1->bdev, b)); | ||
109 | c = 0; | 110 | c = 0; |
110 | 111 | ||
111 | /* round size to chunk_size */ | 112 | /* round size to chunk_size */ |
@@ -114,14 +115,16 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
114 | rdev1->sectors = sectors * mddev->chunk_sectors; | 115 | rdev1->sectors = sectors * mddev->chunk_sectors; |
115 | 116 | ||
116 | list_for_each_entry(rdev2, &mddev->disks, same_set) { | 117 | list_for_each_entry(rdev2, &mddev->disks, same_set) { |
117 | printk(KERN_INFO "raid0: comparing %s(%llu)", | 118 | printk(KERN_INFO "md/raid0:%s: comparing %s(%llu)", |
119 | mdname(mddev), | ||
118 | bdevname(rdev1->bdev,b), | 120 | bdevname(rdev1->bdev,b), |
119 | (unsigned long long)rdev1->sectors); | 121 | (unsigned long long)rdev1->sectors); |
120 | printk(KERN_INFO " with %s(%llu)\n", | 122 | printk(KERN_CONT " with %s(%llu)\n", |
121 | bdevname(rdev2->bdev,b), | 123 | bdevname(rdev2->bdev,b), |
122 | (unsigned long long)rdev2->sectors); | 124 | (unsigned long long)rdev2->sectors); |
123 | if (rdev2 == rdev1) { | 125 | if (rdev2 == rdev1) { |
124 | printk(KERN_INFO "raid0: END\n"); | 126 | printk(KERN_INFO "md/raid0:%s: END\n", |
127 | mdname(mddev)); | ||
125 | break; | 128 | break; |
126 | } | 129 | } |
127 | if (rdev2->sectors == rdev1->sectors) { | 130 | if (rdev2->sectors == rdev1->sectors) { |
@@ -129,20 +132,24 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
129 | * Not unique, don't count it as a new | 132 | * Not unique, don't count it as a new |
130 | * group | 133 | * group |
131 | */ | 134 | */ |
132 | printk(KERN_INFO "raid0: EQUAL\n"); | 135 | printk(KERN_INFO "md/raid0:%s: EQUAL\n", |
136 | mdname(mddev)); | ||
133 | c = 1; | 137 | c = 1; |
134 | break; | 138 | break; |
135 | } | 139 | } |
136 | printk(KERN_INFO "raid0: NOT EQUAL\n"); | 140 | printk(KERN_INFO "md/raid0:%s: NOT EQUAL\n", |
141 | mdname(mddev)); | ||
137 | } | 142 | } |
138 | if (!c) { | 143 | if (!c) { |
139 | printk(KERN_INFO "raid0: ==> UNIQUE\n"); | 144 | printk(KERN_INFO "md/raid0:%s: ==> UNIQUE\n", |
145 | mdname(mddev)); | ||
140 | conf->nr_strip_zones++; | 146 | conf->nr_strip_zones++; |
141 | printk(KERN_INFO "raid0: %d zones\n", | 147 | printk(KERN_INFO "md/raid0:%s: %d zones\n", |
142 | conf->nr_strip_zones); | 148 | mdname(mddev), conf->nr_strip_zones); |
143 | } | 149 | } |
144 | } | 150 | } |
145 | printk(KERN_INFO "raid0: FINAL %d zones\n", conf->nr_strip_zones); | 151 | printk(KERN_INFO "md/raid0:%s: FINAL %d zones\n", |
152 | mdname(mddev), conf->nr_strip_zones); | ||
146 | err = -ENOMEM; | 153 | err = -ENOMEM; |
147 | conf->strip_zone = kzalloc(sizeof(struct strip_zone)* | 154 | conf->strip_zone = kzalloc(sizeof(struct strip_zone)* |
148 | conf->nr_strip_zones, GFP_KERNEL); | 155 | conf->nr_strip_zones, GFP_KERNEL); |
@@ -170,13 +177,13 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
170 | j /= 2; | 177 | j /= 2; |
171 | 178 | ||
172 | if (j < 0 || j >= mddev->raid_disks) { | 179 | if (j < 0 || j >= mddev->raid_disks) { |
173 | printk(KERN_ERR "raid0: bad disk number %d - " | 180 | printk(KERN_ERR "md/raid0:%s: bad disk number %d - " |
174 | "aborting!\n", j); | 181 | "aborting!\n", mdname(mddev), j); |
175 | goto abort; | 182 | goto abort; |
176 | } | 183 | } |
177 | if (dev[j]) { | 184 | if (dev[j]) { |
178 | printk(KERN_ERR "raid0: multiple devices for %d - " | 185 | printk(KERN_ERR "md/raid0:%s: multiple devices for %d - " |
179 | "aborting!\n", j); | 186 | "aborting!\n", mdname(mddev), j); |
180 | goto abort; | 187 | goto abort; |
181 | } | 188 | } |
182 | dev[j] = rdev1; | 189 | dev[j] = rdev1; |
@@ -198,8 +205,8 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
198 | cnt++; | 205 | cnt++; |
199 | } | 206 | } |
200 | if (cnt != mddev->raid_disks) { | 207 | if (cnt != mddev->raid_disks) { |
201 | printk(KERN_ERR "raid0: too few disks (%d of %d) - " | 208 | printk(KERN_ERR "md/raid0:%s: too few disks (%d of %d) - " |
202 | "aborting!\n", cnt, mddev->raid_disks); | 209 | "aborting!\n", mdname(mddev), cnt, mddev->raid_disks); |
203 | goto abort; | 210 | goto abort; |
204 | } | 211 | } |
205 | zone->nb_dev = cnt; | 212 | zone->nb_dev = cnt; |
@@ -215,39 +222,44 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
215 | zone = conf->strip_zone + i; | 222 | zone = conf->strip_zone + i; |
216 | dev = conf->devlist + i * mddev->raid_disks; | 223 | dev = conf->devlist + i * mddev->raid_disks; |
217 | 224 | ||
218 | printk(KERN_INFO "raid0: zone %d\n", i); | 225 | printk(KERN_INFO "md/raid0:%s: zone %d\n", |
226 | mdname(mddev), i); | ||
219 | zone->dev_start = smallest->sectors; | 227 | zone->dev_start = smallest->sectors; |
220 | smallest = NULL; | 228 | smallest = NULL; |
221 | c = 0; | 229 | c = 0; |
222 | 230 | ||
223 | for (j=0; j<cnt; j++) { | 231 | for (j=0; j<cnt; j++) { |
224 | rdev = conf->devlist[j]; | 232 | rdev = conf->devlist[j]; |
225 | printk(KERN_INFO "raid0: checking %s ...", | 233 | printk(KERN_INFO "md/raid0:%s: checking %s ...", |
226 | bdevname(rdev->bdev, b)); | 234 | mdname(mddev), |
235 | bdevname(rdev->bdev, b)); | ||
227 | if (rdev->sectors <= zone->dev_start) { | 236 | if (rdev->sectors <= zone->dev_start) { |
228 | printk(KERN_INFO " nope.\n"); | 237 | printk(KERN_CONT " nope.\n"); |
229 | continue; | 238 | continue; |
230 | } | 239 | } |
231 | printk(KERN_INFO " contained as device %d\n", c); | 240 | printk(KERN_CONT " contained as device %d\n", c); |
232 | dev[c] = rdev; | 241 | dev[c] = rdev; |
233 | c++; | 242 | c++; |
234 | if (!smallest || rdev->sectors < smallest->sectors) { | 243 | if (!smallest || rdev->sectors < smallest->sectors) { |
235 | smallest = rdev; | 244 | smallest = rdev; |
236 | printk(KERN_INFO " (%llu) is smallest!.\n", | 245 | printk(KERN_INFO "md/raid0:%s: (%llu) is smallest!.\n", |
237 | (unsigned long long)rdev->sectors); | 246 | mdname(mddev), |
247 | (unsigned long long)rdev->sectors); | ||
238 | } | 248 | } |
239 | } | 249 | } |
240 | 250 | ||
241 | zone->nb_dev = c; | 251 | zone->nb_dev = c; |
242 | sectors = (smallest->sectors - zone->dev_start) * c; | 252 | sectors = (smallest->sectors - zone->dev_start) * c; |
243 | printk(KERN_INFO "raid0: zone->nb_dev: %d, sectors: %llu\n", | 253 | printk(KERN_INFO "md/raid0:%s: zone->nb_dev: %d, sectors: %llu\n", |
244 | zone->nb_dev, (unsigned long long)sectors); | 254 | mdname(mddev), |
255 | zone->nb_dev, (unsigned long long)sectors); | ||
245 | 256 | ||
246 | curr_zone_end += sectors; | 257 | curr_zone_end += sectors; |
247 | zone->zone_end = curr_zone_end; | 258 | zone->zone_end = curr_zone_end; |
248 | 259 | ||
249 | printk(KERN_INFO "raid0: current zone start: %llu\n", | 260 | printk(KERN_INFO "md/raid0:%s: current zone start: %llu\n", |
250 | (unsigned long long)smallest->sectors); | 261 | mdname(mddev), |
262 | (unsigned long long)smallest->sectors); | ||
251 | } | 263 | } |
252 | mddev->queue->unplug_fn = raid0_unplug; | 264 | mddev->queue->unplug_fn = raid0_unplug; |
253 | mddev->queue->backing_dev_info.congested_fn = raid0_congested; | 265 | mddev->queue->backing_dev_info.congested_fn = raid0_congested; |
@@ -258,7 +270,7 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
258 | * chunk size is a multiple of that sector size | 270 | * chunk size is a multiple of that sector size |
259 | */ | 271 | */ |
260 | if ((mddev->chunk_sectors << 9) % queue_logical_block_size(mddev->queue)) { | 272 | if ((mddev->chunk_sectors << 9) % queue_logical_block_size(mddev->queue)) { |
261 | printk(KERN_ERR "%s chunk_size of %d not valid\n", | 273 | printk(KERN_ERR "md/raid0:%s: chunk_size of %d not valid\n", |
262 | mdname(mddev), | 274 | mdname(mddev), |
263 | mddev->chunk_sectors << 9); | 275 | mddev->chunk_sectors << 9); |
264 | goto abort; | 276 | goto abort; |
@@ -268,7 +280,7 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
268 | blk_queue_io_opt(mddev->queue, | 280 | blk_queue_io_opt(mddev->queue, |
269 | (mddev->chunk_sectors << 9) * mddev->raid_disks); | 281 | (mddev->chunk_sectors << 9) * mddev->raid_disks); |
270 | 282 | ||
271 | printk(KERN_INFO "raid0: done.\n"); | 283 | printk(KERN_INFO "md/raid0:%s: done.\n", mdname(mddev)); |
272 | *private_conf = conf; | 284 | *private_conf = conf; |
273 | 285 | ||
274 | return 0; | 286 | return 0; |
@@ -331,7 +343,8 @@ static int raid0_run(mddev_t *mddev) | |||
331 | int ret; | 343 | int ret; |
332 | 344 | ||
333 | if (mddev->chunk_sectors == 0) { | 345 | if (mddev->chunk_sectors == 0) { |
334 | printk(KERN_ERR "md/raid0: chunk size must be set.\n"); | 346 | printk(KERN_ERR "md/raid0:%s: chunk size must be set.\n", |
347 | mdname(mddev)); | ||
335 | return -EINVAL; | 348 | return -EINVAL; |
336 | } | 349 | } |
337 | if (md_check_no_bitmap(mddev)) | 350 | if (md_check_no_bitmap(mddev)) |
@@ -357,8 +370,9 @@ static int raid0_run(mddev_t *mddev) | |||
357 | /* calculate array device size */ | 370 | /* calculate array device size */ |
358 | md_set_array_sectors(mddev, raid0_size(mddev, 0, 0)); | 371 | md_set_array_sectors(mddev, raid0_size(mddev, 0, 0)); |
359 | 372 | ||
360 | printk(KERN_INFO "raid0 : md_size is %llu sectors.\n", | 373 | printk(KERN_INFO "md/raid0:%s: md_size is %llu sectors.\n", |
361 | (unsigned long long)mddev->array_sectors); | 374 | mdname(mddev), |
375 | (unsigned long long)mddev->array_sectors); | ||
362 | /* calculate the max read-ahead size. | 376 | /* calculate the max read-ahead size. |
363 | * For read-ahead of large files to be effective, we need to | 377 | * For read-ahead of large files to be effective, we need to |
364 | * readahead at least twice a whole stripe. i.e. number of devices | 378 | * readahead at least twice a whole stripe. i.e. number of devices |
@@ -516,9 +530,10 @@ static int raid0_make_request(mddev_t *mddev, struct bio *bio) | |||
516 | return 1; | 530 | return 1; |
517 | 531 | ||
518 | bad_map: | 532 | bad_map: |
519 | printk("raid0_make_request bug: can't convert block across chunks" | 533 | printk("md/raid0:%s: make_request bug: can't convert block across chunks" |
520 | " or bigger than %dk %llu %d\n", chunk_sects / 2, | 534 | " or bigger than %dk %llu %d\n", |
521 | (unsigned long long)bio->bi_sector, bio->bi_size >> 10); | 535 | mdname(mddev), chunk_sects / 2, |
536 | (unsigned long long)bio->bi_sector, bio->bi_size >> 10); | ||
522 | 537 | ||
523 | bio_io_error(bio); | 538 | bio_io_error(bio); |
524 | return 0; | 539 | return 0; |
@@ -563,7 +578,8 @@ static void *raid0_takeover_raid5(mddev_t *mddev) | |||
563 | raid0_conf_t *priv_conf; | 578 | raid0_conf_t *priv_conf; |
564 | 579 | ||
565 | if (mddev->degraded != 1) { | 580 | if (mddev->degraded != 1) { |
566 | printk(KERN_ERR "md: raid5 must be degraded! Degraded disks: %d\n", | 581 | printk(KERN_ERR "md/raid0:%s: raid5 must be degraded! Degraded disks: %d\n", |
582 | mdname(mddev), | ||
567 | mddev->degraded); | 583 | mddev->degraded); |
568 | return ERR_PTR(-EINVAL); | 584 | return ERR_PTR(-EINVAL); |
569 | } | 585 | } |
@@ -571,7 +587,8 @@ static void *raid0_takeover_raid5(mddev_t *mddev) | |||
571 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 587 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
572 | /* check slot number for a disk */ | 588 | /* check slot number for a disk */ |
573 | if (rdev->raid_disk == mddev->raid_disks-1) { | 589 | if (rdev->raid_disk == mddev->raid_disks-1) { |
574 | printk(KERN_ERR "md: raid5 must have missing parity disk!\n"); | 590 | printk(KERN_ERR "md/raid0:%s: raid5 must have missing parity disk!\n", |
591 | mdname(mddev)); | ||
575 | return ERR_PTR(-EINVAL); | 592 | return ERR_PTR(-EINVAL); |
576 | } | 593 | } |
577 | } | 594 | } |
@@ -599,16 +616,19 @@ static void *raid0_takeover_raid10(mddev_t *mddev) | |||
599 | * - all mirrors must be already degraded | 616 | * - all mirrors must be already degraded |
600 | */ | 617 | */ |
601 | if (mddev->layout != ((1 << 8) + 2)) { | 618 | if (mddev->layout != ((1 << 8) + 2)) { |
602 | printk(KERN_ERR "md: Raid0 cannot takover layout: %x\n", | 619 | printk(KERN_ERR "md/raid0:%s:: Raid0 cannot takover layout: 0x%x\n", |
620 | mdname(mddev), | ||
603 | mddev->layout); | 621 | mddev->layout); |
604 | return ERR_PTR(-EINVAL); | 622 | return ERR_PTR(-EINVAL); |
605 | } | 623 | } |
606 | if (mddev->raid_disks & 1) { | 624 | if (mddev->raid_disks & 1) { |
607 | printk(KERN_ERR "md: Raid0 cannot takover Raid10 with odd disk number.\n"); | 625 | printk(KERN_ERR "md/raid0:%s: Raid0 cannot takover Raid10 with odd disk number.\n", |
626 | mdname(mddev)); | ||
608 | return ERR_PTR(-EINVAL); | 627 | return ERR_PTR(-EINVAL); |
609 | } | 628 | } |
610 | if (mddev->degraded != (mddev->raid_disks>>1)) { | 629 | if (mddev->degraded != (mddev->raid_disks>>1)) { |
611 | printk(KERN_ERR "md: All mirrors must be already degraded!\n"); | 630 | printk(KERN_ERR "md/raid0:%s: All mirrors must be already degraded!\n", |
631 | mdname(mddev)); | ||
612 | return ERR_PTR(-EINVAL); | 632 | return ERR_PTR(-EINVAL); |
613 | } | 633 | } |
614 | 634 | ||
@@ -636,8 +656,8 @@ static void *raid0_takeover(mddev_t *mddev) | |||
636 | if (mddev->layout == ALGORITHM_PARITY_N) | 656 | if (mddev->layout == ALGORITHM_PARITY_N) |
637 | return raid0_takeover_raid5(mddev); | 657 | return raid0_takeover_raid5(mddev); |
638 | 658 | ||
639 | printk(KERN_ERR "md: Raid can only takeover Raid5 with layout: %d\n", | 659 | printk(KERN_ERR "md/raid0:%s: Raid can only takeover Raid5 with layout: %d\n", |
640 | ALGORITHM_PARITY_N); | 660 | mdname(mddev), ALGORITHM_PARITY_N); |
641 | } | 661 | } |
642 | 662 | ||
643 | if (mddev->level == 10) | 663 | if (mddev->level == 10) |