From patchwork Thu Feb 1 00:13:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 10194949 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0D19760380 for ; Thu, 1 Feb 2018 00:13:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFB7128355 for ; Thu, 1 Feb 2018 00:13:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4270283CA; Thu, 1 Feb 2018 00:13:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1C23628355 for ; Thu, 1 Feb 2018 00:13:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0976E21E48F21; Wed, 31 Jan 2018 16:07:47 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=dave.jiang@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7A33622393654 for ; Wed, 31 Jan 2018 16:07:44 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2018 16:13:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,442,1511856000"; d="scan'208";a="14557980" Received: from djiang5-desk3.ch.intel.com ([143.182.136.93]) by orsmga008.jf.intel.com with ESMTP; 31 Jan 2018 16:13:20 -0800 Subject: [PATCH] xfs: fix rt_dev usage for DAX From: Dave Jiang To: darrick.wong@oracle.com Date: Wed, 31 Jan 2018 17:13:20 -0700 Message-ID: <151744400024.39505.6657033185117899561.stgit@djiang5-desk3.ch.intel.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-xfs@vger.kernel.org, linux-nvdimm@lists.01.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP When using realtime device (rtdev) with xfs where the data device is not DAX capable, two issues arise. One is when data device is not DAX but the realtime device is DAX capable, we currently disable DAX. After passing this check, we are also not marking the inode as DAX capable. This change will allow DAX enabled if the data device or the realtime device is DAX capable. S_DAX will be marked for the inode if the file is residing on a DAX capable device. This will prevent the case of rtdev is not DAX and data device is DAX to create realtime files. Signed-off-by: Dave Jiang Reported-by: Darrick Wong --- fs/xfs/xfs_iops.c | 3 ++- fs/xfs/xfs_super.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 56475fcd76f2..ab352c325301 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -1204,7 +1204,8 @@ xfs_diflags_to_iflags( ip->i_mount->m_sb.sb_blocksize == PAGE_SIZE && !xfs_is_reflink_inode(ip) && (ip->i_mount->m_flags & XFS_MOUNT_DAX || - ip->i_d.di_flags2 & XFS_DIFLAG2_DAX)) + ip->i_d.di_flags2 & XFS_DIFLAG2_DAX) && + blk_queue_dax(bdev_get_queue(inode->i_sb->s_bdev))) inode->i_flags |= S_DAX; } diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 1dacccc367f8..2b2a02bcf72e 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1653,7 +1653,7 @@ xfs_fs_fill_super( "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); error = bdev_dax_supported(sb, sb->s_blocksize); - if (error) { + if (error && !mp->m_rtdev_targp->bt_daxdev) { xfs_alert(mp, "DAX unsupported by block device. Turning off DAX."); mp->m_flags &= ~XFS_MOUNT_DAX;