aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-03-27 01:32:14 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-27 12:05:15 -0400
commit5e55e2f5fc95b355d8aa649f346cff69904c8ade (patch)
tree6722b3f116bbeacb500ed6900219cfe54eaefa11 /drivers/md/md.c
parent041ae52e265fc432ea5525b1c66720385c2d11f0 (diff)
[PATCH] md: convert compile time warnings into runtime warnings
... still not sure why we need this .... Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index a9852dbdfd66..2a9b6a07e3a2 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1318,6 +1318,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1318 char b[BDEVNAME_SIZE]; 1318 char b[BDEVNAME_SIZE];
1319 struct kobject *ko; 1319 struct kobject *ko;
1320 char *s; 1320 char *s;
1321 int err;
1321 1322
1322 if (rdev->mddev) { 1323 if (rdev->mddev) {
1323 MD_BUG(); 1324 MD_BUG();
@@ -1352,20 +1353,29 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1352 while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL) 1353 while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL)
1353 *s = '!'; 1354 *s = '!';
1354 1355
1355 list_add(&rdev->same_set, &mddev->disks);
1356 rdev->mddev = mddev; 1356 rdev->mddev = mddev;
1357 printk(KERN_INFO "md: bind<%s>\n", b); 1357 printk(KERN_INFO "md: bind<%s>\n", b);
1358 1358
1359 rdev->kobj.parent = &mddev->kobj; 1359 rdev->kobj.parent = &mddev->kobj;
1360 kobject_add(&rdev->kobj); 1360 if ((err = kobject_add(&rdev->kobj)))
1361 goto fail;
1361 1362
1362 if (rdev->bdev->bd_part) 1363 if (rdev->bdev->bd_part)
1363 ko = &rdev->bdev->bd_part->kobj; 1364 ko = &rdev->bdev->bd_part->kobj;
1364 else 1365 else
1365 ko = &rdev->bdev->bd_disk->kobj; 1366 ko = &rdev->bdev->bd_disk->kobj;
1366 sysfs_create_link(&rdev->kobj, ko, "block"); 1367 if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) {
1368 kobject_del(&rdev->kobj);
1369 goto fail;
1370 }
1371 list_add(&rdev->same_set, &mddev->disks);
1367 bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk); 1372 bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk);
1368 return 0; 1373 return 0;
1374
1375 fail:
1376 printk(KERN_WARNING "md: failed to register dev-%s for %s\n",
1377 b, mdname(mddev));
1378 return err;
1369} 1379}
1370 1380
1371static void unbind_rdev_from_array(mdk_rdev_t * rdev) 1381static void unbind_rdev_from_array(mdk_rdev_t * rdev)
@@ -2966,7 +2976,9 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
2966 mddev->kobj.k_name = NULL; 2976 mddev->kobj.k_name = NULL;
2967 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); 2977 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md");
2968 mddev->kobj.ktype = &md_ktype; 2978 mddev->kobj.ktype = &md_ktype;
2969 kobject_register(&mddev->kobj); 2979 if (kobject_register(&mddev->kobj))
2980 printk(KERN_WARNING "md: cannot register %s/md - name in use\n",
2981 disk->disk_name);
2970 return NULL; 2982 return NULL;
2971} 2983}
2972 2984
@@ -3144,9 +3156,12 @@ static int do_md_run(mddev_t * mddev)
3144 bitmap_destroy(mddev); 3156 bitmap_destroy(mddev);
3145 return err; 3157 return err;
3146 } 3158 }
3147 if (mddev->pers->sync_request) 3159 if (mddev->pers->sync_request) {
3148 sysfs_create_group(&mddev->kobj, &md_redundancy_group); 3160 if (sysfs_create_group(&mddev->kobj, &md_redundancy_group))
3149 else if (mddev->ro == 2) /* auto-readonly not meaningful */ 3161 printk(KERN_WARNING
3162 "md: cannot register extra attributes for %s\n",
3163 mdname(mddev));
3164 } else if (mddev->ro == 2) /* auto-readonly not meaningful */
3150 mddev->ro = 0; 3165 mddev->ro = 0;
3151 3166
3152 atomic_set(&mddev->writes_pending,0); 3167 atomic_set(&mddev->writes_pending,0);
@@ -3160,7 +3175,9 @@ static int do_md_run(mddev_t * mddev)
3160 if (rdev->raid_disk >= 0) { 3175 if (rdev->raid_disk >= 0) {
3161 char nm[20]; 3176 char nm[20];
3162 sprintf(nm, "rd%d", rdev->raid_disk); 3177 sprintf(nm, "rd%d", rdev->raid_disk);
3163 sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); 3178 if (sysfs_create_link(&mddev->kobj, &rdev->kobj, nm))
3179 printk("md: cannot register %s for %s\n",
3180 nm, mdname(mddev));
3164 } 3181 }
3165 3182
3166 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 3183 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
@@ -5386,8 +5403,12 @@ static int remove_and_add_spares(mddev_t *mddev)
5386 if (mddev->pers->hot_add_disk(mddev,rdev)) { 5403 if (mddev->pers->hot_add_disk(mddev,rdev)) {
5387 char nm[20]; 5404 char nm[20];
5388 sprintf(nm, "rd%d", rdev->raid_disk); 5405 sprintf(nm, "rd%d", rdev->raid_disk);
5389 sysfs_create_link(&mddev->kobj, 5406 if (sysfs_create_link(&mddev->kobj,
5390 &rdev->kobj, nm); 5407 &rdev->kobj, nm))
5408 printk(KERN_WARNING
5409 "md: cannot register "
5410 "%s for %s\n",
5411 nm, mdname(mddev));
5391 spares++; 5412 spares++;
5392 md_new_event(mddev); 5413 md_new_event(mddev);
5393 } else 5414 } else