--- linux/drivers/block/loop_old.c 2007-02-04 18:44:54.000000000 +0000 +++ linux/drivers/block/loop.c 2007-03-22 08:31:55.000000000 +0000 @@ -44,6 +44,16 @@ * backing filesystem. * Anton Altaparmakov, 16 Feb 2005 * + * The maximum amount of loop devices has been 255 for many years, while there + * is a lot of space for more. The maximum depends on max memory available + * from kmalloc, which is usually 128KB, but can be even more. + * I removed the test if (max_loop > 255), so now we support much more loop + * devices then before; it probably depends on: + * NR_CPUS, MAX_NUMNODES, CONFIG_MMU and CONFIG_LARGE_ALLOCS. + * Information: The maximum max_loop is 455 if kmalloc handles only 128KB. + * If kmalloc can't allocate enough RAM, loop is simply unloaded. + * Author: Tomas Matejicek, www.slax.org, 21 Mar 2007 + * * Still To Fix: * - Advisory locking is ignored here. * - Should use an own CAP_* category instead of CAP_SYS_ADMIN @@ -1358,7 +1368,7 @@ * 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-455 on i386)"); MODULE_LICENSE("GPL"); MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR); @@ -1402,9 +1412,9 @@ { int i; - if (max_loop < 1 || max_loop > 256) { - printk(KERN_WARNING "loop: invalid max_loop (must be between" - " 1 and 256), using default (8)\n"); + if (max_loop < 1) { + printk(KERN_WARNING "loop: invalid max_loop (must be at least 1" + ", using default (8)\n"); max_loop = 8; } @@ -1465,7 +1475,7 @@ kfree(loop_dev); out_mem1: unregister_blkdev(LOOP_MAJOR, "loop"); - printk(KERN_ERR "loop: ran out of memory\n"); + printk(KERN_ERR "loop: ran out of memory for max_loop=%d\n", max_loop); return -ENOMEM; }