From nobody Mon Feb 9 23:18:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556255420; cv=none; d=zoho.com; s=zohoarc; b=DTHsM+nx0f9EZCjiHW/UV8R18F1ppzi67TdtHF4dv8wG1HwcdNjbU7D1C0Qwo+IIzGMyjhXyoGkknqyYwvqKst/J+p/1qmX/EnQc5yE4quqJb3AalwKLFA/9enScTPz63WzHyhyGffDdKk2I0qOBJYGEKqIXUxpwHxpdiqm2IEA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556255420; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3XRir+iVZrkjIeSly6nV+sZWQo3KIe3lWGe5pvrCl6c=; b=cef9sUx9oyPq2m7JtP6mxiQvxBE3bJhfzXPTr0kLRvfOTJp/qa8YAC5KG0wSUxLtZ/oWGb7+L2eNxI3pt8vv4qQUFW8tM8J0Fc4DL9Z+R/XNWC/yzYXiFBrO6YSW8Nd0rzisgkqOXEsmq4N44OvPF9hrcardrWuwhH6b6YQf+z8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556255420584322.8979271328201; Thu, 25 Apr 2019 22:10:20 -0700 (PDT) Received: from localhost ([127.0.0.1]:39412 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJt7n-0004Yo-Lq for importer@patchew.org; Fri, 26 Apr 2019 01:10:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJt0M-0007MF-0v for qemu-devel@nongnu.org; Fri, 26 Apr 2019 01:02:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJt0L-0005R7-1y for qemu-devel@nongnu.org; Fri, 26 Apr 2019 01:02:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35558) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJt0K-0005Qv-RH for qemu-devel@nongnu.org; Fri, 26 Apr 2019 01:02:33 -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 C6ABE30A3AEC; Fri, 26 Apr 2019 05:02:31 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (unknown [10.65.16.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA0D160856; Fri, 26 Apr 2019 05:02:11 +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 Date: Fri, 26 Apr 2019 10:30:37 +0530 Message-Id: <20190426050039.17460-5-pagupta@redhat.com> In-Reply-To: <20190426050039.17460-1-pagupta@redhat.com> References: <20190426050039.17460-1-pagupta@redhat.com> 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.43]); Fri, 26 Apr 2019 05:02:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v7 4/6] dax: check synchronous mapping is supported X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pagupta@redhat.com, jack@suse.cz, mst@redhat.com, jasowang@redhat.com, david@fromorbit.com, lcapitulino@redhat.com, adilger.kernel@dilger.ca, zwisler@kernel.org, aarcange@redhat.com, dave.jiang@intel.com, darrick.wong@oracle.com, vishal.l.verma@intel.com, david@redhat.com, willy@infradead.org, hch@infradead.org, jmoyer@redhat.com, nilal@redhat.com, lenb@kernel.org, kilobyte@angband.pl, riel@surriel.com, yuval.shaia@oracle.com, stefanha@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com, kwolf@redhat.com, tytso@mit.edu, xiaoguangrong.eric@gmail.com, cohuck@redhat.com, rjw@rjwysocki.net, imammedo@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch introduces 'daxdev_mapping_supported' helper which checks if 'MAP_SYNC' is supported with filesystem mapping. It also checks if corresponding dax_device is synchronous. Virtio pmem device is asynchronous and does not not support VM_SYNC.=20 Suggested-by: Jan Kara Signed-off-by: Pankaj Gupta Reviewed-by: Jan Kara --- include/linux/dax.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/linux/dax.h b/include/linux/dax.h index c97fc0cc7167..41b4a5db6305 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -41,6 +41,18 @@ void kill_dax(struct dax_device *dax_dev); void dax_write_cache(struct dax_device *dax_dev, bool wc); bool dax_write_cache_enabled(struct dax_device *dax_dev); bool dax_synchronous(struct dax_device *dax_dev); +/* + * Check if given mapping is supported by the file / underlying device. + */ +static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, + struct dax_device *dax_dev) +{ + if (!(vma->vm_flags & VM_SYNC)) + return true; + if (!IS_DAX(file_inode(vma->vm_file))) + return false; + return dax_synchronous(dax_dev); +} #else static inline struct dax_device *dax_get_by_host(const char *host) { @@ -68,6 +80,11 @@ static inline bool dax_write_cache_enabled(struct dax_de= vice *dax_dev) { return false; } +static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, + struct dax_device *dax_dev) +{ + return !(vma->flags & VM_SYNC); +} #endif =20 struct writeback_control; --=20 2.20.1