Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1265952ybv; Thu, 20 Feb 2020 16:43:23 -0800 (PST) X-Google-Smtp-Source: APXvYqyrZeAMXdb82CFRKqOsqqYcKqKX3anjosjjbjBOQNprkwNL+83GNHwpa5ImVuP+o+Km6omO X-Received: by 2002:a9d:7e8c:: with SMTP id m12mr27054902otp.346.1582245803269; Thu, 20 Feb 2020 16:43:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582245803; cv=none; d=google.com; s=arc-20160816; b=jXrQiDY+7wekc4GdIa8HkfwiEZb1KaLk1cIuP35O+3eepwy3yTM3Km0YXkezRdzraD Y3zGqjouWZA1Ig3w29tzSHCjX1iK3ppmqPGc7Ri0o1lETkMWg+dvvGb0Hx/qfkMQzfGt ofNunGIaaoYTbmpahYvv0Lz4vC921Zn+Wr32l4Yk39CAQKDd/vHxnQ4H3IVxh7J+eKhn j4lcngdTYGzHH0JkZI+8UHW9t8mv6PE/ezAEiAKMyp19DlgguAK3/ievismfRpDvpl4A ypKGLXODa3nkauVRbk9ZipnDPKawZ9v57WRHLvi6IwbPnI8tU9L/qA+SV1OXlQrXVfsV lrYg== 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=mb9cEd+zoJid0pTdDCLPc75KtOtYhZz0JwGuDP0ch8v900GEMcmLqNTYCoj2sAAyEu qZi9weToEplhKH0ouyggR8U7BzdtKOLE2B0lHu0BmbJkrwaBLz/2NBaDjTKwVdA/14ln h16+qpt4ySUdwG2l9vlGEHHNZnpLOVDbhH1fpBvecAaUmZNUmNN3/ZpqU6kxAnbeJ05K w+RNLHBcbrrgrgtpRhjMGVYsFaujbILNNkSRF0UkXJI32b6rICSi2MNdpujrl/z3RV65 SZz5QirmnJRKdOrz5uOBglimxyrjpeQoiIe9BrMUyo1gzP5UnuF5KYOnmRO2gPyj7IS6 ljNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 y24si502503oih.24.2020.02.20.16.43.13; Thu, 20 Feb 2020 16:43:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 S1729685AbgBUAml (ORCPT + 99 others); Thu, 20 Feb 2020 19:42:41 -0500 Received: from mga11.intel.com ([192.55.52.93]:31906 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729584AbgBUAlm (ORCPT ); Thu, 20 Feb 2020 19:41:42 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2020 16:41:42 -0800 X-IronPort-AV: E=Sophos;i="5.70,466,1574150400"; d="scan'208";a="229063093" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.157]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Feb 2020 16:41:41 -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 V4 05/13] fs/xfs: Isolate the physical DAX flag from enabled Date: Thu, 20 Feb 2020 16:41:26 -0800 Message-Id: <20200221004134.30599-6-ira.weiny@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200221004134.30599-1-ira.weiny@intel.com> References: <20200221004134.30599-1-ira.weiny@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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