From patchwork Tue Aug 4 22:15:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David VomLehn X-Patchwork-Id: 30753 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 6397FB6EDE for ; Wed, 5 Aug 2009 08:18:29 +1000 (EST) Received: by ozlabs.org (Postfix) id 58BE3DDD0B; Wed, 5 Aug 2009 08:18:29 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id D3846DDD04 for ; Wed, 5 Aug 2009 08:18:28 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933481AbZHDWPi (ORCPT ); Tue, 4 Aug 2009 18:15:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933107AbZHDWPf (ORCPT ); Tue, 4 Aug 2009 18:15:35 -0400 Received: from sj-iport-6.cisco.com ([171.71.176.117]:37978 "EHLO sj-iport-6.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933143AbZHDWPc (ORCPT ); Tue, 4 Aug 2009 18:15:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAHdQeEqrR7MV/2dsb2JhbAC8PIgpkBUFhBg X-IronPort-AV: E=Sophos;i="4.43,324,1246838400"; d="scan'208";a="360440828" Received: from sj-dkim-1.cisco.com ([171.71.179.21]) by sj-iport-6.cisco.com with ESMTP; 04 Aug 2009 22:15:21 +0000 Received: from sj-core-2.cisco.com (sj-core-2.cisco.com [171.71.177.254]) by sj-dkim-1.cisco.com (8.12.11/8.12.11) with ESMTP id n74MFMhl012123; Tue, 4 Aug 2009 15:15:22 -0700 Received: from cuplxvomd02.corp.sa.net ([64.101.20.155]) by sj-core-2.cisco.com (8.13.8/8.14.3) with ESMTP id n74MFLoQ029419; Tue, 4 Aug 2009 22:15:21 GMT Date: Tue, 4 Aug 2009 15:15:21 -0700 From: David VomLehn To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, linux-usb@vger.kernel.org, greg@kroah.com, linux-scsi@vger.kernel.org, netdev@vger.kernel.org, arjan@infradead.org Subject: [PATCH 7/7 v1] initdev:kernel:Await block device discovery Message-ID: <20090804221521.GA9387@cuplxvomd02.corp.sa.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; l=1782; t=1249424122; x=1250288122; c=relaxed/simple; s=sjdkim1004; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=dvomlehn@cisco.com; z=From:=20David=20VomLehn=20 |Subject:=20[PATCH=207/7=20v1]=20initdev=3Akernel=3AAwait=2 0block=20device=20discovery |Sender:=20; bh=RLqZQaQwimvzy76A63KCBrPu4pwkYveK5yheVLyq99A=; b=gDAWGV2GmRXV3BnUhnTrVGCuqI7zoGfth1X7sWP+gIMp3PSa4POj39vA4u GtJKsB7a/wIr+a2BAFm4P9ffXBK2TxbjjySHkt8C6K6ohD1H9c9nl8ITPDRF DXG2vFIO+LbXriFVOizx+FCs/WpJkWGg/1NuKsynEf9M13ea/odqw=; Authentication-Results: sj-dkim-1; header.From=dvomlehn@cisco.com; dkim=pass ( sig from cisco.com/sjdkim1004 verified; ); Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- init/do_mounts.c | 29 +++++++++++++++++++++++++---- 1 files changed, 25 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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(); }