netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Arjan van de Ven <arjan@infradead.org>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	David VomLehn <dvomlehn@cisco.com>,
	<linux-kernel@vger.kernel.org>, <akpm@linux-foundation.org>,
	<linux-usb@vger.kernel.org>, <greg@kroah.com>,
	<linux-scsi@vger.kernel.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH 1/5] initdev:kernel: Asynchronously-discovered device synchronization, v5
Date: Tue, 5 May 2009 23:47:25 +0800	[thread overview]
Message-ID: <20090505234725.5ab247db@linux-lm> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0905041100500.3092-100000@iolanthe.rowland.org>

On Mon, 4 May 2009 11:07:52 -0400 (EDT)
Alan Stern <stern@rowland.harvard.edu> wrote:

> On Mon, 4 May 2009, Arjan van de Ven wrote:
> 
> > > > for normal device probing we already have infrastructure
> > > > though... wait_for_device_probe, driver_probe_done and
> > > > friends... (the scsi scanning thread is being converted to the
> > > > async infrastructure btw)
> > > > 
> > > > do we need to invent more ?
> > > 
> > > I suppose the usb-storage scanning thread could also be converted
> > > to the async infrastructure, although I haven't heard of anybody
> > > working on it.
> > > 
> > > But the USB hub driver's thread (khubd) cannot be converted.  It
> > > is central to the discovery of USB-based block devices.  How
> > > would you handle that?
> > 
> > take a ref in the driver_probe_done() sense, and release it when you
> > know you're done probing....
> > 
> > at that point all existing infrastructure will just work.
> 
> Isn't there still something missing?  The wait_for_device_probe()  
> routine would wait until all attached devices had been probed.  But
> why should prepare_namespace() have to wait that long?  Wouldn't it be
> better to wait only until the root device has been registered?

Yes, maybe David should merge the following patch into the patch
No.5(initdev:kernel: USB and SCSI block init device notification, v3).

Right?

diff --git a/init/do_mounts.c b/init/do_mounts.c
index dd7ee5f..22fd773 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -358,6 +358,12 @@ void __init mount_root(void)
 #endif
 }
 
+static int root_dev_done()
+{
+	return !!(ROOT_DEV = name_to_dev_t(saved_root_name));
+}
+
+
 /*
  * Prepare the namespace - decide what/where to mount, load ramdisks,
etc. */
@@ -398,12 +404,12 @@ void __init prepare_namespace(void)
 		goto out;
 
 	/* wait for any asynchronous scanning to complete */
-	if ((ROOT_DEV == 0) && root_wait) {
+	if (ROOT_DEV == 0 && root_wait) {
 		printk(KERN_INFO "Waiting for root device %s...\n",
 			saved_root_name);
-		while (driver_probe_done() != 0 ||
-			(ROOT_DEV = name_to_dev_t(saved_root_name)) ==
0)
-			msleep(100);
+		do {
+			initdev_wait(BOOTDEV_BLOCK, root_dev_done);
+		} while (!ROOT_DEV);
 		async_synchronize_full();
 	}
 



-- 
Lei Ming

  reply	other threads:[~2009-05-05 15:47 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-02  2:25 [PATCH 1/5] initdev:kernel: Asynchronously-discovered device synchronization, v5 David VomLehn
     [not found] ` <20090502022551.GA15600-CFZJ1or75eBPWxJt6d6B6bQa8qPdvLwY@public.gmane.org>
2009-05-02 13:31   ` Sergey Vlasov
     [not found]     ` <20090502133153.GA8116-2JxNCdI+WHxBDLzU/O5InQ@public.gmane.org>
2009-05-02 14:16       ` Alan Stern
     [not found]         ` <Pine.LNX.4.44L0.0905021010200.23879-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2009-05-05  0:33           ` David VomLehn
2009-05-05  0:31     ` [PATCH 1/5] initdev:kernel: Asynchronously-discovered devicesynchronization, v5 David VomLehn
2009-05-02 14:01   ` [PATCH 1/5] initdev:kernel: Asynchronously-discovered device synchronization, v5 James Bottomley
     [not found]     ` <1241272876.3639.27.camel-0iu6Cu4xQGLV0bN/WMK0Sm4KqUE0Tg80jeSHHoATDr/QT0dZR+AlfA@public.gmane.org>
2009-05-02 17:55       ` Alan Stern
2009-05-03 23:21         ` Arjan van de Ven
     [not found]           ` <20090503162115.2dff79bd-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2009-05-04 14:30             ` Alan Stern
     [not found]               ` <Pine.LNX.4.44L0.0905041026560.2961-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2009-05-04 14:45                 ` Arjan van de Ven
2009-05-04 15:07                   ` Alan Stern
2009-05-05 15:47                     ` Ming Lei [this message]
2009-05-05 15:53                       ` Ming Lei
     [not found]                         ` <d82e647a0905050853q4a1d5066ib71411cbef186c45-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-05 18:00                           ` David VomLehn
2009-06-05 17:58                       ` David VomLehn
     [not found]         ` <Pine.LNX.4.44L0.0905021335150.26241-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2009-05-05  0:55           ` David VomLehn

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=20090505234725.5ab247db@linux-lm \
    --to=tom.leiming@gmail.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=dvomlehn@cisco.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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;
as well as URLs for NNTP newsgroup(s).