Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1146142imu; Wed, 9 Jan 2019 12:29:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN5V52TIqYUZkyOWTzUFyTUcugTtpsv6QLZigoa1SKfJ5g7xLKFJvHsALv5VaZ19KC2hZmhh X-Received: by 2002:a63:5c22:: with SMTP id q34mr6681814pgb.417.1547065746873; Wed, 09 Jan 2019 12:29:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547065746; cv=none; d=google.com; s=arc-20160816; b=ijSessIfrVBsam9WrsDW8EOyyPlXpSfYBjC56dIiH6t7VA94sUlptjypG3gbNgzQoD X9NxfOL+Z1LXgLgNPCJ/YKZqf7F8DC7izeuXsMwCbPk0lzwpUOfo6llZ64Sm4JT7B6gI MrbSza3h3q+ckgiSAZuHmSgsRRqXwu8G+4v3v3tqP2jsGhJVi4XcEIXwqjjMw0QM2nCu yWxCUbV1hbLG9Z82eAnVyClGFoXGVZX40Wil4PmbxCENtT77A3G0RjRIUL6HcGMKZB4G FNlkoKnMMhV8XonUvmjO7Lq5/d5Xa2U2VBl2auhYAMkVszhbdLmvE2JiIgShXzY0XbVJ UnFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=62mSYN8AC7vkkFNcvnsBqlEIgEiGbNpS44rMKwqAojY=; b=P6pE+3wRPd/NibHBHiXujWj0N3aCJnvW3QGTRVjRDV5K4x3EzzbZRHPEXmbZnFe+XW VYcgmqNp9x2KcR7Fd035tknF1ghuh7GVKqykBtC46vrfFxuZneHukTe3CQS3oTLvVSAg yb6f5oQsWAOXFvdULQOa7FCD+LuiOW9tbei4hGF9xYT0H5xaPNuKpJLr6BoI5PH1450q eceB2dwyenhsth9E7Bo4kcjBm12DkUbDo25nRDv8HkGgpKOiPiZlmNV4vWb7fLiJg2ZL ppnYrCOOPybVKsORi/C1dENm57VDJ1Zd4TlRgYRyYML9PFtW4G0LXwR6EDStUAbPM4vU /t3Q== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si19782799pgj.255.2019.01.09.12.28.51; Wed, 09 Jan 2019 12:29:06 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726767AbfAISVb (ORCPT + 99 others); Wed, 9 Jan 2019 13:21:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55068 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726570AbfAISVb (ORCPT ); Wed, 9 Jan 2019 13:21:31 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED156C057F37; Wed, 9 Jan 2019 18:21:29 +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 CD34C60C45; Wed, 9 Jan 2019 18:21:29 +0000 (UTC) Received: from zmail21.collab.prod.int.phx2.redhat.com (zmail21.collab.prod.int.phx2.redhat.com [10.5.83.24]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8160C1808855; Wed, 9 Jan 2019 18:21:29 +0000 (UTC) Date: Wed, 9 Jan 2019 13:21:29 -0500 (EST) From: Pankaj Gupta To: Dan Williams Cc: Linux Kernel Mailing List , KVM list , Qemu Developers , linux-nvdimm , linux-fsdevel , virtualization@lists.linux-foundation.org, Linux ACPI , linux-ext4 , linux-xfs , Jan Kara , Stefan Hajnoczi , Rik van Riel , Nitesh Narayan Lal , Kevin Wolf , Paolo Bonzini , Ross Zwisler , Vishal L Verma , Dave Jiang , David Hildenbrand , jmoyer , Xiao Guangrong , Christoph Hellwig , "Michael S. Tsirkin" , Jason Wang , lcapitulino@redhat.com, Igor Mammedov , Eric Blake , Matthew Wilcox , Theodore Ts'o , Andreas Dilger , "Darrick J. Wong" , "Rafael J. Wysocki" Message-ID: <888499462.61280342.1547058089165.JavaMail.zimbra@redhat.com> In-Reply-To: References: <20190109135024.14093-1-pagupta@redhat.com> <20190109135024.14093-4-pagupta@redhat.com> Subject: Re: [PATCH v3 3/5] libnvdimm: add nd_region buffered dax_dev flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.116.35, 10.4.195.5] Thread-Topic: libnvdimm: add nd_region buffered dax_dev flag Thread-Index: rl0HzDCQAa/d1317fPlnfOMP97TLNA== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 09 Jan 2019 18:21:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > This patch adds 'DAXDEV_BUFFERED' flag which is set > > for virtio pmem corresponding nd_region. This later > > is used to disable MAP_SYNC functionality for ext4 > > & xfs filesystem. > > > > Signed-off-by: Pankaj Gupta > > --- > > drivers/dax/super.c | 17 +++++++++++++++++ > > drivers/nvdimm/pmem.c | 3 +++ > > drivers/nvdimm/region_devs.c | 7 +++++++ > > drivers/virtio/pmem.c | 1 + > > include/linux/dax.h | 9 +++++++++ > > include/linux/libnvdimm.h | 6 ++++++ > > 6 files changed, 43 insertions(+) > > > > diff --git a/drivers/dax/super.c b/drivers/dax/super.c > > index 6e928f3..9128740 100644 > > --- a/drivers/dax/super.c > > +++ b/drivers/dax/super.c > > @@ -167,6 +167,8 @@ enum dax_device_flags { > > DAXDEV_ALIVE, > > /* gate whether dax_flush() calls the low level flush routine */ > > DAXDEV_WRITE_CACHE, > > + /* flag to disable MAP_SYNC for virtio based host page cache flush > > */ > > + DAXDEV_BUFFERED, > > }; > > > > /** > > @@ -335,6 +337,21 @@ bool dax_write_cache_enabled(struct dax_device > > *dax_dev) > > } > > EXPORT_SYMBOL_GPL(dax_write_cache_enabled); > > > > +void virtio_pmem_host_cache(struct dax_device *dax_dev, bool wc) > > +{ > > + if (wc) > > + set_bit(DAXDEV_BUFFERED, &dax_dev->flags); > > + else > > + clear_bit(DAXDEV_BUFFERED, &dax_dev->flags); > > +} > > +EXPORT_SYMBOL_GPL(virtio_pmem_host_cache); > > The "write_cache" property was structured this way because it can > conceivably change at runtime. The MAP_SYNC capability should be > static and never changed after init. o.k. Will change. > > > +bool virtio_pmem_host_cache_enabled(struct dax_device *dax_dev) > > +{ > > + return test_bit(DAXDEV_BUFFERED, &dax_dev->flags); > > +} > > +EXPORT_SYMBOL_GPL(virtio_pmem_host_cache_enabled); > > Echoing Darrick and Jan this is should be a generic property of a > dax_device and not specific to virtio. I don't like the "buffered" > designation as that's not accurate. There may be hardware reasons why > a dax_device is not synchronous, like a requirement to flush a > write-pending queue or otherwise notify the device of new writes. Agree. > > I would just have a dax_synchronous() helper and a DAXDEV_SYNC flag. I > would also modify alloc_dax() to take a flags argument so that the > capability can be instantiated when the dax_device is allocated. o.k. Will make the change. Thanks, Pankaj >