Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp968208ybm; Tue, 21 May 2019 06:42:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3ZIIVRGzE/SdjOjCVpaXc5xB8EWVmR/SgDf2J+nxf/4pDf3Tz5jAJqgNqHfuvvbPKcqIW X-Received: by 2002:a17:902:f20b:: with SMTP id gn11mr82517892plb.126.1558446172934; Tue, 21 May 2019 06:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558446172; cv=none; d=google.com; s=arc-20160816; b=0p3Fh+CFL7oitxcRT5rE5cc+m4RRBIJ/4P2uJYQZK3xrR0T0dy7fCtnEtW5USpfzXZ SxFfSLSEvQbRiHVbSBE+lIs9s/rP0FEBqcGqQ8EdxvW/xC/6xwYB6rqXiCQsnXaoQqnV KCXcrEJDEhKzAjIjPHzglPkxTLpV+vrx6axd7O6F+HQ45wiWEcIjXkKlfVywtx/OuIxv 4kYiYTGTilVKYAedVWpBV6bKDNGB5UFebwmedBSEuCp6jtejUX8DLZHjHa0WwH/LcfTj eZdz9y5d5avsZxPd8A+r0xFteWtv44josUfIRgV4kmjLRHpvkD2wllRkba6LtGtCNeqj qF/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=VT5J+VXjFBm0zPEPLoanyJIYX7unk2fuFFfr9nMDEmU=; b=C3TAVmZtCeI1QzZwiAELefd7WwXYrMZurtlhllZcC7FWQw1b7RcCs/TYuTYgYjj3iA r/A1kTsa1rDcrMKRNxD8ZBOpKIisIfadNwoiCRDO6w82qdBsE3Gc3y2FS0VJFU0UmUF3 vh1Y43B8Qt35imMBBTIWYpwvTrKBBCkVnxg/eoNA3e0d+la0+lzVBDt8bmrXpchRgXrK HGm+of53pj8AxqQYHDUsms3aPj/5QL4Db5T3Szj3EEI0xF/W/3RzX9yrfz8ODVrOTqDO 67liVn++DPvLC0/8ZcX+2zUkAFQ2dFamEkGE836Ka3U1KoUVaX+fo09Cmo9GFgmRPUGu Jzpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 k33si20804795pld.415.2019.05.21.06.42.39; Tue, 21 May 2019 06:42:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 S1728137AbfEUNmh (ORCPT + 99 others); Tue, 21 May 2019 09:42:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60550 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728053AbfEUNmg (ORCPT ); Tue, 21 May 2019 09:42:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB98B3003C76; Tue, 21 May 2019 13:42:20 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (ovpn-116-97.sin2.redhat.com [10.67.116.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 893ED100200D; Tue, 21 May 2019 13:40:31 +0000 (UTC) From: Pankaj Gupta To: linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-acpi@vger.kernel.org, qemu-devel@nongnu.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, dm-devel@redhat.com Cc: dan.j.williams@intel.com, zwisler@kernel.org, vishal.l.verma@intel.com, dave.jiang@intel.com, mst@redhat.com, jasowang@redhat.com, willy@infradead.org, rjw@rjwysocki.net, hch@infradead.org, lenb@kernel.org, jack@suse.cz, tytso@mit.edu, adilger.kernel@dilger.ca, darrick.wong@oracle.com, lcapitulino@redhat.com, kwolf@redhat.com, imammedo@redhat.com, jmoyer@redhat.com, nilal@redhat.com, riel@surriel.com, stefanha@redhat.com, aarcange@redhat.com, david@redhat.com, david@fromorbit.com, cohuck@redhat.com, xiaoguangrong.eric@gmail.com, pagupta@redhat.com, pbonzini@redhat.com, yuval.shaia@oracle.com, kilobyte@angband.pl, jstaron@google.com, rdunlap@infradead.org, snitzer@redhat.com Subject: [PATCH v10 4/7] dm: enable synchronous dax Date: Tue, 21 May 2019 19:07:10 +0530 Message-Id: <20190521133713.31653-5-pagupta@redhat.com> In-Reply-To: <20190521133713.31653-1-pagupta@redhat.com> References: <20190521133713.31653-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 21 May 2019 13:42:36 +0000 (UTC) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This patch sets dax device 'DAXDEV_SYNC' flag if all the target devices of device mapper support synchrononous DAX. If device mapper consists of both synchronous and asynchronous dax devices, we don't set 'DAXDEV_SYNC' flag. Signed-off-by: Pankaj Gupta --- drivers/md/dm-table.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index cde3b49b2a91..1cce626ff576 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -886,10 +886,17 @@ static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev, return bdev_dax_supported(dev->bdev, PAGE_SIZE); } +static int device_synchronous(struct dm_target *ti, struct dm_dev *dev, + sector_t start, sector_t len, void *data) +{ + return dax_synchronous(dev->dax_dev); +} + static bool dm_table_supports_dax(struct dm_table *t) { struct dm_target *ti; unsigned i; + bool dax_sync = true; /* Ensure that all targets support DAX. */ for (i = 0; i < dm_table_get_num_targets(t); i++) { @@ -901,7 +908,14 @@ static bool dm_table_supports_dax(struct dm_table *t) if (!ti->type->iterate_devices || !ti->type->iterate_devices(ti, device_supports_dax, NULL)) return false; + + /* Check devices support synchronous DAX */ + if (dax_sync && + !ti->type->iterate_devices(ti, device_synchronous, NULL)) + dax_sync = false; } + if (dax_sync) + set_dax_synchronous(t->md->dax_dev); return true; } -- 2.20.1