From patchwork Wed Dec 7 21:45:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Bo X-Patchwork-Id: 9465259 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 0E2FA60236 for ; Wed, 7 Dec 2016 21:37:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EAFD628533 for ; Wed, 7 Dec 2016 21:37:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFCBF28589; Wed, 7 Dec 2016 21:37:50 +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=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8754028533 for ; Wed, 7 Dec 2016 21:37:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933002AbcLGVhk (ORCPT ); Wed, 7 Dec 2016 16:37:40 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:43340 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932887AbcLGVhg (ORCPT ); Wed, 7 Dec 2016 16:37:36 -0500 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uB7LbUnI028183 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 7 Dec 2016 21:37:30 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id uB7LbUgZ005444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 7 Dec 2016 21:37:30 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id uB7LbSfW017098; Wed, 7 Dec 2016 21:37:29 GMT Received: from localhost.us.oracle.com (/10.211.47.181) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 07 Dec 2016 13:37:28 -0800 From: Liu Bo To: linux-btrfs@vger.kernel.org Cc: Chris Mason , Jan Kara , David Sterba Subject: [PATCH 2/6] Btrfs: set single device limit for dax usecase Date: Wed, 7 Dec 2016 13:45:06 -0800 Message-Id: <1481147110-20048-3-git-send-email-bo.li.liu@oracle.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1481147110-20048-1-git-send-email-bo.li.liu@oracle.com> References: <1481147110-20048-1-git-send-email-bo.li.liu@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Dax on btrfs is not ready for multiple device. Signed-off-by: Liu Bo --- fs/btrfs/ioctl.c | 6 ++++++ fs/btrfs/super.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 7acbd2c..ab30d88 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2663,6 +2663,12 @@ static long btrfs_ioctl_add_dev(struct btrfs_root *root, void __user *arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; + if (btrfs_test_opt(root->fs_info, DAX)) { + btrfs_info(root->fs_info, + "dax doesn't support multiple devices\n"); + return -EOPNOTSUPP; + } + if (atomic_xchg(&root->fs_info->mutually_exclusive_operation_running, 1)) { return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS; diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 9b18f3d..8cb94ab 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -475,6 +475,13 @@ int btrfs_parse_options(struct btrfs_root *root, char *options, #ifdef CONFIG_FS_DAX case Opt_dax: btrfs_set_and_info(info, DAX, "setting dax"); + if (btrfs_super_num_devices(info->super_copy) > 1) { + btrfs_info(info, + "dax doesn't support multiple devices(%llu)\n", + btrfs_super_num_devices(info->super_copy)); + ret = -EOPNOTSUPP; + goto out; + } /* * sb->s_blocksize is set to root->sectorsize * sb->s_bdev is required, but btrfs doesn't set it