Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp702854ybf; Wed, 26 Feb 2020 21:33:05 -0800 (PST) X-Google-Smtp-Source: APXvYqx36+LcaftxNX7yHaIEaw+e03j2/9yyYRBb1Dd32cyzuBocMgoQdg9ZgVE9JntPlFup9hv1 X-Received: by 2002:a05:6808:8cd:: with SMTP id k13mr2125344oij.4.1582781585809; Wed, 26 Feb 2020 21:33:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582781585; cv=none; d=google.com; s=arc-20160816; b=CcTYsFBULe/tARV/dcNIih3zhkV5dgddQ8wL/fTACqflRaX3TQ/+Bir0upE7akfdNQ b8phInZI95LHFA6yzjLixJ+6BK1IrHviqV0FniRr2T92zrPWPNeDFeGcNuzKnaxI+wa3 CSuITdSU3C498lldQ54DJFcfv4J7mtz7pcKlEmU1RzrKSzYywg+gSpsY2xarDoDN9Yf1 xrWVXif/R0V+TiHhdd7XElxCDAwjfWmHMjVS5IsaZpyTBaOSjmyL/iNvYhaVIBghUb34 YYeFTA5CasyY90AQh/N/BkOi0W2O5Eqx/TFjQmrt9qt4q+6vwPzlrVgY8XBMBaoI//mJ kimQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ji5AOGAhHDrTe5KLr1YU0rFcwXpIh2jdhbGrcMjvoOU=; b=UYXFJcnsUXK6bL2ImBTrj0urQ2goNJa6dJ2xdiiXFvaKc59R69U3phZ1nukwybAZkc p/8UOq9dWlQ/AVMereD3php75D9XjB7ocRIl6TGsqKtyzsLJs+gupsuVOwNvklutIRWh XACIxZSdW5O6p1qYPPXJfyPSKWPkBIHT2aUWgEb3KlcPaj3OXjj9zi0IRTNd4UcFlmHA 7UL204ThzvJAMP2FT0u5YnmMitHPwZMPMzCbRSlIRPIQiBwcS0mHnLJvyqYmfXcFHHta HTd8oOdmkJ50RvfbM8x2n9Fv4k0SWKlp24C5H8lSiFEFyDADJw/zM3fkZtIc/Fu/+vLV zJaw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z20si709788oib.26.2020.02.26.21.32.54; Wed, 26 Feb 2020 21:33:05 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727631AbgB0Fcm (ORCPT + 99 others); Thu, 27 Feb 2020 00:32:42 -0500 Received: from mga18.intel.com ([134.134.136.126]:43439 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727399AbgB0Fcm (ORCPT ); Thu, 27 Feb 2020 00:32:42 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2020 21:32:41 -0800 X-IronPort-AV: E=Sophos;i="5.70,490,1574150400"; d="scan'208";a="385047236" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.157]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2020 21:32:40 -0800 From: ira.weiny@intel.com To: linux-kernel@vger.kernel.org Cc: Ira Weiny , Alexander Viro , "Darrick J. Wong" , Dan Williams , Dave Chinner , Christoph Hellwig , "Theodore Y. Ts'o" , Jan Kara , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH V5 04/12] fs/xfs: Isolate the physical DAX flag from enabled Date: Wed, 26 Feb 2020 21:24:34 -0800 Message-Id: <20200227052442.22524-5-ira.weiny@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200227052442.22524-1-ira.weiny@intel.com> References: <20200227052442.22524-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ira Weiny xfs_ioctl_setattr_dax_invalidate() currently checks if the DAX flag is changing as a quick check. But the implementation mixes the physical (XFS_DIFLAG2_DAX) and the enabled (S_DAX) DAX flags. Remove the use of the enabled flag when determining if a change of the physical flag is required. Furthermore, we want the physical flag, XFS_DIFLAG2_DAX, to be changed regardless of if the underlying storage can support DAX or not. The enabled flag, IS_DAX(), will be set later IFF the inode supports dax in a follow on patch. Signed-off-by: Ira Weiny --- Changes from V3: Remove the underlying storage support check Rework commit message Reorder patch --- fs/xfs/xfs_ioctl.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index d42de92cb283..25e12ce85075 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -1190,28 +1190,16 @@ xfs_ioctl_setattr_dax_invalidate( int *join_flags) { struct inode *inode = VFS_I(ip); - struct super_block *sb = inode->i_sb; int error; *join_flags = 0; - /* - * It is only valid to set the DAX flag on regular files and - * directories on filesystems where the block size is equal to the page - * size. On directories it serves as an inherited hint so we don't - * have to check the device for dax support or flush pagecache. - */ - if (fa->fsx_xflags & FS_XFLAG_DAX) { - struct xfs_buftarg *target = xfs_inode_buftarg(ip); - - if (!bdev_dax_supported(target->bt_bdev, sb->s_blocksize)) - return -EINVAL; - } - /* If the DAX state is not changing, we have nothing to do here. */ - if ((fa->fsx_xflags & FS_XFLAG_DAX) && IS_DAX(inode)) + if ((fa->fsx_xflags & FS_XFLAG_DAX) && + (ip->i_d.di_flags2 & XFS_DIFLAG2_DAX)) return 0; - if (!(fa->fsx_xflags & FS_XFLAG_DAX) && !IS_DAX(inode)) + if (!(fa->fsx_xflags & FS_XFLAG_DAX) && + !(ip->i_d.di_flags2 & XFS_DIFLAG2_DAX)) return 0; if (S_ISDIR(inode->i_mode)) -- 2.21.0