Re: + loop-preallocate-eight-loop-devices.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/21/07, Al Viro <[email protected]> wrote:
No, it doesn't.  Really.  It's easy to split; untested incremental to your
patch follows:

        for (i = 0; i < nr; i++) {
-               if (!loop_init_one(i))
-                       goto err;
+               lo = loop_alloc(i);
+               if (!lo)
+                       goto Enomem;
+               list_add_tail(&lo->lo_list, &loop_devices);
        }

ah, yes, use the loop_device list_head to link all the pending devices.


+       /* point of no return */
+
+       list_for_each_entry(lo, &loop_devices, lo_list)
+               add_disk(lo->lo_disk);
+
+       blk_register_region(MKDEV(LOOP_MAJOR, 0), range,
+                                 THIS_MODULE, loop_probe, NULL, NULL);
+
        printk(KERN_INFO "loop: module loaded\n");
        return 0;
-err:
-       loop_exit();
+
+Enomem:
        printk(KERN_INFO "loop: out of memory\n");
+
+       while(!list_empty(&loop_devices)) {
+               lo = list_entry(loop_devices.next, struct loop_device, lo_list);
+               loop_del_one(lo);
+       }
+
+       unregister_blkdev(LOOP_MAJOR, "loop");
        return -ENOMEM;
 }

I suppose the loop_del_one call in Enomem label needs to be split up
too since in the error path, it hasn't done add_disk() yet?
-
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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux