Skip to content

Commit

Permalink
NBD: remove limit on max number of nbd devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Clements authored and Linus Torvalds committed Feb 8, 2008
1 parent 53a7a1b commit 20a8143
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 4 additions & 6 deletions drivers/block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion include/linux/nbd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down

0 comments on commit 20a8143

Please sign in to comment.