From patchwork Mon Jul 30 07:15:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng Ye X-Patchwork-Id: 10548729 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C22C7A7F2 for ; Mon, 30 Jul 2018 08:29:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2F49298D3 for ; Mon, 30 Jul 2018 08:29:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A62D129947; Mon, 30 Jul 2018 08:29:39 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4CDC12990A for ; Mon, 30 Jul 2018 08:29:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 679038765C; Mon, 30 Jul 2018 08:29:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 25A753001A64; Mon, 30 Jul 2018 08:29:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E029318037F0; Mon, 30 Jul 2018 08:29:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6U7Gwc5002633 for ; Mon, 30 Jul 2018 03:16:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id AE2AC17277; Mon, 30 Jul 2018 07:16:58 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3369B173C6; Mon, 30 Jul 2018 07:16:51 +0000 (UTC) Received: from sender-pp-092.zoho.com (sender-pp-092.zoho.com [135.84.80.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8EC213084034; Mon, 30 Jul 2018 07:16:47 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; b=jTBqWLRQ206iA+xQbDQ+uUjiYq6j3IOCUnQjCtDNQsJ1dwZMA0MLksx/i8fhK6gYIugvXZ66TCCw CJPEa6dhFX3v7XqM8nRpKWBlTMr7ijn2kRdHSLZ7DlMvdIbPR+KQ Received: from YEHS1XR956R00D1.lenovo.com (221.219.122.69 [221.219.122.69]) by mx.zohomail.com with SMTPS id 1532934972894438.38404019626455; Mon, 30 Jul 2018 00:16:12 -0700 (PDT) From: Huaisheng Ye To: linux-nvdimm@lists.01.org, dan.j.williams@intel.com Date: Mon, 30 Jul 2018 15:15:43 +0800 Message-Id: <20180730071548.9172-2-yehs2007@zoho.com> In-Reply-To: <20180730071548.9172-1-yehs2007@zoho.com> References: <20180730071548.9172-1-yehs2007@zoho.com> X-ZohoMailClient: External X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 209 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 30 Jul 2018 07:16:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 30 Jul 2018 07:16:48 +0000 (UTC) for IP:'135.84.80.237' DOMAIN:'sender-pp-092.zoho.com' HELO:'sender-pp-092.zoho.com' FROM:'yehs2007@zoho.com' RCPT:'' X-RedHat-Spam-Score: 0.14 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) 135.84.80.237 sender-pp-092.zoho.com 135.84.80.237 sender-pp-092.zoho.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 30 Jul 2018 04:28:49 -0400 Cc: jack@suse.cz, snitzer@redhat.com, heiko.carstens@de.ibm.com, dm-devel@redhat.com, agk@redhat.com, linux-s390@vger.kernel.org, dave.jiang@intel.com, Huaisheng Ye , vishal.l.verma@intel.com, willy@infradead.org, bart.vanassche@wdc.com, ross.zwisler@linux.intel.com, keescook@chromium.org, chengnt@lenovo.com, colyli@suse.de, schwidefsky@de.ibm.com, viro@zeniv.linux.org.uk, axboe@kernel.dk, martin.petersen@oracle.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [dm-devel] [PATCH v3 1/6] libnvdimm, pmem: kaddr and pfn can be NULL to ->direct_access() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 30 Jul 2018 08:29:38 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Huaisheng Ye pmem_direct_access() needs to check the validity of pointers kaddr and pfn for NULL assignment. If anyone equals to NULL, it doesn't need to calculate the value. If pointer equals to NULL, that is to say callers may have no need for kaddr or pfn, so this patch is prepared for allowing them to pass in NULL instead of having to pass in a pointer or local variable that they then just throw away. Signed-off-by: Huaisheng Ye Reviewed-by: Ross Zwisler --- drivers/nvdimm/pmem.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 8b1fd7f..ecf9024 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -227,8 +227,11 @@ __weak long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, if (unlikely(is_bad_pmem(&pmem->bb, PFN_PHYS(pgoff) / 512, PFN_PHYS(nr_pages)))) return -EIO; - *kaddr = pmem->virt_addr + offset; - *pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags); + + if (kaddr) + *kaddr = pmem->virt_addr + offset; + if (pfn) + *pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags); /* * If badblocks are present, limit known good range to the From patchwork Mon Jul 30 07:15:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng Ye X-Patchwork-Id: 10548725 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75B471751 for ; Mon, 30 Jul 2018 08:28:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65D38298D3 for ; Mon, 30 Jul 2018 08:28:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59C222992B; Mon, 30 Jul 2018 08:28:57 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B285D2990A for ; Mon, 30 Jul 2018 08:28:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 984FB308213E; Mon, 30 Jul 2018 08:28:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63AA95F72B; Mon, 30 Jul 2018 08:28:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DCB7C18037ED; Mon, 30 Jul 2018 08:28:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6U7GuRU002626 for ; Mon, 30 Jul 2018 03:16:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C0BC1001938; Mon, 30 Jul 2018 07:16:56 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 131AC100164C; Mon, 30 Jul 2018 07:16:52 +0000 (UTC) Received: from sender-pp-092.zoho.com (sender-pp-092.zoho.com [135.84.80.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D0EEB3086267; Mon, 30 Jul 2018 07:16:50 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; b=O8ywsKPHA4QkEojT1tTHWNbf3U3VAyBfKC1kAzUgKxpbgtMOCnav/i1b4Lv7B7TRSEaWuAdOOvn1 Rhhh9yuuVinC417TmprZYzjw+ZLr3Bg2DuFb0z6VQQxzTnegsUWN Received: from YEHS1XR956R00D1.lenovo.com (221.219.122.69 [221.219.122.69]) by mx.zohomail.com with SMTPS id 153293498037231.188860816768056; Mon, 30 Jul 2018 00:16:20 -0700 (PDT) From: Huaisheng Ye To: linux-nvdimm@lists.01.org, dan.j.williams@intel.com Date: Mon, 30 Jul 2018 15:15:44 +0800 Message-Id: <20180730071548.9172-3-yehs2007@zoho.com> In-Reply-To: <20180730071548.9172-1-yehs2007@zoho.com> References: <20180730071548.9172-1-yehs2007@zoho.com> X-ZohoMailClient: External X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 209 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 30 Jul 2018 07:16:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 30 Jul 2018 07:16:51 +0000 (UTC) for IP:'135.84.80.237' DOMAIN:'sender-pp-092.zoho.com' HELO:'sender-pp-092.zoho.com' FROM:'yehs2007@zoho.com' RCPT:'' X-RedHat-Spam-Score: 0.14 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) 135.84.80.237 sender-pp-092.zoho.com 135.84.80.237 sender-pp-092.zoho.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 30 Jul 2018 04:28:49 -0400 Cc: jack@suse.cz, snitzer@redhat.com, heiko.carstens@de.ibm.com, dm-devel@redhat.com, agk@redhat.com, linux-s390@vger.kernel.org, dave.jiang@intel.com, Huaisheng Ye , vishal.l.verma@intel.com, willy@infradead.org, bart.vanassche@wdc.com, ross.zwisler@linux.intel.com, keescook@chromium.org, chengnt@lenovo.com, colyli@suse.de, schwidefsky@de.ibm.com, viro@zeniv.linux.org.uk, axboe@kernel.dk, martin.petersen@oracle.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [dm-devel] [PATCH v3 2/6] s390, dcssblk: kaddr and pfn can be NULL to ->direct_access() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 30 Jul 2018 08:28:55 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Huaisheng Ye dcssblk_direct_access() needs to check the validity of pointers kaddr and pfn for NULL assignment. If anyone equals to NULL, it doesn't need to calculate the value. If either of them is equal to NULL, that is to say callers may have no need for kaddr or pfn, so this patch is prepared for allowing them to pass in NULL instead of having to pass in a pointer or local variable that they then just throw away. Signed-off-by: Huaisheng Ye Reviewed-by: Ross Zwisler Acked-by: Martin Schwidefsky --- drivers/s390/block/dcssblk.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index ed60728..23e526c 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -922,9 +922,11 @@ static DEVICE_ATTR(save, S_IWUSR | S_IRUSR, dcssblk_save_show, unsigned long dev_sz; 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 (kaddr) + *kaddr = (void *) dev_info->start + offset; + if (pfn) + *pfn = __pfn_to_pfn_t(PFN_DOWN(dev_info->start + offset), + PFN_DEV|PFN_SPECIAL); return (dev_sz - offset) / PAGE_SIZE; } From patchwork Mon Jul 30 07:15:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng Ye X-Patchwork-Id: 10548727 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A4BEF13B8 for ; Mon, 30 Jul 2018 08:29:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94DEB2992B for ; Mon, 30 Jul 2018 08:29:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8894D29941; Mon, 30 Jul 2018 08:29:39 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2984E298D3 for ; Mon, 30 Jul 2018 08:29:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3947BC0587CE; Mon, 30 Jul 2018 08:29:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A7275D755; Mon, 30 Jul 2018 08:29:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BF1584A46C; Mon, 30 Jul 2018 08:29:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6U7HHvW002646 for ; Mon, 30 Jul 2018 03:17:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9988717C37; Mon, 30 Jul 2018 07:17:17 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9EC73AD160; Mon, 30 Jul 2018 07:17:02 +0000 (UTC) Received: from sender-pp-092.zoho.com (sender-pp-092.zoho.com [135.84.80.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6AC1A307D84A; Mon, 30 Jul 2018 07:17:01 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; b=BDnueTWzEE45t0SYpxqTmtHg5uI5WCTBFscym3fhKm7WuYbHdVOELnFr/534lA/CuNr81SxL+TQ+ I72Y5ys0m0gkbEdFCT/gw7VoLO5KgvOpyk58U7CqSbAQeTgitCCx Received: from YEHS1XR956R00D1.lenovo.com (221.219.122.69 [221.219.122.69]) by mx.zohomail.com with SMTPS id 1532934987467986.6665732293084; Mon, 30 Jul 2018 00:16:27 -0700 (PDT) From: Huaisheng Ye To: linux-nvdimm@lists.01.org, dan.j.williams@intel.com Date: Mon, 30 Jul 2018 15:15:45 +0800 Message-Id: <20180730071548.9172-4-yehs2007@zoho.com> In-Reply-To: <20180730071548.9172-1-yehs2007@zoho.com> References: <20180730071548.9172-1-yehs2007@zoho.com> X-ZohoMailClient: External X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 209 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 30 Jul 2018 07:17:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 30 Jul 2018 07:17:01 +0000 (UTC) for IP:'135.84.80.237' DOMAIN:'sender-pp-092.zoho.com' HELO:'sender-pp-092.zoho.com' FROM:'yehs2007@zoho.com' RCPT:'' X-RedHat-Spam-Score: 0.14 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) 135.84.80.237 sender-pp-092.zoho.com 135.84.80.237 sender-pp-092.zoho.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 30 Jul 2018 04:28:49 -0400 Cc: jack@suse.cz, snitzer@redhat.com, heiko.carstens@de.ibm.com, dm-devel@redhat.com, agk@redhat.com, linux-s390@vger.kernel.org, dave.jiang@intel.com, Huaisheng Ye , vishal.l.verma@intel.com, willy@infradead.org, bart.vanassche@wdc.com, ross.zwisler@linux.intel.com, keescook@chromium.org, chengnt@lenovo.com, colyli@suse.de, schwidefsky@de.ibm.com, viro@zeniv.linux.org.uk, axboe@kernel.dk, martin.petersen@oracle.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [dm-devel] [PATCH v3 3/6] tools/testing/nvdimm: kaddr and pfn can be NULL to ->direct_access() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 30 Jul 2018 08:29:38 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Huaisheng Ye The mock / test version of pmem_direct_access() needs to check the validity of pointers kaddr and pfn for NULL assignment. If anyone equals to NULL, it doesn't need to calculate the value. If pointer equals to NULL, that is to say callers may have no need for kaddr or pfn, so this patch is prepared for allowing them to pass in NULL instead of having to pass in a local pointer or variable that they then just throw away. Suggested-by: Dan Williams Signed-off-by: Huaisheng Ye Reviewed-by: Ross Zwisler --- tools/testing/nvdimm/pmem-dax.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/testing/nvdimm/pmem-dax.c b/tools/testing/nvdimm/pmem-dax.c index b53596a..2e7fd82 100644 --- a/tools/testing/nvdimm/pmem-dax.c +++ b/tools/testing/nvdimm/pmem-dax.c @@ -31,17 +31,21 @@ long __pmem_direct_access(struct pmem_device *pmem, pgoff_t pgoff, if (get_nfit_res(pmem->phys_addr + offset)) { struct page *page; - *kaddr = pmem->virt_addr + offset; + if (kaddr) + *kaddr = pmem->virt_addr + offset; page = vmalloc_to_page(pmem->virt_addr + offset); - *pfn = page_to_pfn_t(page); + if (pfn) + *pfn = page_to_pfn_t(page); pr_debug_ratelimited("%s: pmem: %p pgoff: %#lx pfn: %#lx\n", __func__, pmem, pgoff, page_to_pfn(page)); return 1; } - *kaddr = pmem->virt_addr + offset; - *pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags); + if (kaddr) + *kaddr = pmem->virt_addr + offset; + if (pfn) + *pfn = phys_to_pfn_t(pmem->phys_addr + offset, pmem->pfn_flags); /* * If badblocks are present, limit known good range to the From patchwork Mon Jul 30 07:15:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng Ye X-Patchwork-Id: 10548737 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 019C913BB for ; Mon, 30 Jul 2018 08:32:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E642829947 for ; Mon, 30 Jul 2018 08:32:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA142299A6; Mon, 30 Jul 2018 08:32:29 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7CA6129947 for ; Mon, 30 Jul 2018 08:32:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E8D93086275; Mon, 30 Jul 2018 08:30:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AAAC10841F6; Mon, 30 Jul 2018 08:30:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0439118037EF; Mon, 30 Jul 2018 08:30:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6U7HfaF002682 for ; Mon, 30 Jul 2018 03:17:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id DD7932A17D; Mon, 30 Jul 2018 07:17:41 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 688942A18A; Mon, 30 Jul 2018 07:17:38 +0000 (UTC) Received: from sender-pp-092.zoho.com (sender-pp-092.zoho.com [135.84.80.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0DBF05D68D; Mon, 30 Jul 2018 07:17:37 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; b=XiO5ZXTIK4qFplcpU9FjlpAYLO1SYxietDbRmvxitapnblkzO2XHuPQF75VFSBU9+DZ07p69ApRe ZMTz6IeQ+UKqZY966NWHtsOXvcCjPLNbz5QOBtpqC7PdrL9LImDV Received: from YEHS1XR956R00D1.lenovo.com (221.219.122.69 [221.219.122.69]) by mx.zohomail.com with SMTPS id 1532934994374623.0800546050964; Mon, 30 Jul 2018 00:16:34 -0700 (PDT) From: Huaisheng Ye To: linux-nvdimm@lists.01.org, dan.j.williams@intel.com Date: Mon, 30 Jul 2018 15:15:46 +0800 Message-Id: <20180730071548.9172-5-yehs2007@zoho.com> In-Reply-To: <20180730071548.9172-1-yehs2007@zoho.com> References: <20180730071548.9172-1-yehs2007@zoho.com> X-ZohoMailClient: External X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 30 Jul 2018 07:17:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 30 Jul 2018 07:17:37 +0000 (UTC) for IP:'135.84.80.237' DOMAIN:'sender-pp-092.zoho.com' HELO:'sender-pp-092.zoho.com' FROM:'yehs2007@zoho.com' RCPT:'' X-RedHat-Spam-Score: 0.14 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) 135.84.80.237 sender-pp-092.zoho.com 135.84.80.237 sender-pp-092.zoho.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 30 Jul 2018 04:28:49 -0400 Cc: jack@suse.cz, snitzer@redhat.com, heiko.carstens@de.ibm.com, dm-devel@redhat.com, agk@redhat.com, linux-s390@vger.kernel.org, dave.jiang@intel.com, Huaisheng Ye , vishal.l.verma@intel.com, willy@infradead.org, bart.vanassche@wdc.com, ross.zwisler@linux.intel.com, keescook@chromium.org, chengnt@lenovo.com, colyli@suse.de, schwidefsky@de.ibm.com, viro@zeniv.linux.org.uk, axboe@kernel.dk, martin.petersen@oracle.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [dm-devel] [PATCH v3 4/6] dax/super: Do not request a pointer kaddr when not required X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 30 Jul 2018 08:32:29 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Huaisheng Ye Function __bdev_dax_supported doesn't need to get local pointer kaddr from direct_access. Using NULL instead of having to pass in a useless local pointer that caller then just throw away. Signed-off-by: Huaisheng Ye Reviewed-by: Ross Zwisler --- drivers/dax/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 45276ab..6e928f3 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -89,7 +89,6 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize) struct request_queue *q; pgoff_t pgoff; int err, id; - void *kaddr; pfn_t pfn; long len; char buf[BDEVNAME_SIZE]; @@ -122,7 +121,7 @@ bool __bdev_dax_supported(struct block_device *bdev, int blocksize) } id = dax_read_lock(); - len = dax_direct_access(dax_dev, pgoff, 1, &kaddr, &pfn); + len = dax_direct_access(dax_dev, pgoff, 1, NULL, &pfn); dax_read_unlock(id); put_dax(dax_dev); From patchwork Mon Jul 30 07:15:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng Ye X-Patchwork-Id: 10548731 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF4E313B8 for ; Mon, 30 Jul 2018 08:29:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D0BDC298D3 for ; Mon, 30 Jul 2018 08:29:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C366429941; Mon, 30 Jul 2018 08:29:57 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6DB81298D3 for ; Mon, 30 Jul 2018 08:29:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 674E7307D842; Mon, 30 Jul 2018 08:29:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C236173C3; Mon, 30 Jul 2018 08:29:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DFC5218037F3; Mon, 30 Jul 2018 08:29:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6U7HPrl002652 for ; Mon, 30 Jul 2018 03:17:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id EE70667653; Mon, 30 Jul 2018 07:17:25 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 131C31823E; Mon, 30 Jul 2018 07:17:17 +0000 (UTC) Received: from sender-pp-092.zoho.com (sender-pp-092.zoho.com [135.84.80.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 20936308A973; Mon, 30 Jul 2018 07:17:11 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; b=WtrEBSlR4Od3l9UH0D5pXGqOF96YvlYMZkwxIzFhukG/IS474dlXDlooS0iIjYsqjstYYroolauZ 51t9ANXvvWx+71dTP2NeKyftYdmMRoQRNxQqlh9bAU+IAODg4O8N Received: from YEHS1XR956R00D1.lenovo.com (221.219.122.69 [221.219.122.69]) by mx.zohomail.com with SMTPS id 1532935001893212.22626622234168; Mon, 30 Jul 2018 00:16:41 -0700 (PDT) From: Huaisheng Ye To: linux-nvdimm@lists.01.org, dan.j.williams@intel.com Date: Mon, 30 Jul 2018 15:15:47 +0800 Message-Id: <20180730071548.9172-6-yehs2007@zoho.com> In-Reply-To: <20180730071548.9172-1-yehs2007@zoho.com> References: <20180730071548.9172-1-yehs2007@zoho.com> X-ZohoMailClient: External X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 209 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 30 Jul 2018 07:17:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 30 Jul 2018 07:17:16 +0000 (UTC) for IP:'135.84.80.237' DOMAIN:'sender-pp-092.zoho.com' HELO:'sender-pp-092.zoho.com' FROM:'yehs2007@zoho.com' RCPT:'' X-RedHat-Spam-Score: 0.14 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) 135.84.80.237 sender-pp-092.zoho.com 135.84.80.237 sender-pp-092.zoho.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.41 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 30 Jul 2018 04:28:49 -0400 Cc: jack@suse.cz, snitzer@redhat.com, heiko.carstens@de.ibm.com, dm-devel@redhat.com, agk@redhat.com, linux-s390@vger.kernel.org, dave.jiang@intel.com, Huaisheng Ye , vishal.l.verma@intel.com, willy@infradead.org, bart.vanassche@wdc.com, ross.zwisler@linux.intel.com, keescook@chromium.org, chengnt@lenovo.com, colyli@suse.de, schwidefsky@de.ibm.com, viro@zeniv.linux.org.uk, axboe@kernel.dk, martin.petersen@oracle.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [dm-devel] [PATCH v3 5/6] md/dm-writecache: Don't request pointer dummy_addr when not required X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 30 Jul 2018 08:29:56 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Huaisheng Ye Function persistent_memory_claim doesn't need to get local pointer dummy_addr from direct_access. Using NULL instead of having to pass in a useless local pointer that caller then just throw away. Suggested-by: Ross Zwisler Signed-off-by: Huaisheng Ye Reviewed-by: Ross Zwisler Acked-by: Mike Snitzer --- drivers/md/dm-writecache.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 87107c9..9d79084 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -268,9 +268,8 @@ static int persistent_memory_claim(struct dm_writecache *wc) i = 0; do { long daa; - void *dummy_addr; daa = dax_direct_access(wc->ssd_dev->dax_dev, i, p - i, - &dummy_addr, &pfn); + NULL, &pfn); if (daa <= 0) { r = daa ? daa : -EINVAL; goto err3; From patchwork Mon Jul 30 07:15:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huaisheng Ye X-Patchwork-Id: 10548735 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5717213BB for ; Mon, 30 Jul 2018 08:30:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4725329946 for ; Mon, 30 Jul 2018 08:30:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B05729990; Mon, 30 Jul 2018 08:30:16 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CD7BF29994 for ; Mon, 30 Jul 2018 08:30:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E35AEC057FA3; Mon, 30 Jul 2018 08:30:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B532E2A161; Mon, 30 Jul 2018 08:30:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6E8B54A46C; Mon, 30 Jul 2018 08:30:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6U7HWAV002673 for ; Mon, 30 Jul 2018 03:17:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 76715308BDB9; Mon, 30 Jul 2018 07:17:32 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8FCAB308BDB7; Mon, 30 Jul 2018 07:17:22 +0000 (UTC) Received: from sender-pp-092.zoho.com (sender-pp-092.zoho.com [135.84.80.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C91FA85363; Mon, 30 Jul 2018 07:17:21 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=zapps768; d=zoho.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; b=UPytojvTmBxSMwYRB1BlQdykt5zyb8fDeWe95XV001Fv/QICPtDmRhM7G+9B+q3A5m71Q4vb2PUW OGg6/lWAOC4edq1FEWS+yepVBR0R79XmKbDo4Q62yLM9yxtUhEe0 Received: from YEHS1XR956R00D1.lenovo.com (221.219.122.69 [221.219.122.69]) by mx.zohomail.com with SMTPS id 153293500984285.65624312111981; Mon, 30 Jul 2018 00:16:49 -0700 (PDT) From: Huaisheng Ye To: linux-nvdimm@lists.01.org, dan.j.williams@intel.com Date: Mon, 30 Jul 2018 15:15:48 +0800 Message-Id: <20180730071548.9172-7-yehs2007@zoho.com> In-Reply-To: <20180730071548.9172-1-yehs2007@zoho.com> References: <20180730071548.9172-1-yehs2007@zoho.com> X-ZohoMailClient: External X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 209 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 30 Jul 2018 07:17:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 30 Jul 2018 07:17:22 +0000 (UTC) for IP:'135.84.80.237' DOMAIN:'sender-pp-092.zoho.com' HELO:'sender-pp-092.zoho.com' FROM:'yehs2007@zoho.com' RCPT:'' X-RedHat-Spam-Score: 0.14 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) 135.84.80.237 sender-pp-092.zoho.com 135.84.80.237 sender-pp-092.zoho.com X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 30 Jul 2018 04:28:49 -0400 Cc: jack@suse.cz, snitzer@redhat.com, heiko.carstens@de.ibm.com, dm-devel@redhat.com, agk@redhat.com, linux-s390@vger.kernel.org, dave.jiang@intel.com, Huaisheng Ye , vishal.l.verma@intel.com, willy@infradead.org, bart.vanassche@wdc.com, ross.zwisler@linux.intel.com, keescook@chromium.org, chengnt@lenovo.com, colyli@suse.de, schwidefsky@de.ibm.com, viro@zeniv.linux.org.uk, axboe@kernel.dk, martin.petersen@oracle.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [dm-devel] [PATCH v3 6/6] filesystem-dax: Do not request kaddr and pfn when not required X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 30 Jul 2018 08:30:15 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Huaisheng Ye Some functions within fs/dax don't need to get local pointer kaddr or variable pfn from direct_access. Using NULL instead of having to pass in useless pointer or variable that caller then just throw away. Signed-off-by: Huaisheng Ye Reviewed-by: Ross Zwisler --- fs/dax.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 6411928..959a533 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -647,7 +647,6 @@ static int copy_user_dax(struct block_device *bdev, struct dax_device *dax_dev, { void *vto, *kaddr; pgoff_t pgoff; - pfn_t pfn; long rc; int id; @@ -656,7 +655,7 @@ static int copy_user_dax(struct block_device *bdev, struct dax_device *dax_dev, return rc; id = dax_read_lock(); - rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), &kaddr, &pfn); + rc = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), &kaddr, NULL); if (rc < 0) { dax_read_unlock(id); return rc; @@ -967,7 +966,6 @@ static int dax_iomap_pfn(struct iomap *iomap, loff_t pos, size_t size, { const sector_t sector = dax_iomap_sector(iomap, pos); pgoff_t pgoff; - void *kaddr; int id, rc; long length; @@ -976,7 +974,7 @@ static int dax_iomap_pfn(struct iomap *iomap, loff_t pos, size_t size, return rc; id = dax_read_lock(); length = dax_direct_access(iomap->dax_dev, pgoff, PHYS_PFN(size), - &kaddr, pfnp); + NULL, pfnp); if (length < 0) { rc = length; goto out; @@ -1052,15 +1050,13 @@ int __dax_zero_page_range(struct block_device *bdev, pgoff_t pgoff; long rc, id; void *kaddr; - pfn_t pfn; rc = bdev_dax_pgoff(bdev, sector, PAGE_SIZE, &pgoff); if (rc) return rc; id = dax_read_lock(); - rc = dax_direct_access(dax_dev, pgoff, 1, &kaddr, - &pfn); + rc = dax_direct_access(dax_dev, pgoff, 1, &kaddr, NULL); if (rc < 0) { dax_read_unlock(id); return rc; @@ -1116,7 +1112,6 @@ int __dax_zero_page_range(struct block_device *bdev, ssize_t map_len; pgoff_t pgoff; void *kaddr; - pfn_t pfn; if (fatal_signal_pending(current)) { ret = -EINTR; @@ -1128,7 +1123,7 @@ int __dax_zero_page_range(struct block_device *bdev, break; map_len = dax_direct_access(dax_dev, pgoff, PHYS_PFN(size), - &kaddr, &pfn); + &kaddr, NULL); if (map_len < 0) { ret = map_len; break;