提交 b5a20961 编写于 作者: N NeilBrown

md/raid0: tidy up printk messages.

All messages now start
   md/raid0:md-device-name:
Signed-off-by: NNeilBrown <neilb@suse.de>
上级 128595ed
...@@ -75,10 +75,10 @@ static void dump_zones(mddev_t *mddev) ...@@ -75,10 +75,10 @@ static void dump_zones(mddev_t *mddev)
for (j = 0; j < conf->nr_strip_zones; j++) { for (j = 0; j < conf->nr_strip_zones; j++) {
printk(KERN_INFO "zone%d=[", j); printk(KERN_INFO "zone%d=[", j);
for (k = 0; k < conf->strip_zone[j].nb_dev; k++) for (k = 0; k < conf->strip_zone[j].nb_dev; k++)
printk("%s/", printk(KERN_CONT "%s/",
bdevname(conf->devlist[j*raid_disks bdevname(conf->devlist[j*raid_disks
+ k]->bdev, b)); + k]->bdev, b));
printk("]\n"); printk(KERN_CONT "]\n");
zone_size = conf->strip_zone[j].zone_end - zone_start; zone_size = conf->strip_zone[j].zone_end - zone_start;
printk(KERN_INFO " zone offset=%llukb " printk(KERN_INFO " zone offset=%llukb "
...@@ -104,8 +104,9 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) ...@@ -104,8 +104,9 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf)
if (!conf) if (!conf)
return -ENOMEM; return -ENOMEM;
list_for_each_entry(rdev1, &mddev->disks, same_set) { list_for_each_entry(rdev1, &mddev->disks, same_set) {
printk(KERN_INFO "raid0: looking at %s\n", printk(KERN_INFO "md/raid0:%s: looking at %s\n",
bdevname(rdev1->bdev,b)); mdname(mddev),
bdevname(rdev1->bdev, b));
c = 0; c = 0;
/* round size to chunk_size */ /* round size to chunk_size */
...@@ -114,14 +115,16 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) ...@@ -114,14 +115,16 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf)
rdev1->sectors = sectors * mddev->chunk_sectors; rdev1->sectors = sectors * mddev->chunk_sectors;
list_for_each_entry(rdev2, &mddev->disks, same_set) { list_for_each_entry(rdev2, &mddev->disks, same_set) {
printk(KERN_INFO "raid0: comparing %s(%llu)", printk(KERN_INFO "md/raid0:%s: comparing %s(%llu)",
mdname(mddev),
bdevname(rdev1->bdev,b), bdevname(rdev1->bdev,b),
(unsigned long long)rdev1->sectors); (unsigned long long)rdev1->sectors);
printk(KERN_INFO " with %s(%llu)\n", printk(KERN_CONT " with %s(%llu)\n",
bdevname(rdev2->bdev,b), bdevname(rdev2->bdev,b),
(unsigned long long)rdev2->sectors); (unsigned long long)rdev2->sectors);
if (rdev2 == rdev1) { if (rdev2 == rdev1) {
printk(KERN_INFO "raid0: END\n"); printk(KERN_INFO "md/raid0:%s: END\n",
mdname(mddev));
break; break;
} }
if (rdev2->sectors == rdev1->sectors) { if (rdev2->sectors == rdev1->sectors) {
...@@ -129,20 +132,24 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) ...@@ -129,20 +132,24 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf)
* Not unique, don't count it as a new * Not unique, don't count it as a new
* group * group
*/ */
printk(KERN_INFO "raid0: EQUAL\n"); printk(KERN_INFO "md/raid0:%s: EQUAL\n",
mdname(mddev));
c = 1; c = 1;
break; break;
} }
printk(KERN_INFO "raid0: NOT EQUAL\n"); printk(KERN_INFO "md/raid0:%s: NOT EQUAL\n",
mdname(mddev));
} }
if (!c) { if (!c) {
printk(KERN_INFO "raid0: ==> UNIQUE\n"); printk(KERN_INFO "md/raid0:%s: ==> UNIQUE\n",
mdname(mddev));
conf->nr_strip_zones++; conf->nr_strip_zones++;
printk(KERN_INFO "raid0: %d zones\n", printk(KERN_INFO "md/raid0:%s: %d zones\n",
conf->nr_strip_zones); mdname(mddev), conf->nr_strip_zones);
} }
} }
printk(KERN_INFO "raid0: FINAL %d zones\n", conf->nr_strip_zones); printk(KERN_INFO "md/raid0:%s: FINAL %d zones\n",
mdname(mddev), conf->nr_strip_zones);
err = -ENOMEM; err = -ENOMEM;
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);
...@@ -170,13 +177,13 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) ...@@ -170,13 +177,13 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf)
j /= 2; j /= 2;
if (j < 0 || j >= mddev->raid_disks) { if (j < 0 || j >= mddev->raid_disks) {
printk(KERN_ERR "raid0: bad disk number %d - " printk(KERN_ERR "md/raid0:%s: bad disk number %d - "
"aborting!\n", j); "aborting!\n", mdname(mddev), j);
goto abort; goto abort;
} }
if (dev[j]) { if (dev[j]) {
printk(KERN_ERR "raid0: multiple devices for %d - " printk(KERN_ERR "md/raid0:%s: multiple devices for %d - "
"aborting!\n", j); "aborting!\n", mdname(mddev), j);
goto abort; goto abort;
} }
dev[j] = rdev1; dev[j] = rdev1;
...@@ -198,8 +205,8 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) ...@@ -198,8 +205,8 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf)
cnt++; cnt++;
} }
if (cnt != mddev->raid_disks) { if (cnt != mddev->raid_disks) {
printk(KERN_ERR "raid0: too few disks (%d of %d) - " printk(KERN_ERR "md/raid0:%s: too few disks (%d of %d) - "
"aborting!\n", cnt, mddev->raid_disks); "aborting!\n", mdname(mddev), cnt, mddev->raid_disks);
goto abort; goto abort;
} }
zone->nb_dev = cnt; zone->nb_dev = cnt;
...@@ -215,38 +222,43 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) ...@@ -215,38 +222,43 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf)
zone = conf->strip_zone + i; zone = conf->strip_zone + i;
dev = conf->devlist + i * mddev->raid_disks; dev = conf->devlist + i * mddev->raid_disks;
printk(KERN_INFO "raid0: zone %d\n", i); printk(KERN_INFO "md/raid0:%s: zone %d\n",
mdname(mddev), i);
zone->dev_start = smallest->sectors; zone->dev_start = smallest->sectors;
smallest = NULL; smallest = NULL;
c = 0; c = 0;
for (j=0; j<cnt; j++) { for (j=0; j<cnt; j++) {
rdev = conf->devlist[j]; rdev = conf->devlist[j];
printk(KERN_INFO "raid0: checking %s ...", printk(KERN_INFO "md/raid0:%s: checking %s ...",
mdname(mddev),
bdevname(rdev->bdev, b)); bdevname(rdev->bdev, b));
if (rdev->sectors <= zone->dev_start) { if (rdev->sectors <= zone->dev_start) {
printk(KERN_INFO " nope.\n"); printk(KERN_CONT " nope.\n");
continue; continue;
} }
printk(KERN_INFO " contained as device %d\n", c); printk(KERN_CONT " contained as device %d\n", c);
dev[c] = rdev; dev[c] = rdev;
c++; c++;
if (!smallest || rdev->sectors < smallest->sectors) { if (!smallest || rdev->sectors < smallest->sectors) {
smallest = rdev; smallest = rdev;
printk(KERN_INFO " (%llu) is smallest!.\n", printk(KERN_INFO "md/raid0:%s: (%llu) is smallest!.\n",
mdname(mddev),
(unsigned long long)rdev->sectors); (unsigned long long)rdev->sectors);
} }
} }
zone->nb_dev = c; zone->nb_dev = c;
sectors = (smallest->sectors - zone->dev_start) * c; sectors = (smallest->sectors - zone->dev_start) * c;
printk(KERN_INFO "raid0: zone->nb_dev: %d, sectors: %llu\n", printk(KERN_INFO "md/raid0:%s: zone->nb_dev: %d, sectors: %llu\n",
mdname(mddev),
zone->nb_dev, (unsigned long long)sectors); zone->nb_dev, (unsigned long long)sectors);
curr_zone_end += sectors; curr_zone_end += sectors;
zone->zone_end = curr_zone_end; zone->zone_end = curr_zone_end;
printk(KERN_INFO "raid0: current zone start: %llu\n", printk(KERN_INFO "md/raid0:%s: current zone start: %llu\n",
mdname(mddev),
(unsigned long long)smallest->sectors); (unsigned long long)smallest->sectors);
} }
mddev->queue->unplug_fn = raid0_unplug; mddev->queue->unplug_fn = raid0_unplug;
...@@ -258,7 +270,7 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) ...@@ -258,7 +270,7 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf)
* chunk size is a multiple of that sector size * chunk size is a multiple of that sector size
*/ */
if ((mddev->chunk_sectors << 9) % queue_logical_block_size(mddev->queue)) { if ((mddev->chunk_sectors << 9) % queue_logical_block_size(mddev->queue)) {
printk(KERN_ERR "%s chunk_size of %d not valid\n", printk(KERN_ERR "md/raid0:%s: chunk_size of %d not valid\n",
mdname(mddev), mdname(mddev),
mddev->chunk_sectors << 9); mddev->chunk_sectors << 9);
goto abort; goto abort;
...@@ -268,7 +280,7 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) ...@@ -268,7 +280,7 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf)
blk_queue_io_opt(mddev->queue, blk_queue_io_opt(mddev->queue,
(mddev->chunk_sectors << 9) * mddev->raid_disks); (mddev->chunk_sectors << 9) * mddev->raid_disks);
printk(KERN_INFO "raid0: done.\n"); printk(KERN_INFO "md/raid0:%s: done.\n", mdname(mddev));
*private_conf = conf; *private_conf = conf;
return 0; return 0;
...@@ -331,7 +343,8 @@ static int raid0_run(mddev_t *mddev) ...@@ -331,7 +343,8 @@ static int raid0_run(mddev_t *mddev)
int ret; int ret;
if (mddev->chunk_sectors == 0) { if (mddev->chunk_sectors == 0) {
printk(KERN_ERR "md/raid0: chunk size must be set.\n"); printk(KERN_ERR "md/raid0:%s: chunk size must be set.\n",
mdname(mddev));
return -EINVAL; return -EINVAL;
} }
if (md_check_no_bitmap(mddev)) if (md_check_no_bitmap(mddev))
...@@ -357,7 +370,8 @@ static int raid0_run(mddev_t *mddev) ...@@ -357,7 +370,8 @@ static int raid0_run(mddev_t *mddev)
/* calculate array device size */ /* calculate array device size */
md_set_array_sectors(mddev, raid0_size(mddev, 0, 0)); md_set_array_sectors(mddev, raid0_size(mddev, 0, 0));
printk(KERN_INFO "raid0 : md_size is %llu sectors.\n", printk(KERN_INFO "md/raid0:%s: md_size is %llu sectors.\n",
mdname(mddev),
(unsigned long long)mddev->array_sectors); (unsigned long long)mddev->array_sectors);
/* calculate the max read-ahead size. /* calculate the max read-ahead size.
* For read-ahead of large files to be effective, we need to * For read-ahead of large files to be effective, we need to
...@@ -516,8 +530,9 @@ static int raid0_make_request(mddev_t *mddev, struct bio *bio) ...@@ -516,8 +530,9 @@ static int raid0_make_request(mddev_t *mddev, struct bio *bio)
return 1; return 1;
bad_map: bad_map:
printk("raid0_make_request bug: can't convert block across chunks" printk("md/raid0:%s: make_request bug: can't convert block across chunks"
" or bigger than %dk %llu %d\n", chunk_sects / 2, " or bigger than %dk %llu %d\n",
mdname(mddev), chunk_sects / 2,
(unsigned long long)bio->bi_sector, bio->bi_size >> 10); (unsigned long long)bio->bi_sector, bio->bi_size >> 10);
bio_io_error(bio); bio_io_error(bio);
...@@ -563,7 +578,8 @@ static void *raid0_takeover_raid5(mddev_t *mddev) ...@@ -563,7 +578,8 @@ static void *raid0_takeover_raid5(mddev_t *mddev)
raid0_conf_t *priv_conf; raid0_conf_t *priv_conf;
if (mddev->degraded != 1) { if (mddev->degraded != 1) {
printk(KERN_ERR "md: raid5 must be degraded! Degraded disks: %d\n", printk(KERN_ERR "md/raid0:%s: raid5 must be degraded! Degraded disks: %d\n",
mdname(mddev),
mddev->degraded); mddev->degraded);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
...@@ -571,7 +587,8 @@ static void *raid0_takeover_raid5(mddev_t *mddev) ...@@ -571,7 +587,8 @@ static void *raid0_takeover_raid5(mddev_t *mddev)
list_for_each_entry(rdev, &mddev->disks, same_set) { list_for_each_entry(rdev, &mddev->disks, same_set) {
/* check slot number for a disk */ /* check slot number for a disk */
if (rdev->raid_disk == mddev->raid_disks-1) { if (rdev->raid_disk == mddev->raid_disks-1) {
printk(KERN_ERR "md: raid5 must have missing parity disk!\n"); printk(KERN_ERR "md/raid0:%s: raid5 must have missing parity disk!\n",
mdname(mddev));
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
} }
...@@ -599,16 +616,19 @@ static void *raid0_takeover_raid10(mddev_t *mddev) ...@@ -599,16 +616,19 @@ static void *raid0_takeover_raid10(mddev_t *mddev)
* - all mirrors must be already degraded * - all mirrors must be already degraded
*/ */
if (mddev->layout != ((1 << 8) + 2)) { if (mddev->layout != ((1 << 8) + 2)) {
printk(KERN_ERR "md: Raid0 cannot takover layout: %x\n", printk(KERN_ERR "md/raid0:%s:: Raid0 cannot takover layout: 0x%x\n",
mdname(mddev),
mddev->layout); mddev->layout);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
if (mddev->raid_disks & 1) { if (mddev->raid_disks & 1) {
printk(KERN_ERR "md: Raid0 cannot takover Raid10 with odd disk number.\n"); printk(KERN_ERR "md/raid0:%s: Raid0 cannot takover Raid10 with odd disk number.\n",
mdname(mddev));
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
if (mddev->degraded != (mddev->raid_disks>>1)) { if (mddev->degraded != (mddev->raid_disks>>1)) {
printk(KERN_ERR "md: All mirrors must be already degraded!\n"); printk(KERN_ERR "md/raid0:%s: All mirrors must be already degraded!\n",
mdname(mddev));
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
...@@ -636,8 +656,8 @@ static void *raid0_takeover(mddev_t *mddev) ...@@ -636,8 +656,8 @@ static void *raid0_takeover(mddev_t *mddev)
if (mddev->layout == ALGORITHM_PARITY_N) if (mddev->layout == ALGORITHM_PARITY_N)
return raid0_takeover_raid5(mddev); return raid0_takeover_raid5(mddev);
printk(KERN_ERR "md: Raid can only takeover Raid5 with layout: %d\n", printk(KERN_ERR "md/raid0:%s: Raid can only takeover Raid5 with layout: %d\n",
ALGORITHM_PARITY_N); mdname(mddev), ALGORITHM_PARITY_N);
} }
if (mddev->level == 10) if (mddev->level == 10)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册