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=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 BD7A3C4321A for ; Tue, 11 Jun 2019 16:04:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CD7E212F5 for ; Tue, 11 Jun 2019 16:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391825AbfFKQEl (ORCPT ); Tue, 11 Jun 2019 12:04:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54794 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390351AbfFKQEk (ORCPT ); Tue, 11 Jun 2019 12:04:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5E7847FDFE; Tue, 11 Jun 2019 16:04:32 +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 10197611DA; Tue, 11 Jun 2019 16:04:25 +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 D31A018363C0; Tue, 11 Jun 2019 16:04:21 +0000 (UTC) Date: Tue, 11 Jun 2019 12:04:21 -0400 (EDT) From: Pankaj Gupta To: Mike Snitzer Cc: rdunlap@infradead.org, 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, riel@surriel.com, yuval shaia , stefanha@redhat.com, imammedo@redhat.com, dan j williams , lcapitulino@redhat.com, kwolf@redhat.com, nilal@redhat.com, tytso@mit.edu, xiaoguangrong eric , cohuck@redhat.com, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, pbonzini@redhat.com, darrick wong Message-ID: <1006124881.34430329.1560269061491.JavaMail.zimbra@redhat.com> In-Reply-To: <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> <20190611150427.GA29288@redhat.com> Subject: Re: [Qemu-devel] [PATCH v11 4/7] dm: enable synchronous dax MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.116.60, 10.4.195.3] Thread-Topic: enable synchronous dax Thread-Index: H4DObhswv6RiIzHdNTVFv9g9Hzvnew== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 11 Jun 2019 16:04:40 +0000 (UTC) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org > > > 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 ^ Sure. Will remove this and send official v12 patchset with the updated patch 4. Thanks, Pankaj > > > 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 > >