Return-Path: 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 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 Sender: linux-ext4-owner@vger.kernel.org List-ID: > > > > 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 >