From patchwork Tue May 5 15:47:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 26878 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 3C37EB7043 for ; Wed, 6 May 2009 01:47:51 +1000 (EST) Received: by ozlabs.org (Postfix) id 29F1FDDDF0; Wed, 6 May 2009 01:47:51 +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 BB5DFDDDB6 for ; Wed, 6 May 2009 01:47:50 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752612AbZEEPrm (ORCPT ); Tue, 5 May 2009 11:47:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752970AbZEEPrl (ORCPT ); Tue, 5 May 2009 11:47:41 -0400 Received: from wf-out-1314.google.com ([209.85.200.175]:7821 "EHLO wf-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751975AbZEEPrj (ORCPT ); Tue, 5 May 2009 11:47:39 -0400 Received: by wf-out-1314.google.com with SMTP id 26so3885539wfd.4 for ; Tue, 05 May 2009 08:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:in-reply-to:references:x-mailer:mime-version :content-type:content-transfer-encoding; bh=Y8/duQMrtp5zR8zVvjUaATDO8GxfAoJBMzLdVKKTfYc=; b=NxTr4R3vz9KTcISngaAwKluEhkR61296g8dccQ4ajWb2Oscm7Kggs2hjGCP6R9a+/S +eYww1eR/jH7TyS6rNKBrGeUPTCMyFJf8GeculaOfBr25WudWcFHVmWyuibv23rgM/vH dpQbQ5/oVH3SuPGdF9Q5+6/fI5VKmA+d0p2cU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; b=b4A8+m8xVUIx+2bRix5ANJ48ATe4oiAeQFQRnl3XiXRZlXp7A/tvZg0v6b7ZZM6wtz i9GlGAMh9YwUY5KekZkRnAFJPXuUSEx8QauL988X1Vef98LkegIZpFogotrjFV1cY6CV OfsZZD1pPEPxy+DrfLu6QrC6LvxxhYFj9Eubo= Received: by 10.142.125.11 with SMTP id x11mr70820wfc.32.1241538459892; Tue, 05 May 2009 08:47:39 -0700 (PDT) Received: from linux-lm ([119.122.174.17]) by mx.google.com with ESMTPS id 28sm1260230wfd.23.2009.05.05.08.47.32 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 05 May 2009 08:47:39 -0700 (PDT) Date: Tue, 5 May 2009 23:47:25 +0800 From: Ming Lei To: Alan Stern Cc: Arjan van de Ven , James Bottomley , David VomLehn , , , , , , Subject: Re: [PATCH 1/5] initdev:kernel: Asynchronously-discovered device synchronization, v5 Message-ID: <20090505234725.5ab247db@linux-lm> In-Reply-To: References: <20090504074522.13f1ed77@infradead.org> X-Mailer: Claws Mail 3.7.1 (GTK+ 2.14.4; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, 4 May 2009 11:07:52 -0400 (EDT) Alan Stern 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(); }