On Mar 22 2007 14:42, Eric Dumazet wrote: >Instead of using : > >static struct loop_device *loop_dev; >loop_dev = kmalloc(max_loop * sizeof(struct loop_device)); > >Switch to : > >static struct loop_device **loop_dev; >loop_dev = kmalloc(max_loop * sizeof(void *)); >if (!loop_dev) rollback... >for (i = 0 ; i < max_loop ; i++) { > loop_dev[i] = kmalloc(sizeof(struct loop_device)); > if (!loop_dev[i]) rollback... >} > >This time, you would be limited to 16384 loop devices on x86_64, 32768 on i386 >:)
Oh noes. Please use a linked list (kmalloc cope = perfect) if you really need loads of loopdevs. Sorta struct loopdev { struct list_head lh; int lo_number; }; to keep the /dev/loop%d number consistent across loopdev removal. Maybe it's better to even use an rbtree (linked list does not scale to it). Jan -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/