Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6461114yba; Tue, 14 May 2019 07:58:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQjtY8Y8UAu/NJcs20DTxQjX1wBZ4GW2sfElv90gzrogM0Qh7MeR7muGNAJKGe5hSZmCKN X-Received: by 2002:a17:902:ca:: with SMTP id a68mr12819932pla.7.1557845921134; Tue, 14 May 2019 07:58:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557845921; cv=none; d=google.com; s=arc-20160816; b=Da5SMxptvx4Iad/XSv+1+ilmXuiH2W7USQuXK9cGw1xFp3LVeuaecZjaL3HEPBN/gY Ru2LnnuT3Gg64fYn3j8VjenWMKbHpgAlYva2qYEex9JzQn1icEaATLyDxXCx/JREFnpi xJx7gbgmAuQLvNu00T/a2ej1quYGpPey215DdtF99nZK33u6ig/mw/lmmI8euUzJEsnP fZbDM40TtmfvEXhuzPiA8oHK9exlX71wFzv8thp/OdWyhA8dvzYBRiqnp3zK9Beaar03 DUuUPnGBGU5OXv4mRv1VSUOBtvzxrszgWzh4w5fXUwyTwge+FlmIYf/9WKt0XBWq+0W4 tT+Q== 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=LYpmG3wKPBJirzHEAklvxSC60LSIp2qv95rMEY7dPpnCritdfghHt1hu7TnQxtFCrJ TKLDs/E1zqL1L8rfwB6IeJbd/ZuQ/cvkpMuwmVvjX2MESKGxrAm760mzpObGVwF/WsD/ OnsA15D9+Fv9lIvoWkb/7VaNC59WuSaLFW7oj1uqOJzPjxoHJ2sgMOEUh4oQrh4Ggc2h bdRkrD401WOEXsxQKrCXGATLVmayULX5hkHjXMyuehbZmLi0znBf2x/uNFkbtfahC91Y WhPH6RVESSlHAptlBMaA8FQRdsLPWyol8x6McVI2Uyr3g56g2zYRprQpNGS5FcS9aSSQ QDBg== 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 v10si21248742pgj.576.2019.05.14.07.58.26; Tue, 14 May 2019 07:58:41 -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 S1726151AbfENO5q (ORCPT + 99 others); Tue, 14 May 2019 10:57:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51220 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbfENO5q (ORCPT ); Tue, 14 May 2019 10:57:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2EB5A307EA98; Tue, 14 May 2019 14:57:46 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (unknown [10.65.16.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 966CF5D6A6; Tue, 14 May 2019 14:57:23 +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 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, pbonzini@redhat.com, kilobyte@angband.pl, yuval.shaia@oracle.com, jstaron@google.com, pagupta@redhat.com Subject: [PATCH v9 4/7] dm: enable synchronous dax Date: Tue, 14 May 2019 20:24:19 +0530 Message-Id: <20190514145422.16923-5-pagupta@redhat.com> In-Reply-To: <20190514145422.16923-1-pagupta@redhat.com> References: <20190514145422.16923-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 14 May 2019 14:57:46 +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