Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6813233imu; Mon, 21 Jan 2019 16:49:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN6N3i7QBY85bK+uoWMZ27NqU9Y0bI3Vcu7LvXe2I9vO0FnrFQJMJ1ndQLM2CD71tXpk6utP X-Received: by 2002:a62:3141:: with SMTP id x62mr31358022pfx.12.1548118154932; Mon, 21 Jan 2019 16:49:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548118154; cv=none; d=google.com; s=arc-20160816; b=wiWPSP+65jO7g/u+HcdvBvnkj4MYg0kdV0GZQ4TeP0cvqwvTf6R0t9bMb2DdnDjQ3r 82CCmo4Gp3v96oCOs8f/dY1FraNp/zcZ+35z8XKTCtZ7jJMnPIrp2CIoKUSQBFvqA5g1 NLo3oMuCT4kkIBEigC/RH8WlMr4Y9LlkyM62huescPBovOnyt/NWpnfFuthtJ18bsAW3 xCniLnqdEqna3nxsXA/94dqy1PdFMbmd7TrQO03GgZpPR6agBmi9QFyYUnLXjRM7C023 sNi7QZ9iBY5xs3bcGHN4nZO2yJxEwa9/wiRTtiQghjqKAk3i/1fWvX+F2raDIk6/jgqF veeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=R/uRtcB5vrn/hqHrOx4Hk+Pbtj2OUxtLJyDHbqV3Ulo=; b=l//ZLLujL4zgdimzL163ERaaK8gLYkPIxPtRuUI2VibrIkAfvsv52VUapcMJIk7qg8 vIHDJR1boLrU3IwfCGQs23NI5qvoOIO4Wr0AO9a1JUY1BZqkTdHKBSIWlaTPg2WR49b4 giy72Fz3Sf288GnkrPraPCQLz50HEAdUiz2JUM8NVWQ7FLTzn4IP2eXKsnQyV3c5/rEm r0HcWf8N8pChzSbrG4asZ/fJBCnf64gtZbC1EWXLqykaVMrQ9/TQF0pDbMnRIgfpEl5j fxNIF6I0YkdIBlsHU9lQHh08fhoQNqki+/ZhR5Qjm/mydkOFWfn56auVKPaVLIKMzfM7 N5lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d40si5221775pla.427.2019.01.21.16.48.59; Mon, 21 Jan 2019 16:49:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726225AbfAVArR (ORCPT + 99 others); Mon, 21 Jan 2019 19:47:17 -0500 Received: from mga11.intel.com ([192.55.52.93]:51129 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725896AbfAVArR (ORCPT ); Mon, 21 Jan 2019 19:47:17 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2019 16:47:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,504,1539673200"; d="scan'208";a="116368833" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.37]) by fmsmga007.fm.intel.com with ESMTP; 21 Jan 2019 16:47:15 -0800 Date: Tue, 22 Jan 2019 08:46:47 +0800 From: Wei Yang To: Dan Williams Cc: Wei Yang , linux-nvdimm , Linux Kernel Mailing List Subject: Re: [PATCH] libnvdimm: Clarify nd_pfn_init() flow Message-ID: <20190122004647.GA6575@richard> Reply-To: Wei Yang References: <154785884329.2202034.3295476681016958230.stgit@dwillia2-desk3.amr.corp.intel.com> <20190122002615.GB5855@richard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 21, 2019 at 04:29:08PM -0800, Dan Williams wrote: >On Mon, Jan 21, 2019 at 4:26 PM Wei Yang wrote: >[..] >> >@@ -706,6 +711,22 @@ static int nd_pfn_init(struct nd_pfn *nd_pfn) >> > sig = DAX_SIG; >> > else >> > sig = PFN_SIG; >> >+ >> >+ /* >> >+ * Check for an existing 'pfn' superblock before writing a new >> >+ * one. The intended flow is that on the first probe of an >> >+ * nd_{pfn,dax} device the superblock is calculated and written >> >+ * to the namespace. In this case nd_pfn_validate() returns >> >+ * -ENODEV because no valid superblock exists currently. >> >> As you replied in following mail: >> >> 3/ If present, nd_pfn_validate() returns 0 and nd_dax_probe() >> registers the dax0.1 device (this is a libnvdimm 'personality device). >> >> So at this point, nd_pfn_validate() return 0 or -ENODEV? > >In this case 0, because the configuration was successfully validated. > >-ENODEV, is only returned for the initial case where we want the >kernel to write the configuration. > >All other error codes are an actual failure and the probe procedure stops. To be honest, this maybe crystal clear for you. But I still feel a little confused. Especially on differentiating those cases. How many cases we have? And what's your first probe mean? This the nd_btt/pfn/dax_probe()? or the linux driver probe? -- Wei Yang Help you, Help me