LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/1] NBD: raise max number of nbd devices to 1024
@ 2008-01-29 21:30 Paul Clements
2008-01-29 21:54 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Paul Clements @ 2008-01-29 21:30 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 53 bytes --]
The limit was 128. This changes it to 1024.
--
Paul
[-- Attachment #2: nbd_max_nbd_1024.diff --]
[-- Type: text/x-patch, Size: 380 bytes --]
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 14:35:17.000000000 -0500
@@ -35,7 +35,7 @@ enum {
};
#define nbd_cmd(req) ((req)->cmd[0])
-#define MAX_NBD 128
+#define MAX_NBD 1024
/* userspace doesn't need the nbd_device structure */
#ifdef __KERNEL__
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] NBD: raise max number of nbd devices to 1024
2008-01-29 21:30 [PATCH 1/1] NBD: raise max number of nbd devices to 1024 Paul Clements
@ 2008-01-29 21:54 ` Andrew Morton
2008-01-30 2:04 ` Paul Clements
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2008-01-29 21:54 UTC (permalink / raw)
To: Paul Clements; +Cc: linux-kernel
On Tue, 29 Jan 2008 16:30:58 -0500
Paul Clements <paul.clements@steeleye.com> wrote:
> The limit was 128. This changes it to 1024.
>
Please include the "why" in changelogs as well as the "what". It's fairly
easy to guess why this needs to be increased, but it would be useful and
interesting to hear about the operational scenarios in which 128 was
insufficient.
>
> --- ./include/linux/nbd.h.TIMEOUT 2007-08-22 13:18:12.000000000 -0400
> +++ ./include/linux/nbd.h 2008-01-29 14:35:17.000000000 -0500
> @@ -35,7 +35,7 @@ enum {
> };
>
> #define nbd_cmd(req) ((req)->cmd[0])
> -#define MAX_NBD 128
> +#define MAX_NBD 1024
>
> /* userspace doesn't need the nbd_device structure */
> #ifdef __KERNEL__
>
But one still needs to specify the nbds_max module parameter.
Can't we just nuke MAX_NBD altogether?
--- a/drivers/block/nbd.c~a
+++ a/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:
@@ -651,12 +651,6 @@ 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;
- }
-
for (i = 0; i < nbds_max; i++) {
struct gendisk *disk = alloc_disk(1);
if (!disk)
@@ -715,6 +709,10 @@ out:
static void __exit nbd_cleanup(void)
{
int i;
+
+ 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 = nbd_dev[i].disk;
nbd_dev[i].magic = 0;
diff -puN include/linux/nbd.h~a include/linux/nbd.h
--- a/include/linux/nbd.h~a
+++ a/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__
_
much nicer?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] NBD: raise max number of nbd devices to 1024
2008-01-29 21:54 ` Andrew Morton
@ 2008-01-30 2:04 ` Paul Clements
2008-01-30 2:08 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Paul Clements @ 2008-01-30 2:04 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 277 bytes --]
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
[-- Attachment #2: nbd_max_nbd_killed.diff --]
[-- Type: text/x-patch, Size: 1189 bytes --]
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);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] NBD: raise max number of nbd devices to 1024
2008-01-30 2:04 ` Paul Clements
@ 2008-01-30 2:08 ` Andrew Morton
2008-01-30 13:14 ` Paul Clements
0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2008-01-30 2:08 UTC (permalink / raw)
To: Paul Clements; +Cc: linux-kernel
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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] NBD: raise max number of nbd devices to 1024
2008-01-30 2:08 ` Andrew Morton
@ 2008-01-30 13:14 ` Paul Clements
0 siblings, 0 replies; 5+ messages in thread
From: Paul Clements @ 2008-01-30 13:14 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 775 bytes --]
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?
>
[-- Attachment #2: nbd_max_nbd_killed.diff --]
[-- Type: text/x-patch, Size: 1428 bytes --]
[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);
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-01-30 13:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-29 21:30 [PATCH 1/1] NBD: raise max number of nbd devices to 1024 Paul Clements
2008-01-29 21:54 ` Andrew Morton
2008-01-30 2:04 ` Paul Clements
2008-01-30 2:08 ` Andrew Morton
2008-01-30 13:14 ` Paul Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).