diff mbox

[2/6] Btrfs: set single device limit for dax usecase

Message ID 1481147110-20048-3-git-send-email-bo.li.liu@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liu Bo Dec. 7, 2016, 9:45 p.m. UTC
Dax on btrfs is not ready for multiple device.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/ioctl.c | 6 ++++++
 fs/btrfs/super.c | 7 +++++++
 2 files changed, 13 insertions(+)

Comments

David Sterba Dec. 8, 2016, 1:35 p.m. UTC | #1
On Wed, Dec 07, 2016 at 01:45:06PM -0800, Liu Bo wrote:
> Dax on btrfs is not ready for multiple device.

How about DUP? Technically it's not multi-device but still stores
multiple copies, so I don't know if the implementation is ok with that.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Liu Bo Dec. 8, 2016, 3:19 p.m. UTC | #2
On Thu, Dec 08, 2016 at 02:35:59PM +0100, David Sterba wrote:
> On Wed, Dec 07, 2016 at 01:45:06PM -0800, Liu Bo wrote:
> > Dax on btrfs is not ready for multiple device.
> 
> How about DUP? Technically it's not multi-device but still stores
> multiple copies, so I don't know if the implementation is ok with that.

Good question.

For this patch set, meta DUP is OK while data DUP is not, the main
obstacle is that the actual copy-to-device operation happens in iomap
code (iomap_dax_actor), not inside filesystem itself, and it only takes
one <device, blocknum> pair to copy to device.

Thanks,

-liubo
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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