aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--drivers/md/md.c33
-rw-r--r--include/linux/raid/md_k.h5
-rw-r--r--init/do_mounts_md.c8
3 files changed, 18 insertions, 28 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");
diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h
index e423dad1a7fd..8245c282168b 100644
--- a/include/linux/raid/md_k.h
+++ b/include/linux/raid/md_k.h
@@ -31,18 +31,15 @@
31#define LEVEL_NONE (-1000000) 31#define LEVEL_NONE (-1000000)
32 32
33#define MaxSector (~(sector_t)0) 33#define MaxSector (~(sector_t)0)
34#define MD_THREAD_NAME_MAX 14
35 34
36typedef struct mddev_s mddev_t; 35typedef struct mddev_s mddev_t;
37typedef struct mdk_rdev_s mdk_rdev_t; 36typedef struct mdk_rdev_s mdk_rdev_t;
38 37
39#define MAX_MD_DEVS 256 /* Max number of md dev */
40
41/* 38/*
42 * options passed in raidrun: 39 * options passed in raidrun:
43 */ 40 */
44 41
45/* Currently this must fix in an 'int' */ 42/* Currently this must fit in an 'int' */
46#define MAX_CHUNK_SIZE (1<<30) 43#define MAX_CHUNK_SIZE (1<<30)
47 44
48/* 45/*
diff --git a/init/do_mounts_md.c b/init/do_mounts_md.c
index 2429e1bf8c60..753dc54a6649 100644
--- a/init/do_mounts_md.c
+++ b/init/do_mounts_md.c
@@ -20,7 +20,7 @@ static struct {
20 int level; 20 int level;
21 int chunk; 21 int chunk;
22 char *device_names; 22 char *device_names;
23} md_setup_args[MAX_MD_DEVS] __initdata; 23} md_setup_args[256] __initdata;
24 24
25static int md_setup_ents __initdata; 25static int md_setup_ents __initdata;
26 26
@@ -61,10 +61,6 @@ static int __init md_setup(char *str)
61 return 0; 61 return 0;
62 } 62 }
63 str1 = str; 63 str1 = str;
64 if (minor >= MAX_MD_DEVS) {
65 printk(KERN_WARNING "md: md=%d, Minor device number too high.\n", minor);
66 return 0;
67 }
68 for (ent=0 ; ent< md_setup_ents ; ent++) 64 for (ent=0 ; ent< md_setup_ents ; ent++)
69 if (md_setup_args[ent].minor == minor && 65 if (md_setup_args[ent].minor == minor &&
70 md_setup_args[ent].partitioned == partitioned) { 66 md_setup_args[ent].partitioned == partitioned) {
@@ -72,7 +68,7 @@ static int __init md_setup(char *str)
72 "Replacing previous definition.\n", partitioned?"d":"", minor); 68 "Replacing previous definition.\n", partitioned?"d":"", minor);
73 break; 69 break;
74 } 70 }
75 if (ent >= MAX_MD_DEVS) { 71 if (ent >= ARRAY_SIZE(md_setup_args)) {
76 printk(KERN_WARNING "md: md=%s%d - too many md initialisations\n", partitioned?"d":"", minor); 72 printk(KERN_WARNING "md: md=%s%d - too many md initialisations\n", partitioned?"d":"", minor);
77 return 0; 73 return 0;
78 } 74 }