Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760180AbYA3NPF (ORCPT ); Wed, 30 Jan 2008 08:15:05 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756056AbYA3NOz (ORCPT ); Wed, 30 Jan 2008 08:14:55 -0500 Received: from hancock.steeleye.com ([71.30.118.248]:58173 "EHLO hancock.sc.steeleye.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756129AbYA3NOy (ORCPT ); Wed, 30 Jan 2008 08:14:54 -0500 Message-ID: <47A0784D.8090902@steeleye.com> Date: Wed, 30 Jan 2008 08:14:53 -0500 From: Paul Clements User-Agent: Swiftdove 2.0.0.9 (X11/20071116) MIME-Version: 1.0 To: Andrew Morton CC: linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] NBD: raise max number of nbd devices to 1024 References: <479F9B12.8010207@steeleye.com> <20080129135417.e20b8107.akpm@linux-foundation.org> <479FDB15.4090104@steeleye.com> <20080129180857.f8979300.akpm@linux-foundation.org> In-Reply-To: <20080129180857.f8979300.akpm@linux-foundation.org> Content-Type: multipart/mixed; boundary="------------010309010500020103030705" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2865 Lines: 94 This is a multi-part message in MIME format. --------------010309010500020103030705 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Andrew Morton wrote: > On Tue, 29 Jan 2008 21:04:05 -0500 Paul Clements wrote: > >> Andrew Morton wrote: >> >> >> >>> 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 >> >> --- ./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? > --------------010309010500020103030705 Content-Type: text/x-patch; name="nbd_max_nbd_killed.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="nbd_max_nbd_killed.diff" [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 --- ./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); --------------010309010500020103030705-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/