From: "Ken Chen" <kenchen@google.com>
To: "Al Viro" <viro@ftp.linux.org.uk>
Cc: akpm@linux-foundation.org, mm-commits@vger.kernel.org,
viro@zeniv.linux.org.uk, linux-kernel@vger.kernel.org
Subject: Re: + loop-preallocate-eight-loop-devices.patch added to -mm tree
Date: Mon, 21 May 2007 19:14:50 -0700 [thread overview]
Message-ID: <b040c32a0705211914w3843bd46o542476be97e0b6cf@mail.gmail.com> (raw)
In-Reply-To: <20070522014822.GF4095@ftp.linux.org.uk>
On 5/21/07, Al Viro <viro@ftp.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?
next prev parent reply other threads:[~2007-05-22 2:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200705212200.l4LM0tYK021050@shell0.pdx.osdl.net>
2007-05-22 0:18 ` Al Viro
2007-05-22 1:30 ` Ken Chen
2007-05-22 1:48 ` Al Viro
2007-05-22 2:14 ` Ken Chen [this message]
2007-05-22 2:40 ` Ken Chen
2007-05-22 4:18 ` Al Viro
2007-05-31 16:05 ` walt
2007-05-31 16:51 ` Ken Chen
2007-05-31 18:10 ` Andrew Morton
2007-05-31 18:23 ` Ken Chen
2007-05-31 18:34 ` Andrew Morton
2007-06-01 16:29 ` Ken Chen
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=b040c32a0705211914w3843bd46o542476be97e0b6cf@mail.gmail.com \
--to=kenchen@google.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=viro@ftp.linux.org.uk \
--cc=viro@zeniv.linux.org.uk \
/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®