mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 7/7] initdev:kernel:Await block device discovery
@ 2009-06-06  2:34 David VomLehn
  2009-06-06 10:04 ` Stefan Richter
  0 siblings, 1 reply; 5+ messages in thread
From: David VomLehn @ 2009-06-06  2:34 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, linux-usb, greg, linux-scsi, netdev, arjan

Use the initdev infrastructure to wait for a root device to become available.
This should make most uses of the kernel rootwait parameter unnecessary. The
only time it should be necessary is when the root device might not be attached
at boot time.

Signed-off-by: David VomLehn <dvomlehn@cisco>
---
 init/do_mounts.c |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index dd7ee5f..36a92ae 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -358,6 +358,18 @@ void __init mount_root(void)
 #endif
 }
 
+/**
+ * root_present - determine whether the root device is available yet
+ *
+ * Returns true if the root device is available, false if not. The check to
+ * see if the root device is available is done by check to see whether it
+ * has been assigned a major/minor device number.
+ */
+static bool root_present(void)
+{
+	return name_to_dev_t(saved_root_name) != 0;
+}
+
 /*
  * Prepare the namespace - decide what/where to mount, load ramdisks, etc.
  */
@@ -398,12 +410,21 @@ void __init prepare_namespace(void)
 		goto out;
 
 	/* wait for any asynchronous scanning to complete */
-	if ((ROOT_DEV == 0) && root_wait) {
+	if (ROOT_DEV == 0) {
 		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);
+		if (root_wait) {
+			while (driver_probe_done() != 0 ||
+				(ROOT_DEV = name_to_dev_t(saved_root_name)) ==
+					0)
+				msleep(100);
+		}
+
+		else {
+			initdev_wait(INITDEV_BLOCK_TYPE, root_present);
+			ROOT_DEV = name_to_dev_t(saved_root_name);
+		}
+
 		async_synchronize_full();
 	}
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-06-08 23:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-06  2:34 [PATCH 7/7] initdev:kernel:Await block device discovery David VomLehn
2009-06-06 10:04 ` Stefan Richter
2009-06-08 22:30   ` David VomLehn
2009-06-08 22:55     ` Stefan Richter
2009-06-08 23:13       ` David VomLehn

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®