From: Mike Snitzer Subject: Re: [PATCH v11 4/7] dm: enable synchronous dax Date: Tue, 11 Jun 2019 11:04:27 -0400 Message-ID: <20190611150427.GA29288@redhat.com> References: <20190610090730.8589-1-pagupta@redhat.com> <20190610090730.8589-5-pagupta@redhat.com> <20190610192803.GA29002@redhat.com> <1206355816.34396746.1560258658768.JavaMail.zimbra@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1206355816.34396746.1560258658768.JavaMail.zimbra@redhat.com> Sender: linux-kernel-owner@vger.kernel.org To: Pankaj Gupta Cc: cohuck@redhat.com, jack@suse.cz, kvm@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, david@fromorbit.com, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, dm-devel@redhat.com, adilger kernel , zwisler@kernel.org, aarcange@redhat.com, dave jiang , jstaron@google.com, linux-nvdimm@lists.01.org, vishal l verma , david@redhat.com, willy@infradead.org, hch@infradead.org, linux-acpi@vger.kernel.org, jmoyer@redhat.com, linux-ext4@vger.kernel.org, lenb@kernel.org, kilobyte@angband.pl, rdunlap@infradead.org, riel@surriel.com, yuval shaia , stefanha@redhat.com, pbonzini@redhat.com, dan j williams , lcapitulino@redhat.com, kwolf@redhat.com, nilal@r List-Id: dm-devel.ids On Tue, Jun 11 2019 at 9:10am -0400, Pankaj Gupta wrote: > Hi Mike, > > Thanks for the review Please find my reply inline. > > > > > dm_table_supports_dax() is called multiple times (from > > dm_table_set_restrictions and dm_table_determine_type). It is strange > > to have a getter have a side-effect of being a setter too. Overloading > > like this could get you in trouble in the future. > > > > Are you certain this is what you want? > > I agree with you. > > > > > Or would it be better to refactor dm_table_supports_dax() to take an > > iterate_devices_fn arg and have callers pass the appropriate function? > > Then have dm_table_set_restrictions() caller do: > > > > if (dm_table_supports_dax(t, device_synchronous, NULL)) > > set_dax_synchronous(t->md->dax_dev); > > > > (NULL arg implies dm_table_supports_dax() refactoring would take a int > > *data pointer rather than int type). > > > > Mike > > > > I am sending below patch as per your suggestion. Does it look > near to what you have in mind? Yes, it does.. just one nit I noticed inlined below. > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index 350cf0451456..8d89acc8b8c2 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c ... > @@ -1910,8 +1919,13 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q, > } > blk_queue_write_cache(q, wc, fua); > > - if (dm_table_supports_dax(t, PAGE_SIZE)) > + if (dm_table_supports_dax(t, device_supports_dax, &page_size)) { > + No need for an empty newline here ^ > blk_queue_flag_set(QUEUE_FLAG_DAX, q); > + if (dm_table_supports_dax(t, device_synchronous, NULL)) > + set_dax_synchronous(t->md->dax_dev); > + } > else > blk_queue_flag_clear(QUEUE_FLAG_DAX, q); > Thanks, Mike