aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-10-03 04:15:59 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-03 11:04:18 -0400
commite8703fe1f5cdcff686f7eb0a46487b5a04a9324a (patch)
tree3b52bfa6ee57d59e059fd0e8d8504dbd3ee073b4 /drivers/md/md.c
parentd33a56d3639eba077489c937943a32ef6237b1b8 (diff)
[PATCH] md: remove MAX_MD_DEVS which is an arbitrary limit
Once upon a time we needed to fixed limit to the number of md devices, probably because we preallocated some array. This need no longer exists, but we still have an arbitrary limit. So remove MAX_MD_DEVS and allow as many devices as we can fit into the 'minor' part of a device number. Also remove some useless noise at init time (which reports MAX_MD_DEVS) and remove MD_THREAD_NAME_MAX which hasn't been used for a while. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index db1ac84a739a..40cb79ac4039 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -3409,6 +3409,7 @@ static void autorun_devices(int part)
3409 3409
3410 printk(KERN_INFO "md: autorun ...\n"); 3410 printk(KERN_INFO "md: autorun ...\n");
3411 while (!list_empty(&pending_raid_disks)) { 3411 while (!list_empty(&pending_raid_disks)) {
3412 int unit;
3412 dev_t dev; 3413 dev_t dev;
3413 LIST_HEAD(candidates); 3414 LIST_HEAD(candidates);
3414 rdev0 = list_entry(pending_raid_disks.next, 3415 rdev0 = list_entry(pending_raid_disks.next,
@@ -3428,16 +3429,19 @@ static void autorun_devices(int part)
3428 * mostly sane superblocks. It's time to allocate the 3429 * mostly sane superblocks. It's time to allocate the
3429 * mddev. 3430 * mddev.
3430 */ 3431 */
3431 if (rdev0->preferred_minor < 0 || rdev0->preferred_minor >= MAX_MD_DEVS) { 3432 if (part) {
3433 dev = MKDEV(mdp_major,
3434 rdev0->preferred_minor << MdpMinorShift);
3435 unit = MINOR(dev) >> MdpMinorShift;
3436 } else {
3437 dev = MKDEV(MD_MAJOR, rdev0->preferred_minor);
3438 unit = MINOR(dev);
3439 }
3440 if (rdev0->preferred_minor != unit) {
3432 printk(KERN_INFO "md: unit number in %s is bad: %d\n", 3441 printk(KERN_INFO "md: unit number in %s is bad: %d\n",
3433 bdevname(rdev0->bdev, b), rdev0->preferred_minor); 3442 bdevname(rdev0->bdev, b), rdev0->preferred_minor);
3434 break; 3443 break;
3435 } 3444 }
3436 if (part)
3437 dev = MKDEV(mdp_major,
3438 rdev0->preferred_minor << MdpMinorShift);
3439 else
3440 dev = MKDEV(MD_MAJOR, rdev0->preferred_minor);
3441 3445
3442 md_probe(dev, NULL, NULL); 3446 md_probe(dev, NULL, NULL);
3443 mddev = mddev_find(dev); 3447 mddev = mddev_find(dev);
@@ -5524,22 +5528,15 @@ static void md_geninit(void)
5524 5528
5525static int __init md_init(void) 5529static int __init md_init(void)
5526{ 5530{
5527 printk(KERN_INFO "md: md driver %d.%d.%d MAX_MD_DEVS=%d,"
5528 " MD_SB_DISKS=%d\n",
5529 MD_MAJOR_VERSION, MD_MINOR_VERSION,
5530 MD_PATCHLEVEL_VERSION, MAX_MD_DEVS, MD_SB_DISKS);
5531 printk(KERN_INFO "md: bitmap version %d.%d\n", BITMAP_MAJOR_HI,
5532 BITMAP_MINOR);
5533
5534 if (register_blkdev(MAJOR_NR, "md")) 5531 if (register_blkdev(MAJOR_NR, "md"))
5535 return -1; 5532 return -1;
5536 if ((mdp_major=register_blkdev(0, "mdp"))<=0) { 5533 if ((mdp_major=register_blkdev(0, "mdp"))<=0) {
5537 unregister_blkdev(MAJOR_NR, "md"); 5534 unregister_blkdev(MAJOR_NR, "md");
5538 return -1; 5535 return -1;
5539 } 5536 }
5540 blk_register_region(MKDEV(MAJOR_NR, 0), MAX_MD_DEVS, THIS_MODULE, 5537 blk_register_region(MKDEV(MAJOR_NR, 0), 1UL<<MINORBITS, THIS_MODULE,
5541 md_probe, NULL, NULL); 5538 md_probe, NULL, NULL);
5542 blk_register_region(MKDEV(mdp_major, 0), MAX_MD_DEVS<<MdpMinorShift, THIS_MODULE, 5539 blk_register_region(MKDEV(mdp_major, 0), 1UL<<MINORBITS, THIS_MODULE,
5543 md_probe, NULL, NULL); 5540 md_probe, NULL, NULL);
5544 5541
5545 register_reboot_notifier(&md_notifier); 5542 register_reboot_notifier(&md_notifier);
@@ -5598,8 +5595,8 @@ static __exit void md_exit(void)
5598 mddev_t *mddev; 5595 mddev_t *mddev;
5599 struct list_head *tmp; 5596 struct list_head *tmp;
5600 5597
5601 blk_unregister_region(MKDEV(MAJOR_NR,0), MAX_MD_DEVS); 5598 blk_unregister_region(MKDEV(MAJOR_NR,0), 1U << MINORBITS);
5602 blk_unregister_region(MKDEV(mdp_major,0), MAX_MD_DEVS << MdpMinorShift); 5599 blk_unregister_region(MKDEV(mdp_major,0), 1U << MINORBITS);
5603 5600
5604 unregister_blkdev(MAJOR_NR,"md"); 5601 unregister_blkdev(MAJOR_NR,"md");
5605 unregister_blkdev(mdp_major, "mdp"); 5602 unregister_blkdev(mdp_major, "mdp");