Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2574061imm; Mon, 16 Jul 2018 10:12:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfYBG7T2ndAoeyE6a3fogQSqRAakJnmWmWDjmVW8OeOlktoFNvcF8ehVfWQ1/tgY++b+1kX X-Received: by 2002:a17:902:1007:: with SMTP id b7-v6mr17141490pla.277.1531761154150; Mon, 16 Jul 2018 10:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531761154; cv=none; d=google.com; s=arc-20160816; b=csQH7TMXWuK01gds0ODBuj79KPQ0k6Laf/P1uF+pi++jTRhaWutCXm8+sHLZFDlxiV oUUNoSp4vLzlfr9AW8ThHU15KrVVESI4HjgU4+VKLs1XkMSEatCiVU7IeYYpZEv6Oncl FsxBcwb5BH1k1u7r1yKN2QNIFqv4UTg1d2iT9jTSL6O0IVtwYIoVpLSLL52wagohhAm5 3Ct+jEg1lHDj5CkrHUXHJKq9P92aHlOZsA8B8VchJPy8j1NU2zBDTIUrTzd9zOoxyuFO NHq+xJ7Hm61k5sHhuykR27CP9FyQnkRKieqM9NLyqJERdfClTRI0ALPcmxGHNPgD7Swy GuMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:arc-authentication-results; bh=X0nMdeTAxOLMB9YWU2TN+evclwF+cjiCHlvXwgRdB/o=; b=IWqKgi7YLTSH+jhYdpReVm45SlIEj+EBbFTtCF5rj+pU5JXHiOu85cCJgaxjtexmK3 q7aKXCNXC/2+gBT1X4EdUNayv5TwD6Um30gYTJQCUefC5f9Io7f2/sedqHjPd5k5DHFa G/SZD8PJFMitMhyvRFSZCkRoNZfuEkCHP+nt75n4ED4d2neu7hYY+eFAGU3fzQLm673U sdCeiw/x82wF311nvqx3s5Bnqh4xwXWGO5xsjXGEluwPjwTlJA1WBGSzMB34zO3ze0Gd T450dMLLwe4U+FtxiirRMDGMBCqWwUPyQ/YlFexAqkp/KINiWxlhP8FgH5MXFUwfVgik UZZw== 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 h3-v6si31033284pld.114.2018.07.16.10.12.19; Mon, 16 Jul 2018 10:12:34 -0700 (PDT) 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 S1730116AbeGPRj0 (ORCPT + 99 others); Mon, 16 Jul 2018 13:39:26 -0400 Received: from mga09.intel.com ([134.134.136.24]:28798 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728129AbeGPRj0 (ORCPT ); Mon, 16 Jul 2018 13:39:26 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2018 10:11:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,362,1526367600"; d="scan'208";a="216447242" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga004.jf.intel.com with ESMTP; 16 Jul 2018 10:10:55 -0700 Subject: [PATCH v2 07/14] libnvdimm, pmem: Allow a NULL-pfn to ->direct_access() From: Dan Williams To: akpm@linux-foundation.org Cc: Huaisheng Ye , Jan Kara , vishal.l.verma@intel.com, hch@lst.de, linux-mm@kvack.org, jack@suse.cz, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Date: Mon, 16 Jul 2018 10:00:58 -0700 Message-ID: <153176045824.12695.14255237229973044333.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <153176041838.12695.3365448145295112857.stgit@dwillia2-desk3.amr.corp.intel.com> References: <153176041838.12695.3365448145295112857.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huaisheng Ye pmem_direct_access() needs to check the validity of pointer pfn for NULL assignment. If pfn equals to NULL, it doesn't need to calculate the value. This is in support of asynchronous memmap init and avoid page lookups when possible. Signed-off-by: Huaisheng Ye Reviewed-by: Jan Kara Signed-off-by: Dan Williams --- drivers/nvdimm/pmem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index e8ac6f244d2b..c430536320a5 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -228,7 +228,8 @@ __weak long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, PFN_PHYS(nr_pages)))) return -EIO; *kaddr = pmem->virt_addr + offset; - *pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags); + if (pfn) + *pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags); /* * If badblocks are present, limit known good range to the