Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp589181yba; Wed, 3 Apr 2019 15:10:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9r3RflyMt6gcZPwNF/SCcUfFZV/JzgkUhhvp2vxPREocA3iTOb7jDvJXHT6+LM/L9a1YF X-Received: by 2002:a63:be02:: with SMTP id l2mr2065209pgf.48.1554329424818; Wed, 03 Apr 2019 15:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554329424; cv=none; d=google.com; s=arc-20160816; b=UbIodrzdi4seScipV631+gX8jQSSmUEkAn07xV082EsNxmtGr9woP3se6xKXN51gCd F9B8qsDaxaGwcY71HBDiSpoyoQzT0n/8ajVq5St6kc+SlhY+3h/8pE3xebr63N/Xs11P nIbFbhWI//gBTHxsDWUL23ET1XuOI8u1idf7OePzkX0uCTqg/TRQXwTXQ3rHfHc0oaPa NTbYlqJR7b9mg1li7ptmnKAHernrgEok6MIUQnr8DLI6FQJQWAN1qYo0qqgc6eMG45U2 V1+WPnqg7tuKJakV9gAFzjhGlnMF0YngBalLTY2Ml1vRGZ+RfhOdEGBSOQxcTdB1aKFT AIxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tZ3vwwLqjfruQpRKZFGUh/HqfkbtwFI9nW/uDn/APZY=; b=GFpMmYTXOvSV09p7TftkSKsX7b5eBxhs7SDDn/vezvr9MiUHgq3LCMiUj379GGvYlC wOfM/AOkQytysQ9IL+7nrKZ/SkQcDgCki8rD+6cUJujzuRyXW8Sosbhc3NANo/e9HGQM br00W/c0NvXeRwCQk6lKS7CQ1JuA1Q382VhTRnsOfb/+Cp6m5axTJr+B71fkvy/UQst2 gyZV0RMyVRl/ndIAv6vtQtdMM2+doc7mgY0UDGgmScBXQmJ1+KtQBifTNWptwnHrFfUd BNFgWOff/xzccgfjsKYk9WSQ5ckv3dkfUIPoFQN/x0RnH15RIuJk17wNHQr4LqdiD1+P 3+Xg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l65si14720274pgl.368.2019.04.03.15.10.08; Wed, 03 Apr 2019 15:10:24 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726477AbfDCWJT (ORCPT + 99 others); Wed, 3 Apr 2019 18:09:19 -0400 Received: from ipmail03.adl6.internode.on.net ([150.101.137.143]:44905 "EHLO ipmail03.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726316AbfDCWJS (ORCPT ); Wed, 3 Apr 2019 18:09:18 -0400 Received: from ppp59-167-129-252.static.internode.on.net (HELO dastard) ([59.167.129.252]) by ipmail03.adl6.internode.on.net with ESMTP; 04 Apr 2019 08:39:14 +1030 Received: from dave by dastard with local (Exim 4.80) (envelope-from ) id 1hBo4G-0008N8-Ip; Thu, 04 Apr 2019 09:09:12 +1100 Date: Thu, 4 Apr 2019 09:09:12 +1100 From: Dave Chinner To: Pankaj Gupta Cc: 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, 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, cohuck@redhat.com, xiaoguangrong.eric@gmail.com Subject: Re: [PATCH v4 5/5] xfs: disable map_sync for async flush Message-ID: <20190403220912.GB26298@dastard> References: <20190403104018.23947-1-pagupta@redhat.com> <20190403104018.23947-6-pagupta@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190403104018.23947-6-pagupta@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 03, 2019 at 04:10:18PM +0530, Pankaj Gupta wrote: > Virtio pmem provides asynchronous host page cache flush > mechanism. we don't support 'MAP_SYNC' with virtio pmem > and xfs. > > Signed-off-by: Pankaj Gupta > --- > fs/xfs/xfs_file.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c > index 1f2e2845eb76..dced2eb8c91a 100644 > --- a/fs/xfs/xfs_file.c > +++ b/fs/xfs/xfs_file.c > @@ -1203,6 +1203,14 @@ xfs_file_mmap( > if (!IS_DAX(file_inode(filp)) && (vma->vm_flags & VM_SYNC)) > return -EOPNOTSUPP; > > + /* We don't support synchronous mappings with DAX files if > + * dax_device is not synchronous. > + */ > + if (IS_DAX(file_inode(filp)) && !dax_synchronous( > + xfs_find_daxdev_for_inode(file_inode(filp))) && > + (vma->vm_flags & VM_SYNC)) > + return -EOPNOTSUPP; > + > file_accessed(filp); > vma->vm_ops = &xfs_file_vm_ops; > if (IS_DAX(file_inode(filp))) All this ad hoc IS_DAX conditional logic is getting pretty nasty. xfs_file_mmap( .... { struct inode *inode = file_inode(filp); if (vma->vm_flags & VM_SYNC) { if (!IS_DAX(inode)) return -EOPNOTSUPP; if (!dax_synchronous(xfs_find_daxdev_for_inode(inode)) return -EOPNOTSUPP; } file_accessed(filp); vma->vm_ops = &xfs_file_vm_ops; if (IS_DAX(inode)) vma->vm_flags |= VM_HUGEPAGE; return 0; } Even better, factor out all the "MAP_SYNC supported" checks into a helper so that the filesystem code just doesn't have to care about the details of checking for DAX+MAP_SYNC support.... Cheers, Dave. -- Dave Chinner david@fromorbit.com