From: Keith Owens <kaos@ocs.com.au>
To: linux-kernel@vger.kernel.org
Subject: [patch 2.6.10-rc3] Configure the maximum number of loopback devices
Date: Fri, 10 Dec 2004 18:01:48 +1100 [thread overview]
Message-ID: <17387.1102662108@kao2.melbourne.sgi.com> (raw)
Linux juke box servers can have more than 256 images loaded, so make
the maximum number of loopback devices a config option. The default is
256 (no change).
Signed-off-by: Keith Owens <kaos@ocs.com.au>
Index: linux/drivers/block/Kconfig
===================================================================
--- linux.orig/drivers/block/Kconfig Thu Dec 9 16:52:50 2004
+++ linux/drivers/block/Kconfig Fri Dec 10 17:02:14 2004
@@ -251,6 +251,14 @@ config BLK_DEV_LOOP
Most users will answer N here.
+config BLK_DEV_LOOP_MAX
+ int "Maximum number of loopback devices" if BLK_DEV_LOOP
+ default "256"
+ help
+ The default maximum number of loopback devices is 256. Set a
+ larger maximum if you need more than 256 loopback mounts.
+ Most users should take the default value.
+
config BLK_DEV_CRYPTOLOOP
tristate "Cryptoloop Support"
select CRYPTO
Index: linux/drivers/block/loop.c
===================================================================
--- linux.orig/drivers/block/loop.c Thu Dec 9 16:52:27 2004
+++ linux/drivers/block/loop.c Fri Dec 10 17:48:49 2004
@@ -43,6 +43,9 @@
* - Advisory locking is ignored here.
* - Should use an own CAP_* category instead of CAP_SYS_ADMIN
*
+ * Make the maximum loop count a config variable.
+ * Keith Owens <kaos@ocs.com.au>, Dec 2004
+ *
*/
#include <linux/config.h>
@@ -67,6 +70,7 @@
#include <linux/writeback.h>
#include <linux/buffer_head.h> /* for invalidate_bdev() */
#include <linux/completion.h>
+#include <linux/vmalloc.h>
#include <asm/uaccess.h>
@@ -1074,7 +1078,7 @@ static struct block_device_operations lo
* And now the modules code and kernel interface.
*/
module_param(max_loop, int, 0);
-MODULE_PARM_DESC(max_loop, "Maximum number of loop devices (1-256)");
+MODULE_PARM_DESC(max_loop, "Maximum number of loop devices (1-" __stringify(CONFIG_BLK_DEV_LOOP_MAX) ")");
MODULE_LICENSE("GPL");
MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR);
@@ -1118,21 +1122,21 @@ int __init loop_init(void)
{
int i;
- if (max_loop < 1 || max_loop > 256) {
+ if (max_loop < 1 || max_loop > CONFIG_BLK_DEV_LOOP_MAX) {
printk(KERN_WARNING "loop: invalid max_loop (must be between"
- " 1 and 256), using default (8)\n");
+ " 1 and " __stringify(CONFIG_BLK_DEV_LOOP_MAX) "), using default (8)\n");
max_loop = 8;
}
if (register_blkdev(LOOP_MAJOR, "loop"))
return -EIO;
- loop_dev = kmalloc(max_loop * sizeof(struct loop_device), GFP_KERNEL);
+ loop_dev = vmalloc(max_loop * sizeof(*loop_dev));
if (!loop_dev)
goto out_mem1;
- memset(loop_dev, 0, max_loop * sizeof(struct loop_device));
+ memset(loop_dev, 0, max_loop * sizeof(*loop_dev));
- disks = kmalloc(max_loop * sizeof(struct gendisk *), GFP_KERNEL);
+ disks = vmalloc(max_loop * sizeof(*disks));
if (!disks)
goto out_mem2;
@@ -1180,9 +1184,9 @@ out_mem4:
out_mem3:
while (i--)
put_disk(disks[i]);
- kfree(disks);
+ vfree(disks);
out_mem2:
- kfree(loop_dev);
+ vfree(loop_dev);
out_mem1:
unregister_blkdev(LOOP_MAJOR, "loop");
printk(KERN_ERR "loop: ran out of memory\n");
@@ -1202,8 +1206,8 @@ void loop_exit(void)
if (unregister_blkdev(LOOP_MAJOR, "loop"))
printk(KERN_WARNING "loop: cannot unregister blkdev\n");
- kfree(disks);
- kfree(loop_dev);
+ vfree(disks);
+ vfree(loop_dev);
}
module_init(loop_init);
reply other threads:[~2004-12-10 7:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17387.1102662108@kao2.melbourne.sgi.com \
--to=kaos@ocs.com.au \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®