From patchwork Mon Jul 16 17:01:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10527295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2085C601D2 for ; Mon, 16 Jul 2018 17:11:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F6AB28D80 for ; Mon, 16 Jul 2018 17:11:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03A6E28D8F; Mon, 16 Jul 2018 17:11:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5C5228D80 for ; Mon, 16 Jul 2018 17:11:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 831D96B027E; Mon, 16 Jul 2018 13:11:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6A3136B0281; Mon, 16 Jul 2018 13:11:35 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4AF116B027F; Mon, 16 Jul 2018 13:11:35 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id 006846B027E for ; Mon, 16 Jul 2018 13:11:34 -0400 (EDT) Received: by mail-pg1-f200.google.com with SMTP id t20-v6so3861184pgu.9 for ; Mon, 16 Jul 2018 10:11:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=i6kqJud/GbqdIh5IuQMfPAGc/5Bm77d6L3X+e3Zfv6g=; b=NPeflWRvqKRlxl0AhJY3+pckRnPRbJG/cTOcS3euZMmPYTn3zHw/x7tZMOt8pAdgJr uHzzey4igWy4amhpvVjGxRcoHMtTMJ8acYiQAKrq/pu0VY9Nb4WRE48giQOWViidwaXj hcflC/JeFqxeUnhHa3jItKIV468s4bgnPNXd+t0Rp+uvJd2iGymBehKvE94nDBQ91tei Q7waWmlTrIXQUpTbbUCq3EeqRSo8HUYuLySDVFWwo+gChD6pi+IK2e1daTEQQeLJS/Zm ozHQFTB4FHq92S13jfAZBRH942OI/Z7Y5U5F66OtyFyEOtGec4/PGbrBxg693ZvgqHSK 989Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AOUpUlEJszObzDelXM8fUWkUiAW8w4lxDLiD17bCvnho4+X1VuUsQDUJ XawWWcUhEuGNGBN48CZKeQfw1MYVsdT+RqaOJUxFye2UGjYzdsFdWgqyWT1svhxZpapSDdRc8aF eQGbiNbaAH0WUqBjSAsmj9n4ndAFv+9kjTglakxcP2ouL3EehkmfAaP8HLntiaUYxTg== X-Received: by 2002:a17:902:8d91:: with SMTP id v17-v6mr17608994plo.9.1531761094680; Mon, 16 Jul 2018 10:11:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdvskAF8H4vj7Tj18gYH2g4VlbYw7oknEwyBsEhK3bsXF9XmghT+2RM/Til2nqM1Wnoq+FO X-Received: by 2002:a17:902:8d91:: with SMTP id v17-v6mr17608947plo.9.1531761093972; Mon, 16 Jul 2018 10:11:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531761093; cv=none; d=google.com; s=arc-20160816; b=XEFxigYt12UFcNHASbI5n5d32ea+pwcgNCMHyMBuTWh+LewX0+IiN6sZ7Sk93qGbX4 312IuGZP4SJOWavsVygG2xgPIIllB67/hih0PUkTktRDQVBbrb1aJdQwbn91BX+ZLYKO P5Ofia2PTxALkGdzJO7DX5tuhFHbC7YGGx/Cd59QsBlpT7wjy9ggyOk/CAjMMWfKAkXN umV0SMS4Zz4MBsnmUokDQF0y+dEPQ7KV0BHTNCmGnR95QXGzp0WHtabg/y6plke0SobP YobhlRtMzbOO7oyYHWSOeXvveMUAAufqZuTZp2aezZkh5JsLWIaRRd8xVTzOuGfFXbap qQhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject :arc-authentication-results; bh=i6kqJud/GbqdIh5IuQMfPAGc/5Bm77d6L3X+e3Zfv6g=; b=h6ur1iCiM+SrHlockuRmdcGf5DkJCkWuTZHSIHzQsqLhhp2JhUij7hUyBWvAVRZEwT EyoAD5OWTPY17LFFBeeYFP6F1teCkrvlvXBDLOGZNwzUBTT2Xbf25Nn6uqaAFgYHI8PV tn7V7qxl3twbiH4+RSmK/8oa3dTPK5zmhJXXSda5Vso7qZmwt0JYAIFpPc6B6D7vPAX3 7IOytKO9+OfEMvgBgOP3HsyCesTbAYUJR9kYreUekB6+zokiuHEDdRh51QXV6m/5jueL kdplA1DpRGi6TQYeqRZJT5I0MM5jsxJ6SibLolySJ/h8d5jQh2YVFOiJs0+90nhlydjR wBdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga05.intel.com (mga05.intel.com. [192.55.52.43]) by mx.google.com with ESMTPS id j185-v6si986431pgc.419.2018.07.16.10.11.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Jul 2018 10:11:33 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.43 as permitted sender) client-ip=192.55.52.43; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.43 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2018 10:11:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,362,1526367600"; d="scan'208";a="67428810" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga002.fm.intel.com with ESMTP; 16 Jul 2018 10:11:06 -0700 Subject: [PATCH v2 09/14] s390, dcssblk: 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:01:08 -0700 Message-ID: <153176046886.12695.7487453664953251895.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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Huaisheng Ye dcssblk_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/s390/block/dcssblk.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index ed607288e696..a645b2c93c34 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -923,8 +923,9 @@ __dcssblk_direct_access(struct dcssblk_dev_info *dev_info, pgoff_t pgoff, dev_sz = dev_info->end - dev_info->start + 1; *kaddr = (void *) dev_info->start + offset; - *pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset), - PFN_DEV|PFN_SPECIAL); + if (pfn) + *pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset), + PFN_DEV|PFN_SPECIAL); return (dev_sz - offset) / PAGE_SIZE; }