aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/nbd.c
diff options
context:
space:
mode:
authorPaul Clements <paul.clements@steeleye.com>2008-02-08 07:21:51 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:41 -0500
commit20a8143eaa3300a58326156eaf43e03db0fd2cb6 (patch)
treeee12300f417f0ecbaa4879b62a19a09423de76b3 /drivers/block/nbd.c
parent53a7a1bb438245cd2ef9674b9af3a5201d7d7657 (diff)
NBD: remove limit on max number of nbd devices
Remove the arbitrary 128 device limit for NBD. nbds_max can now be set to any number. In certain scenarios where devices are used sparsely we have run into the 128 device limit. Signed-off-by: Paul Clements <paul.clements@steeleye.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/nbd.c')
-rw-r--r--drivers/block/nbd.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index ae3106045ee5..018753c59b8e 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -54,7 +54,7 @@ static unsigned int debugflags;
54#endif /* NDEBUG */ 54#endif /* NDEBUG */
55 55
56static unsigned int nbds_max = 16; 56static unsigned int nbds_max = 16;
57static struct nbd_device nbd_dev[MAX_NBD]; 57static struct nbd_device *nbd_dev;
58 58
59/* 59/*
60 * Use just one lock (or at most 1 per NIC). Two arguments for this: 60 * Use just one lock (or at most 1 per NIC). Two arguments for this:
@@ -649,11 +649,9 @@ static int __init nbd_init(void)
649 649
650 BUILD_BUG_ON(sizeof(struct nbd_request) != 28); 650 BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
651 651
652 if (nbds_max > MAX_NBD) { 652 nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
653 printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD, 653 if (!nbd_dev)
654 nbds_max); 654 return -ENOMEM;
655 return -EINVAL;
656 }
657 655
658 for (i = 0; i < nbds_max; i++) { 656 for (i = 0; i < nbds_max; i++) {
659 struct gendisk *disk = alloc_disk(1); 657 struct gendisk *disk = alloc_disk(1);