From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Snitzer Subject: Re: [PATCH v2] dax: fix for do not print error message for non-persistent memory block device Date: Thu, 3 Sep 2020 12:00:05 -0400 Message-ID: <20200903160005.GA11871@redhat.com> References: <20200903152839.19040-1-colyli@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20200903152839.19040-1-colyli@suse.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Content-Disposition: inline To: Coly Li Cc: Pankaj Gupta , linux-nvdimm@lists.01.org, Vishal Verma , dm-devel@redhat.com, Adrian Huang , Jan Kara , Ira Weiny List-Id: dm-devel.ids On Thu, Sep 03 2020 at 11:28am -0400, Coly Li wrote: > When calling __generic_fsdax_supported(), a dax-unsupported device may > not have dax_dev as NULL, e.g. the dax related code block is not enabled > by Kconfig. > > Therefore in __generic_fsdax_supported(), to check whether a device > supports DAX or not, the following order should be performed, > - If dax_dev pointer is NULL, it means the device driver explicitly > announce it doesn't support DAX. Then it is OK to directly return > false from __generic_fsdax_supported(). > - If dax_dev pointer is NOT NULL, it might be because the driver doesn't > support DAX and not explicitly initialize related data structure. Then > bdev_dax_supported() should be called for further check. > > IMHO if device driver desn't explicitly set its dax_dev pointer to NULL, > this is not a bug. Calling bdev_dax_supported() makes sure they can be > recognized as dax-unsupported eventually. > > This patch does the following change for the above purpose, > - if (!dax_dev && !bdev_dax_supported(bdev, blocksize)) { > + if (!dax_dev || !bdev_dax_supported(bdev, blocksize)) { Don't think I've ever seen a one-liner fix document the diff in its patch header. Really no need for that. > Fixes: c2affe920b0e ("dax: do not print error message for non-persistent memory block device") > Signed-off-by: Coly Li > Reviewed-and-Tested-by: Adrian Huang > Cc: Ira Weiny > Cc: Jan Kara > Cc: Mike Snitzer > Cc: Pankaj Gupta > Cc: Vishal Verma Thanks for fixing this, Reviewed-by: Mike Snitzer > --- > Changelog: > v2: add Reviewed-and-Tested-by from Adrian Huang. > v1: initial version. > > drivers/dax/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c > index 32642634c1bb..e5767c83ea23 100644 > --- a/drivers/dax/super.c > +++ b/drivers/dax/super.c > @@ -100,7 +100,7 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev, > return false; > } > > - if (!dax_dev && !bdev_dax_supported(bdev, blocksize)) { > + if (!dax_dev || !bdev_dax_supported(bdev, blocksize)) { > pr_debug("%s: error: dax unsupported by block device\n", > bdevname(bdev, buf)); > return false; > -- > 2.26.2 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E93CDC433E2 for ; Thu, 3 Sep 2020 16:00:17 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B72E120786 for ; Thu, 3 Sep 2020 16:00:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HBVFtnxy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B72E120786 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6175C13A1CFAB; Thu, 3 Sep 2020 09:00:17 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=205.139.110.61; helo=us-smtp-delivery-1.mimecast.com; envelope-from=msnitzer@redhat.com; receiver= Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 51A9D13A1CFA8 for ; Thu, 3 Sep 2020 09:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599148813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/4Xsunww6H4JCi0h2bUx1iXMO4WLbL8+oemhL6HE4pA=; b=HBVFtnxyMcBG40yNm5MSt7JCqIdo6xDj0M+ggVvKxF12ltara7By0neor4HoPVjla35aVv nWQl+OR+l4XNU81ek54q1cg3s8Sz8P0oygLz3R4Dm72MVhCshocL/2mqz16gC/Xy5ixjKb SVvjkPnj68UA70V2087X27w/7MvPEfA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-142-QRNTW324NtaqNtj3MNXLwQ-1; Thu, 03 Sep 2020 12:00:11 -0400 X-MC-Unique: QRNTW324NtaqNtj3MNXLwQ-1 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B5D318B9F49; Thu, 3 Sep 2020 16:00:09 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D725819D7D; Thu, 3 Sep 2020 16:00:05 +0000 (UTC) Date: Thu, 3 Sep 2020 12:00:05 -0400 From: Mike Snitzer To: Coly Li Subject: Re: [PATCH v2] dax: fix for do not print error message for non-persistent memory block device Message-ID: <20200903160005.GA11871@redhat.com> References: <20200903152839.19040-1-colyli@suse.de> MIME-Version: 1.0 In-Reply-To: <20200903152839.19040-1-colyli@suse.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=msnitzer@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Content-Disposition: inline Message-ID-Hash: ECEU7Z235YRN77WSWEPGP6PF6FXEAA4N X-Message-ID-Hash: ECEU7Z235YRN77WSWEPGP6PF6FXEAA4N X-MailFrom: msnitzer@redhat.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation CC: linux-nvdimm@lists.01.org, dm-devel@redhat.com, Adrian Huang , Jan Kara , Pankaj Gupta X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Thu, Sep 03 2020 at 11:28am -0400, Coly Li wrote: > When calling __generic_fsdax_supported(), a dax-unsupported device may > not have dax_dev as NULL, e.g. the dax related code block is not enabled > by Kconfig. > > Therefore in __generic_fsdax_supported(), to check whether a device > supports DAX or not, the following order should be performed, > - If dax_dev pointer is NULL, it means the device driver explicitly > announce it doesn't support DAX. Then it is OK to directly return > false from __generic_fsdax_supported(). > - If dax_dev pointer is NOT NULL, it might be because the driver doesn't > support DAX and not explicitly initialize related data structure. Then > bdev_dax_supported() should be called for further check. > > IMHO if device driver desn't explicitly set its dax_dev pointer to NULL, > this is not a bug. Calling bdev_dax_supported() makes sure they can be > recognized as dax-unsupported eventually. > > This patch does the following change for the above purpose, > - if (!dax_dev && !bdev_dax_supported(bdev, blocksize)) { > + if (!dax_dev || !bdev_dax_supported(bdev, blocksize)) { Don't think I've ever seen a one-liner fix document the diff in its patch header. Really no need for that. > Fixes: c2affe920b0e ("dax: do not print error message for non-persistent memory block device") > Signed-off-by: Coly Li > Reviewed-and-Tested-by: Adrian Huang > Cc: Ira Weiny > Cc: Jan Kara > Cc: Mike Snitzer > Cc: Pankaj Gupta > Cc: Vishal Verma Thanks for fixing this, Reviewed-by: Mike Snitzer > --- > Changelog: > v2: add Reviewed-and-Tested-by from Adrian Huang. > v1: initial version. > > drivers/dax/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c > index 32642634c1bb..e5767c83ea23 100644 > --- a/drivers/dax/super.c > +++ b/drivers/dax/super.c > @@ -100,7 +100,7 @@ bool __generic_fsdax_supported(struct dax_device *dax_dev, > return false; > } > > - if (!dax_dev && !bdev_dax_supported(bdev, blocksize)) { > + if (!dax_dev || !bdev_dax_supported(bdev, blocksize)) { > pr_debug("%s: error: dax unsupported by block device\n", > bdevname(bdev, buf)); > return false; > -- > 2.26.2 > _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org