diff options
author | NeilBrown <neilb@suse.de> | 2011-10-06 23:23:22 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-10-06 23:23:22 -0400 |
commit | 50de8df4abca1b27dbf7b2f81a56451bd8b5a7d8 (patch) | |
tree | 7f0288247afd84707f2529634a5d4a64e9b8f046 /drivers/md/raid0.c | |
parent | 36a4e1fe0f454146724c174bf7c1e8e76297a212 (diff) |
md/raid0: convert some printks to pr_debug.
When md assembles a RAID0 array it prints out lots of info which
is really just for debugging, so convert that to pr_debug.
It also prints out the resulting configuration which could be
interesting, so keep that as 'printk' but tidy it up a bit.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid0.c')
-rw-r--r-- | drivers/md/raid0.c | 98 |
1 files changed, 50 insertions, 48 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 20823b20bfcf..138ecd7eef51 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -49,32 +49,32 @@ static int raid0_congested(void *data, int bits) | |||
49 | */ | 49 | */ |
50 | static void dump_zones(mddev_t *mddev) | 50 | static void dump_zones(mddev_t *mddev) |
51 | { | 51 | { |
52 | int j, k, h; | 52 | int j, k; |
53 | sector_t zone_size = 0; | 53 | sector_t zone_size = 0; |
54 | sector_t zone_start = 0; | 54 | sector_t zone_start = 0; |
55 | char b[BDEVNAME_SIZE]; | 55 | char b[BDEVNAME_SIZE]; |
56 | raid0_conf_t *conf = mddev->private; | 56 | raid0_conf_t *conf = mddev->private; |
57 | int raid_disks = conf->strip_zone[0].nb_dev; | 57 | int raid_disks = conf->strip_zone[0].nb_dev; |
58 | printk(KERN_INFO "******* %s configuration *********\n", | 58 | printk(KERN_INFO "md: RAID0 configuration for %s - %d zone%s\n", |
59 | mdname(mddev)); | 59 | mdname(mddev), |
60 | h = 0; | 60 | conf->nr_strip_zones, conf->nr_strip_zones==1?"":"s"); |
61 | for (j = 0; j < conf->nr_strip_zones; j++) { | 61 | for (j = 0; j < conf->nr_strip_zones; j++) { |
62 | printk(KERN_INFO "zone%d=[", j); | 62 | printk(KERN_INFO "md: zone%d=[", j); |
63 | for (k = 0; k < conf->strip_zone[j].nb_dev; k++) | 63 | for (k = 0; k < conf->strip_zone[j].nb_dev; k++) |
64 | printk(KERN_CONT "%s/", | 64 | printk(KERN_CONT "%s%s", k?"/":"", |
65 | bdevname(conf->devlist[j*raid_disks | 65 | bdevname(conf->devlist[j*raid_disks |
66 | + k]->bdev, b)); | 66 | + k]->bdev, b)); |
67 | printk(KERN_CONT "]\n"); | 67 | printk(KERN_CONT "]\n"); |
68 | 68 | ||
69 | zone_size = conf->strip_zone[j].zone_end - zone_start; | 69 | zone_size = conf->strip_zone[j].zone_end - zone_start; |
70 | printk(KERN_INFO " zone offset=%llukb " | 70 | printk(KERN_INFO " zone-offset=%10lluKB, " |
71 | "device offset=%llukb size=%llukb\n", | 71 | "device-offset=%10lluKB, size=%10lluKB\n", |
72 | (unsigned long long)zone_start>>1, | 72 | (unsigned long long)zone_start>>1, |
73 | (unsigned long long)conf->strip_zone[j].dev_start>>1, | 73 | (unsigned long long)conf->strip_zone[j].dev_start>>1, |
74 | (unsigned long long)zone_size>>1); | 74 | (unsigned long long)zone_size>>1); |
75 | zone_start = conf->strip_zone[j].zone_end; | 75 | zone_start = conf->strip_zone[j].zone_end; |
76 | } | 76 | } |
77 | printk(KERN_INFO "**********************************\n\n"); | 77 | printk(KERN_INFO "\n"); |
78 | } | 78 | } |
79 | 79 | ||
80 | static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | 80 | static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) |
@@ -85,14 +85,15 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
85 | struct strip_zone *zone; | 85 | struct strip_zone *zone; |
86 | int cnt; | 86 | int cnt; |
87 | char b[BDEVNAME_SIZE]; | 87 | char b[BDEVNAME_SIZE]; |
88 | char b2[BDEVNAME_SIZE]; | ||
88 | raid0_conf_t *conf = kzalloc(sizeof(*conf), GFP_KERNEL); | 89 | raid0_conf_t *conf = kzalloc(sizeof(*conf), GFP_KERNEL); |
89 | 90 | ||
90 | if (!conf) | 91 | if (!conf) |
91 | return -ENOMEM; | 92 | return -ENOMEM; |
92 | list_for_each_entry(rdev1, &mddev->disks, same_set) { | 93 | list_for_each_entry(rdev1, &mddev->disks, same_set) { |
93 | printk(KERN_INFO "md/raid0:%s: looking at %s\n", | 94 | pr_debug("md/raid0:%s: looking at %s\n", |
94 | mdname(mddev), | 95 | mdname(mddev), |
95 | bdevname(rdev1->bdev, b)); | 96 | bdevname(rdev1->bdev, b)); |
96 | c = 0; | 97 | c = 0; |
97 | 98 | ||
98 | /* round size to chunk_size */ | 99 | /* round size to chunk_size */ |
@@ -101,16 +102,16 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
101 | rdev1->sectors = sectors * mddev->chunk_sectors; | 102 | rdev1->sectors = sectors * mddev->chunk_sectors; |
102 | 103 | ||
103 | list_for_each_entry(rdev2, &mddev->disks, same_set) { | 104 | list_for_each_entry(rdev2, &mddev->disks, same_set) { |
104 | printk(KERN_INFO "md/raid0:%s: comparing %s(%llu)", | 105 | pr_debug("md/raid0:%s: comparing %s(%llu)" |
105 | mdname(mddev), | 106 | " with %s(%llu)\n", |
106 | bdevname(rdev1->bdev,b), | 107 | mdname(mddev), |
107 | (unsigned long long)rdev1->sectors); | 108 | bdevname(rdev1->bdev,b), |
108 | printk(KERN_CONT " with %s(%llu)\n", | 109 | (unsigned long long)rdev1->sectors, |
109 | bdevname(rdev2->bdev,b), | 110 | bdevname(rdev2->bdev,b2), |
110 | (unsigned long long)rdev2->sectors); | 111 | (unsigned long long)rdev2->sectors); |
111 | if (rdev2 == rdev1) { | 112 | if (rdev2 == rdev1) { |
112 | printk(KERN_INFO "md/raid0:%s: END\n", | 113 | pr_debug("md/raid0:%s: END\n", |
113 | mdname(mddev)); | 114 | mdname(mddev)); |
114 | break; | 115 | break; |
115 | } | 116 | } |
116 | if (rdev2->sectors == rdev1->sectors) { | 117 | if (rdev2->sectors == rdev1->sectors) { |
@@ -118,24 +119,24 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
118 | * Not unique, don't count it as a new | 119 | * Not unique, don't count it as a new |
119 | * group | 120 | * group |
120 | */ | 121 | */ |
121 | printk(KERN_INFO "md/raid0:%s: EQUAL\n", | 122 | pr_debug("md/raid0:%s: EQUAL\n", |
122 | mdname(mddev)); | 123 | mdname(mddev)); |
123 | c = 1; | 124 | c = 1; |
124 | break; | 125 | break; |
125 | } | 126 | } |
126 | printk(KERN_INFO "md/raid0:%s: NOT EQUAL\n", | 127 | pr_debug("md/raid0:%s: NOT EQUAL\n", |
127 | mdname(mddev)); | 128 | mdname(mddev)); |
128 | } | 129 | } |
129 | if (!c) { | 130 | if (!c) { |
130 | printk(KERN_INFO "md/raid0:%s: ==> UNIQUE\n", | 131 | pr_debug("md/raid0:%s: ==> UNIQUE\n", |
131 | mdname(mddev)); | 132 | mdname(mddev)); |
132 | conf->nr_strip_zones++; | 133 | conf->nr_strip_zones++; |
133 | printk(KERN_INFO "md/raid0:%s: %d zones\n", | 134 | pr_debug("md/raid0:%s: %d zones\n", |
134 | mdname(mddev), conf->nr_strip_zones); | 135 | mdname(mddev), conf->nr_strip_zones); |
135 | } | 136 | } |
136 | } | 137 | } |
137 | printk(KERN_INFO "md/raid0:%s: FINAL %d zones\n", | 138 | pr_debug("md/raid0:%s: FINAL %d zones\n", |
138 | mdname(mddev), conf->nr_strip_zones); | 139 | mdname(mddev), conf->nr_strip_zones); |
139 | err = -ENOMEM; | 140 | err = -ENOMEM; |
140 | conf->strip_zone = kzalloc(sizeof(struct strip_zone)* | 141 | conf->strip_zone = kzalloc(sizeof(struct strip_zone)* |
141 | conf->nr_strip_zones, GFP_KERNEL); | 142 | conf->nr_strip_zones, GFP_KERNEL); |
@@ -218,44 +219,45 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
218 | zone = conf->strip_zone + i; | 219 | zone = conf->strip_zone + i; |
219 | dev = conf->devlist + i * mddev->raid_disks; | 220 | dev = conf->devlist + i * mddev->raid_disks; |
220 | 221 | ||
221 | printk(KERN_INFO "md/raid0:%s: zone %d\n", | 222 | pr_debug("md/raid0:%s: zone %d\n", mdname(mddev), i); |
222 | mdname(mddev), i); | ||
223 | zone->dev_start = smallest->sectors; | 223 | zone->dev_start = smallest->sectors; |
224 | smallest = NULL; | 224 | smallest = NULL; |
225 | c = 0; | 225 | c = 0; |
226 | 226 | ||
227 | for (j=0; j<cnt; j++) { | 227 | for (j=0; j<cnt; j++) { |
228 | rdev = conf->devlist[j]; | 228 | rdev = conf->devlist[j]; |
229 | printk(KERN_INFO "md/raid0:%s: checking %s ...", | ||
230 | mdname(mddev), | ||
231 | bdevname(rdev->bdev, b)); | ||
232 | if (rdev->sectors <= zone->dev_start) { | 229 | if (rdev->sectors <= zone->dev_start) { |
233 | printk(KERN_CONT " nope.\n"); | 230 | pr_debug("md/raid0:%s: checking %s ... nope\n", |
231 | mdname(mddev), | ||
232 | bdevname(rdev->bdev, b)); | ||
234 | continue; | 233 | continue; |
235 | } | 234 | } |
236 | printk(KERN_CONT " contained as device %d\n", c); | 235 | pr_debug("md/raid0:%s: checking %s ..." |
236 | " contained as device %d\n", | ||
237 | mdname(mddev), | ||
238 | bdevname(rdev->bdev, b), c); | ||
237 | dev[c] = rdev; | 239 | dev[c] = rdev; |
238 | c++; | 240 | c++; |
239 | if (!smallest || rdev->sectors < smallest->sectors) { | 241 | if (!smallest || rdev->sectors < smallest->sectors) { |
240 | smallest = rdev; | 242 | smallest = rdev; |
241 | printk(KERN_INFO "md/raid0:%s: (%llu) is smallest!.\n", | 243 | pr_debug("md/raid0:%s: (%llu) is smallest!.\n", |
242 | mdname(mddev), | 244 | mdname(mddev), |
243 | (unsigned long long)rdev->sectors); | 245 | (unsigned long long)rdev->sectors); |
244 | } | 246 | } |
245 | } | 247 | } |
246 | 248 | ||
247 | zone->nb_dev = c; | 249 | zone->nb_dev = c; |
248 | sectors = (smallest->sectors - zone->dev_start) * c; | 250 | sectors = (smallest->sectors - zone->dev_start) * c; |
249 | printk(KERN_INFO "md/raid0:%s: zone->nb_dev: %d, sectors: %llu\n", | 251 | pr_debug("md/raid0:%s: zone->nb_dev: %d, sectors: %llu\n", |
250 | mdname(mddev), | 252 | mdname(mddev), |
251 | zone->nb_dev, (unsigned long long)sectors); | 253 | zone->nb_dev, (unsigned long long)sectors); |
252 | 254 | ||
253 | curr_zone_end += sectors; | 255 | curr_zone_end += sectors; |
254 | zone->zone_end = curr_zone_end; | 256 | zone->zone_end = curr_zone_end; |
255 | 257 | ||
256 | printk(KERN_INFO "md/raid0:%s: current zone start: %llu\n", | 258 | pr_debug("md/raid0:%s: current zone start: %llu\n", |
257 | mdname(mddev), | 259 | mdname(mddev), |
258 | (unsigned long long)smallest->sectors); | 260 | (unsigned long long)smallest->sectors); |
259 | } | 261 | } |
260 | mddev->queue->backing_dev_info.congested_fn = raid0_congested; | 262 | mddev->queue->backing_dev_info.congested_fn = raid0_congested; |
261 | mddev->queue->backing_dev_info.congested_data = mddev; | 263 | mddev->queue->backing_dev_info.congested_data = mddev; |
@@ -275,7 +277,7 @@ static int create_strip_zones(mddev_t *mddev, raid0_conf_t **private_conf) | |||
275 | blk_queue_io_opt(mddev->queue, | 277 | blk_queue_io_opt(mddev->queue, |
276 | (mddev->chunk_sectors << 9) * mddev->raid_disks); | 278 | (mddev->chunk_sectors << 9) * mddev->raid_disks); |
277 | 279 | ||
278 | printk(KERN_INFO "md/raid0:%s: done.\n", mdname(mddev)); | 280 | pr_debug("md/raid0:%s: done.\n", mdname(mddev)); |
279 | *private_conf = conf; | 281 | *private_conf = conf; |
280 | 282 | ||
281 | return 0; | 283 | return 0; |