Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2986225ybi; Mon, 10 Jun 2019 02:12:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyLSUL374/q+WQ6eo4DZnsCiTHF5w3vrqaKIybvD/Mvq1+kt4P3KufAhdzU0M/uEkTWTOXy X-Received: by 2002:aa7:8d4d:: with SMTP id s13mr64446690pfe.259.1560157925622; Mon, 10 Jun 2019 02:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560157925; cv=none; d=google.com; s=arc-20160816; b=ZKHQoXgysG/NvsBsg5dLx2HXmLD0pGHF9VK2+TspLbqYL1L+5PIsg9GkAdr6hxWUHE x24nUWozwO1G488SJax1WYc5yBFgAmYbhXWUz1A8trijAIGsLwkE4q26w4otDhb6/tE1 PzRl8syCHeG2da7QIUwVnWp/eCD1KT+ykqFnB2RFkZMCloZnOZU6y1NGF44Tch17hg4s kvtH0JuprnKNnXac+UUbJVMhsi0CoZjjC/cxkRSi9zEmwH2XRGg6gQe4sTfJJLTtIhJk RsQsR8JAs6kzXMpSgKwlNdV180WDTq24eaFqAWeoj6VO1aHMjdFIFpXqnbk0Lb+KQKQ7 OOfA== 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=OoQeBLREZNJfGQWiBuTpzafoz+iNUKK/AKoNtzxxBac=; b=ilKGHda/uhnvQv6KkHaIxI0yMiocGszhJfEHPiQeJDMvB+J5GsAK6wQ0pfbkz7J5ff tMe5MZge7si+ZrauHzeSXmmB+C2UzernKFsIJK/JA8rUBUA4rpoi+nj1aaTO9XWwQoAk RcoQtaBbINnFqvGXLMWojm11IRlWmd0DipxJt+ejZB+BxYZSA2b20MbIBOpgyllX//F6 y7aUbb9HD8IVHoZOlC5VFYojkcBPXI69Lm6FKQcBAeS8mAdqfrgsNRZXFIqqLC3E0ktJ eBHWUM0RMybcHkc4sbVo4l1vuc1qV1gYrQqh3B5iHAg5iV0evNEq6gI8sy2f2i0+bb9b aLBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 s13si9078300pgs.446.2019.06.10.02.11.49; Mon, 10 Jun 2019 02:12:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S2388890AbfFJJLK (ORCPT + 99 others); Mon, 10 Jun 2019 05:11:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38742 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388552AbfFJJLJ (ORCPT ); Mon, 10 Jun 2019 05:11:09 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EC5B3084021; Mon, 10 Jun 2019 09:11:09 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (ovpn-116-103.sin2.redhat.com [10.67.116.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3D0160BF1; Mon, 10 Jun 2019 09:10:33 +0000 (UTC) From: Pankaj Gupta To: dm-devel@redhat.com, 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, yuval.shaia@oracle.com, kilobyte@angband.pl, jstaron@google.com, rdunlap@infradead.org, snitzer@redhat.com, pagupta@redhat.com Subject: [PATCH v11 4/7] dm: enable synchronous dax Date: Mon, 10 Jun 2019 14:37:27 +0530 Message-Id: <20190610090730.8589-5-pagupta@redhat.com> In-Reply-To: <20190610090730.8589-1-pagupta@redhat.com> References: <20190610090730.8589-1-pagupta@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Mon, 10 Jun 2019 09:11:09 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 350cf0451456..c5160d846fe6 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -890,10 +890,17 @@ static int device_supports_dax(struct dm_target *ti, struct dm_dev *dev, start, len); } +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); +} + bool dm_table_supports_dax(struct dm_table *t, int blocksize) { 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++) { @@ -906,7 +913,14 @@ bool dm_table_supports_dax(struct dm_table *t, int blocksize) !ti->type->iterate_devices(ti, device_supports_dax, &blocksize)) 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