Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=20a8143eaa3300a58326156eaf43e03db0fd2cb6
Commit:     20a8143eaa3300a58326156eaf43e03db0fd2cb6
Parent:     53a7a1bb438245cd2ef9674b9af3a5201d7d7657
Author:     Paul Clements <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 8 04:21:51 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Feb 8 09:22:41 2008 -0800

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/block/nbd.c |   10 ++++------
 include/linux/nbd.h |    1 -
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index ae31060..018753c 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -54,7 +54,7 @@ static unsigned int debugflags;
 #endif /* NDEBUG */
 
 static unsigned int nbds_max = 16;
-static struct nbd_device nbd_dev[MAX_NBD];
+static struct nbd_device *nbd_dev;
 
 /*
  * Use just one lock (or at most 1 per NIC). Two arguments for this:
@@ -649,11 +649,9 @@ static int __init nbd_init(void)
 
        BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
 
-       if (nbds_max > MAX_NBD) {
-               printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u 
requested.\n", MAX_NBD,
-                               nbds_max);
-               return -EINVAL;
-       }
+       nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL);
+       if (!nbd_dev)
+               return -ENOMEM;
 
        for (i = 0; i < nbds_max; i++) {
                struct gendisk *disk = alloc_disk(1);
diff --git a/include/linux/nbd.h b/include/linux/nbd.h
index cc2b472..9865720 100644
--- a/include/linux/nbd.h
+++ b/include/linux/nbd.h
@@ -35,7 +35,6 @@ enum {
 };
 
 #define nbd_cmd(req) ((req)->cmd[0])
-#define MAX_NBD 128
 
 /* userspace doesn't need the nbd_device structure */
 #ifdef __KERNEL__
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to