From nobody Tue Nov 11 04:58:21 2025 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=1561125247; cv=none; d=zoho.com; s=zohoarc; b=oWPDAEySnAQieINbmtxUN0DbqxWAwb73mFTLts97vxGx+EOPRZR7YBclV8oD5IUEwjr84oE8bQwVWm7WEhtp3Ku+ccebQMqnmuegBXzjJFtWwDCZsrcSdFz/kzdRMIYy8gKI/eFKLB8F9n43XZi8OIfN6JpTlBOo3ie+r35Cep4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561125247; 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=Ux7DzIfMktgQm5rv6VGokNV1RzFK6nuqoUkwb7sq8Ms=; b=VtqpNxBWAaMt88OUjn0FClnfFG8XrVvvnrpc8q9nk4H7meHp/vHCOaT5ROZ8sfrzNSx2FHKL/XtnhUWnH51kQF+Qf7IfWECu0jmTGKf8WUNxkdyUfpS1L1Dj+OKPQDIF9Ww4fnpPTCsAHRhy8Ab3bT+6/7Wpa71dIgw4Zpc40NU= 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 15611252472011020.6651258306172; Fri, 21 Jun 2019 06:54:07 -0700 (PDT) Received: from localhost ([::1]:35174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1heJzQ-0004oV-P8 for importer@patchew.org; Fri, 21 Jun 2019 09:54:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55158) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1heJlg-0004OH-Gb for qemu-devel@nongnu.org; Fri, 21 Jun 2019 09:39:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1heJlf-0004oR-Cb for qemu-devel@nongnu.org; Fri, 21 Jun 2019 09:39:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33226) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1heJlf-0004iu-7p for qemu-devel@nongnu.org; Fri, 21 Jun 2019 09:39:51 -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 D9916307D850; Fri, 21 Jun 2019 13:39:44 +0000 (UTC) Received: from dhcp201-121.englab.pnq.redhat.com (ovpn-116-60.sin2.redhat.com [10.67.116.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CD9C5B689; Fri, 21 Jun 2019 13:38:46 +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 Date: Fri, 21 Jun 2019 19:04:53 +0530 Message-Id: <20190621133455.3303-6-pagupta@redhat.com> In-Reply-To: <20190621133455.3303-1-pagupta@redhat.com> References: <20190621133455.3303-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.48]); Fri, 21 Jun 2019 13:39:45 +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 v14 5/7] dax: check synchronous mapping is supported X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pagupta@redhat.com, rdunlap@infradead.org, jack@suse.cz, snitzer@redhat.com, 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, jstaron@google.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. 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 86fc55c99b58..d1bea3979b5a 100644 --- a/include/linux/dax.h +++ b/include/linux/dax.h @@ -53,6 +53,18 @@ static inline void set_dax_synchronous(struct dax_device= *dax_dev) { __set_dax_synchronous(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) { @@ -87,6 +99,11 @@ static inline bool dax_synchronous(struct dax_device *da= x_dev) static inline void set_dax_synchronous(struct dax_device *dax_dev) { } +static inline bool daxdev_mapping_supported(struct vm_area_struct *vma, + struct dax_device *dax_dev) +{ + return !(vma->vm_flags & VM_SYNC); +} #endif =20 struct writeback_control; --=20 2.20.1