summaryrefslogtreecommitdiff
path: root/fs/fuse/dax.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2020-08-19 18:19:47 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2020-09-10 11:39:22 +0200
commit1dd539577c42b67da796e2e758e04171bb889779 (patch)
treeec3e67b9b630f9803c9f01d8ebaabb9a9db3ea1d /fs/fuse/dax.c
parent22f3787e9d95e72d1f09795f294fb010e2998f43 (diff)
virtiofs: add a mount option to enable dax
Add a mount option to allow using dax with virtio_fs. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/dax.c')
-rw-r--r--fs/fuse/dax.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
new file mode 100644
index 000000000000..9660d01f49a5
--- /dev/null
+++ b/fs/fuse/dax.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * dax: direct host memory access
+ * Copyright (C) 2020 Red Hat, Inc.
+ */
+
+#include "fuse_i.h"
+
+#include <linux/dax.h>
+
+struct fuse_conn_dax {
+ /* DAX device */
+ struct dax_device *dev;
+};
+
+void fuse_dax_conn_free(struct fuse_conn *fc)
+{
+ kfree(fc->dax);
+}
+
+int fuse_dax_conn_alloc(struct fuse_conn *fc, struct dax_device *dax_dev)
+{
+ struct fuse_conn_dax *fcd;
+
+ if (!dax_dev)
+ return 0;
+
+ fcd = kzalloc(sizeof(*fcd), GFP_KERNEL);
+ if (!fcd)
+ return -ENOMEM;
+
+ fcd->dev = dax_dev;
+
+ fc->dax = fcd;
+ return 0;
+}