lkml.org 
[lkml]   [2008]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/1] NBD: raise max number of nbd devices to 1024
Andrew Morton wrote:
> On Tue, 29 Jan 2008 21:04:05 -0500 Paul Clements <paul.clements@steeleye.com> wrote:
>
>> Andrew Morton wrote:
>>
>> <snip>
>>
>>> much nicer?
>> OK, yes, I was going for quick and easy, but you've got a point...
>>
>> We do need to move the kcalloc into nbd_init instead of nbd_cleanup,
>> though -- that works a little better. Patch is attached. Thanks for the
>> suggestion.
>>
>> --
>> Paul
>>
>>
>> [nbd_max_nbd_killed.diff text/x-patch (1.2KB)]
>>
>> Signed-Off-By: Paul Clements <paul.clements@steeleye.com>
>>
>> --- ./include/linux/nbd.h.TIMEOUT 2007-08-22 13:18:12.000000000 -0400
>> +++ ./include/linux/nbd.h 2008-01-29 20:01:33.000000000 -0500
>
> Could we have a complete changelog please? As I mentioned in the
> earlier email?
>


[PATCH 1/1] 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>

--- ./include/linux/nbd.h.TIMEOUT 2007-08-22 13:18:12.000000000 -0400
+++ ./include/linux/nbd.h 2008-01-29 20:01:33.000000000 -0500
@@ -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__
--- ./drivers/block/nbd.c.ORIG 2008-01-29 20:01:12.000000000 -0500
+++ ./drivers/block/nbd.c 2008-01-29 20:08:30.000000000 -0500
@@ -53,7 +53,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:
@@ -659,11 +659,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);
\
 
 \ /
  Last update: 2008-01-30 14:17    [W:0.050 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site