[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b040c32a0705211914w3843bd46o542476be97e0b6cf@mail.gmail.com>
Date: Mon, 21 May 2007 19:14:50 -0700
From: "Ken Chen" <kenchen@...gle.com>
To: "Al Viro" <viro@....linux.org.uk>
Cc: akpm@...ux-foundation.org, mm-commits@...r.kernel.org,
viro@...iv.linux.org.uk, linux-kernel@...r.kernel.org
Subject: Re: + loop-preallocate-eight-loop-devices.patch added to -mm tree
On 5/21/07, Al Viro <viro@....linux.org.uk> 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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists