summaryrefslogtreecommitdiffstats
path: root/src/spdk/module/blob
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/spdk/module/blob/Makefile44
-rw-r--r--src/spdk/module/blob/bdev/Makefile45
-rw-r--r--src/spdk/module/blob/bdev/blob_bdev.c390
-rw-r--r--src/spdk/module/blob/bdev/spdk_blob_bdev.map10
-rw-r--r--src/spdk/module/blobfs/Makefile44
-rw-r--r--src/spdk/module/blobfs/bdev/Makefile51
-rw-r--r--src/spdk/module/blobfs/bdev/blobfs_bdev.c361
-rw-r--r--src/spdk/module/blobfs/bdev/blobfs_bdev_rpc.c344
-rw-r--r--src/spdk/module/blobfs/bdev/blobfs_fuse.c358
-rw-r--r--src/spdk/module/blobfs/bdev/blobfs_fuse.h52
-rw-r--r--src/spdk/module/blobfs/bdev/spdk_blobfs_bdev.map8
11 files changed, 1707 insertions, 0 deletions
diff --git a/src/spdk/module/blob/Makefile b/src/spdk/module/blob/Makefile
new file mode 100644
index 000000000..744a0a4a4
--- /dev/null
+++ b/src/spdk/module/blob/Makefile
@@ -0,0 +1,44 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
+include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
+
+DIRS-y = bdev
+
+.PHONY: all clean $(DIRS-y)
+
+all: $(DIRS-y)
+clean: $(DIRS-y)
+
+include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk
diff --git a/src/spdk/module/blob/bdev/Makefile b/src/spdk/module/blob/bdev/Makefile
new file mode 100644
index 000000000..d40f6afb8
--- /dev/null
+++ b/src/spdk/module/blob/bdev/Makefile
@@ -0,0 +1,45 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
+include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
+
+SO_VER := 3
+SO_MINOR := 0
+
+C_SRCS = blob_bdev.c
+LIBNAME = blob_bdev
+
+SPDK_MAP_FILE = $(abspath $(CURDIR)/spdk_blob_bdev.map)
+
+include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk
diff --git a/src/spdk/module/blob/bdev/blob_bdev.c b/src/spdk/module/blob/bdev/blob_bdev.c
new file mode 100644
index 000000000..67949fcfe
--- /dev/null
+++ b/src/spdk/module/blob/bdev/blob_bdev.c
@@ -0,0 +1,390 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright (c) Intel Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "spdk/stdinc.h"
+
+#include "spdk/blob_bdev.h"
+#include "spdk/blob.h"
+#include "spdk/thread.h"
+#include "spdk/log.h"
+#include "spdk/endian.h"
+#include "spdk/bdev_module.h"
+
+struct blob_bdev {
+ struct spdk_bs_dev bs_dev;
+ struct spdk_bdev *bdev;
+ struct spdk_bdev_desc *desc;
+ bool claimed;
+};
+
+struct blob_resubmit {
+ struct spdk_bdev_io_wait_entry bdev_io_wait;
+ enum spdk_bdev_io_type io_type;
+ struct spdk_bs_dev *dev;
+ struct spdk_io_channel *channel;
+ void *payload;
+ int iovcnt;
+ uint64_t lba;
+ uint32_t lba_count;
+ struct spdk_bs_dev_cb_args *cb_args;
+};
+static void bdev_blob_resubmit(void *);
+
+static inline struct spdk_bdev_desc *
+__get_desc(struct spdk_bs_dev *dev)
+{
+ return ((struct blob_bdev *)dev)->desc;
+}
+
+static inline struct spdk_bdev *
+__get_bdev(struct spdk_bs_dev *dev)
+{
+ return ((struct blob_bdev *)dev)->bdev;
+}
+
+static void
+bdev_blob_io_complete(struct spdk_bdev_io *bdev_io, bool success, void *arg)
+{
+ struct spdk_bs_dev_cb_args *cb_args = arg;
+ int bserrno;
+
+ if (success) {
+ bserrno = 0;
+ } else {
+ bserrno = -EIO;
+ }
+ cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, bserrno);
+ spdk_bdev_free_io(bdev_io);
+}
+
+static void
+bdev_blob_queue_io(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, void *payload,
+ int iovcnt,
+ uint64_t lba, uint32_t lba_count, enum spdk_bdev_io_type io_type,
+ struct spdk_bs_dev_cb_args *cb_args)
+{
+ int rc;
+ struct spdk_bdev *bdev = __get_bdev(dev);
+ struct blob_resubmit *ctx;
+
+ ctx = calloc(1, sizeof(struct blob_resubmit));
+
+ if (ctx == NULL) {
+ SPDK_ERRLOG("Not enough memory to queue io\n");
+ cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, -ENOMEM);
+ return;
+ }
+
+ ctx->io_type = io_type;
+ ctx->dev = dev;
+ ctx->channel = channel;
+ ctx->payload = payload;
+ ctx->iovcnt = iovcnt;
+ ctx->lba = lba;
+ ctx->lba_count = lba_count;
+ ctx->cb_args = cb_args;
+ ctx->bdev_io_wait.bdev = bdev;
+ ctx->bdev_io_wait.cb_fn = bdev_blob_resubmit;
+ ctx->bdev_io_wait.cb_arg = ctx;
+
+ rc = spdk_bdev_queue_io_wait(bdev, channel, &ctx->bdev_io_wait);
+ if (rc != 0) {
+ SPDK_ERRLOG("Queue io failed, rc=%d\n", rc);
+ cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, rc);
+ free(ctx);
+ assert(false);
+ }
+}
+
+static void
+bdev_blob_read(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, void *payload,
+ uint64_t lba, uint32_t lba_count, struct spdk_bs_dev_cb_args *cb_args)
+{
+ int rc;
+
+ rc = spdk_bdev_read_blocks(__get_desc(dev), channel, payload, lba,
+ lba_count, bdev_blob_io_complete, cb_args);
+ if (rc == -ENOMEM) {
+ bdev_blob_queue_io(dev, channel, payload, 0, lba,
+ lba_count, SPDK_BDEV_IO_TYPE_READ, cb_args);
+ } else if (rc != 0) {
+ cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, rc);
+ }
+}
+
+static void
+bdev_blob_write(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, void *payload,
+ uint64_t lba, uint32_t lba_count, struct spdk_bs_dev_cb_args *cb_args)
+{
+ int rc;
+
+ rc = spdk_bdev_write_blocks(__get_desc(dev), channel, payload, lba,
+ lba_count, bdev_blob_io_complete, cb_args);
+ if (rc == -ENOMEM) {
+ bdev_blob_queue_io(dev, channel, payload, 0, lba,
+ lba_count, SPDK_BDEV_IO_TYPE_WRITE, cb_args);
+ } else if (rc != 0) {
+ cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, rc);
+ }
+}
+
+static void
+bdev_blob_readv(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
+ struct iovec *iov, int iovcnt,
+ uint64_t lba, uint32_t lba_count, struct spdk_bs_dev_cb_args *cb_args)
+{
+ int rc;
+
+ rc = spdk_bdev_readv_blocks(__get_desc(dev), channel, iov, iovcnt, lba,
+ lba_count, bdev_blob_io_complete, cb_args);
+ if (rc == -ENOMEM) {
+ bdev_blob_queue_io(dev, channel, iov, iovcnt, lba,
+ lba_count, SPDK_BDEV_IO_TYPE_READ, cb_args);
+ } else if (rc != 0) {
+ cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, rc);
+ }
+}
+
+static void
+bdev_blob_writev(struct spdk_bs_dev *dev, struct spdk_io_channel *channel,
+ struct iovec *iov, int iovcnt,
+ uint64_t lba, uint32_t lba_count, struct spdk_bs_dev_cb_args *cb_args)
+{
+ int rc;
+
+ rc = spdk_bdev_writev_blocks(__get_desc(dev), channel, iov, iovcnt, lba,
+ lba_count, bdev_blob_io_complete, cb_args);
+ if (rc == -ENOMEM) {
+ bdev_blob_queue_io(dev, channel, iov, iovcnt, lba,
+ lba_count, SPDK_BDEV_IO_TYPE_WRITE, cb_args);
+ } else if (rc != 0) {
+ cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, rc);
+ }
+}
+
+static void
+bdev_blob_write_zeroes(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, uint64_t lba,
+ uint32_t lba_count, struct spdk_bs_dev_cb_args *cb_args)
+{
+ int rc;
+
+ rc = spdk_bdev_write_zeroes_blocks(__get_desc(dev), channel, lba,
+ lba_count, bdev_blob_io_complete, cb_args);
+ if (rc == -ENOMEM) {
+ bdev_blob_queue_io(dev, channel, NULL, 0, lba,
+ lba_count, SPDK_BDEV_IO_TYPE_WRITE_ZEROES, cb_args);
+ } else if (rc != 0) {
+ cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, rc);
+ }
+}
+
+static void
+bdev_blob_unmap(struct spdk_bs_dev *dev, struct spdk_io_channel *channel, uint64_t lba,
+ uint32_t lba_count, struct spdk_bs_dev_cb_args *cb_args)
+{
+ struct blob_bdev *blob_bdev = (struct blob_bdev *)dev;
+ int rc;
+
+ if (spdk_bdev_io_type_supported(blob_bdev->bdev, SPDK_BDEV_IO_TYPE_UNMAP)) {
+ rc = spdk_bdev_unmap_blocks(__get_desc(dev), channel, lba, lba_count,
+ bdev_blob_io_complete, cb_args);
+ if (rc == -ENOMEM) {
+ bdev_blob_queue_io(dev, channel, NULL, 0, lba,
+ lba_count, SPDK_BDEV_IO_TYPE_UNMAP, cb_args);
+ } else if (rc != 0) {
+ cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, rc);
+ }
+ } else {
+ /*
+ * If the device doesn't support unmap, immediately complete
+ * the request. Blobstore does not rely on unmap zeroing
+ * data.
+ */
+ cb_args->cb_fn(cb_args->channel, cb_args->cb_arg, 0);
+ }
+}
+
+static void
+bdev_blob_resubmit(void *arg)
+{
+ struct blob_resubmit *ctx = (struct blob_resubmit *) arg;
+
+ switch (ctx->io_type) {
+ case SPDK_BDEV_IO_TYPE_READ:
+ if (ctx->iovcnt > 0) {
+ bdev_blob_readv(ctx->dev, ctx->channel, (struct iovec *)ctx->payload, ctx->iovcnt,
+ ctx->lba, ctx->lba_count, ctx->cb_args);
+ } else {
+ bdev_blob_read(ctx->dev, ctx->channel, ctx->payload,
+ ctx->lba, ctx->lba_count, ctx->cb_args);
+ }
+ break;
+ case SPDK_BDEV_IO_TYPE_WRITE:
+ if (ctx->iovcnt > 0) {
+ bdev_blob_writev(ctx->dev, ctx->channel, (struct iovec *)ctx->payload, ctx->iovcnt,
+ ctx->lba, ctx->lba_count, ctx->cb_args);
+ } else {
+ bdev_blob_write(ctx->dev, ctx->channel, ctx->payload,
+ ctx->lba, ctx->lba_count, ctx->cb_args);
+ }
+ break;
+ case SPDK_BDEV_IO_TYPE_UNMAP:
+ bdev_blob_unmap(ctx->dev, ctx->channel,
+ ctx->lba, ctx->lba_count, ctx->cb_args);
+ break;
+ case SPDK_BDEV_IO_TYPE_WRITE_ZEROES:
+ bdev_blob_write_zeroes(ctx->dev, ctx->channel,
+ ctx->lba, ctx->lba_count, ctx->cb_args);
+ break;
+ default:
+ SPDK_ERRLOG("Unsupported io type %d\n", ctx->io_type);
+ assert(false);
+ break;
+ }
+ free(ctx);
+}
+
+int
+spdk_bs_bdev_claim(struct spdk_bs_dev *bs_dev, struct spdk_bdev_module *module)
+{
+ struct blob_bdev *blob_bdev = (struct blob_bdev *)bs_dev;
+ int rc;
+
+ rc = spdk_bdev_module_claim_bdev(blob_bdev->bdev, NULL, module);
+ if (rc != 0) {
+ SPDK_ERRLOG("could not claim bs dev\n");
+ return rc;
+ }
+
+ blob_bdev->claimed = true;
+
+ return rc;
+}
+
+static struct spdk_io_channel *
+bdev_blob_create_channel(struct spdk_bs_dev *dev)
+{
+ struct blob_bdev *blob_bdev = (struct blob_bdev *)dev;
+
+ return spdk_bdev_get_io_channel(blob_bdev->desc);
+}
+
+static void
+bdev_blob_destroy_channel(struct spdk_bs_dev *dev, struct spdk_io_channel *channel)
+{
+ spdk_put_io_channel(channel);
+}
+
+static void
+bdev_blob_destroy(struct spdk_bs_dev *bs_dev)
+{
+ struct spdk_bdev_desc *desc = __get_desc(bs_dev);
+ struct blob_bdev *blob_bdev = (struct blob_bdev *)bs_dev;
+
+ if (blob_bdev->claimed) {
+ spdk_bdev_module_release_bdev(blob_bdev->bdev);
+ }
+
+ spdk_bdev_close(desc);
+ free(bs_dev);
+}
+
+struct spdk_bs_dev *
+spdk_bdev_create_bs_dev(struct spdk_bdev *bdev, spdk_bdev_remove_cb_t remove_cb, void *remove_ctx)
+{
+ struct blob_bdev *b;
+ struct spdk_bdev_desc *desc;
+ int rc;
+
+ b = calloc(1, sizeof(*b));
+
+ if (b == NULL) {
+ SPDK_ERRLOG("could not allocate blob_bdev\n");
+ return NULL;
+ }
+
+ rc = spdk_bdev_open(bdev, true, remove_cb, remove_ctx, &desc);
+ if (rc != 0) {
+ free(b);
+ return NULL;
+ }
+
+ b->bdev = bdev;
+ b->desc = desc;
+ b->bs_dev.blockcnt = spdk_bdev_get_num_blocks(bdev);
+ b->bs_dev.blocklen = spdk_bdev_get_block_size(bdev);
+ b->bs_dev.create_channel = bdev_blob_create_channel;
+ b->bs_dev.destroy_channel = bdev_blob_destroy_channel;
+ b->bs_dev.destroy = bdev_blob_destroy;
+ b->bs_dev.read = bdev_blob_read;
+ b->bs_dev.write = bdev_blob_write;
+ b->bs_dev.readv = bdev_blob_readv;
+ b->bs_dev.writev = bdev_blob_writev;
+ b->bs_dev.write_zeroes = bdev_blob_write_zeroes;
+ b->bs_dev.unmap = bdev_blob_unmap;
+
+ return &b->bs_dev;
+}
+
+struct spdk_bs_dev *
+spdk_bdev_create_bs_dev_from_desc(struct spdk_bdev_desc *desc)
+{
+ struct blob_bdev *b;
+ struct spdk_bdev *bdev;
+
+ b = calloc(1, sizeof(*b));
+
+ if (b == NULL) {
+ SPDK_ERRLOG("could not allocate blob_bdev\n");
+ return NULL;
+ }
+
+ bdev = spdk_bdev_desc_get_bdev(desc);
+ assert(bdev != NULL);
+
+ b->bdev = bdev;
+ b->desc = desc;
+ b->bs_dev.blockcnt = spdk_bdev_get_num_blocks(bdev);
+ b->bs_dev.blocklen = spdk_bdev_get_block_size(bdev);
+ b->bs_dev.create_channel = bdev_blob_create_channel;
+ b->bs_dev.destroy_channel = bdev_blob_destroy_channel;
+ b->bs_dev.destroy = bdev_blob_destroy;
+ b->bs_dev.read = bdev_blob_read;
+ b->bs_dev.write = bdev_blob_write;
+ b->bs_dev.readv = bdev_blob_readv;
+ b->bs_dev.writev = bdev_blob_writev;
+ b->bs_dev.write_zeroes = bdev_blob_write_zeroes;
+ b->bs_dev.unmap = bdev_blob_unmap;
+
+ return &b->bs_dev;
+}
diff --git a/src/spdk/module/blob/bdev/spdk_blob_bdev.map b/src/spdk/module/blob/bdev/spdk_blob_bdev.map
new file mode 100644
index 000000000..0149b3ab6
--- /dev/null
+++ b/src/spdk/module/blob/bdev/spdk_blob_bdev.map
@@ -0,0 +1,10 @@
+{
+ global:
+
+ # public functions
+ spdk_bdev_create_bs_dev;
+ spdk_bdev_create_bs_dev_from_desc;
+ spdk_bs_bdev_claim;
+
+ local: *;
+};
diff --git a/src/spdk/module/blobfs/Makefile b/src/spdk/module/blobfs/Makefile
new file mode 100644
index 000000000..744a0a4a4
--- /dev/null
+++ b/src/spdk/module/blobfs/Makefile
@@ -0,0 +1,44 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
+include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
+
+DIRS-y = bdev
+
+.PHONY: all clean $(DIRS-y)
+
+all: $(DIRS-y)
+clean: $(DIRS-y)
+
+include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk
diff --git a/src/spdk/module/blobfs/bdev/Makefile b/src/spdk/module/blobfs/bdev/Makefile
new file mode 100644
index 000000000..97d350d30
--- /dev/null
+++ b/src/spdk/module/blobfs/bdev/Makefile
@@ -0,0 +1,51 @@
+#
+# BSD LICENSE
+#
+# Copyright (c) Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
+include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
+
+SO_VER := 2
+SO_MINOR := 0
+
+C_SRCS = blobfs_bdev.c blobfs_bdev_rpc.c
+
+# libfuse3 is required by blobfs_fuse.c
+ifeq ($(CONFIG_FUSE),y)
+C_SRCS += blobfs_fuse.c
+endif
+
+LIBNAME = blobfs_bdev
+
+SPDK_MAP_FILE = $(abspath $(CURDIR)/spdk_blobfs_bdev.map)
+
+include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk
diff --git a/src/spdk/module/blobfs/bdev/blobfs_bdev.c b/src/spdk/module/blobfs/bdev/blobfs_bdev.c
new file mode 100644
index 000000000..501bbea18
--- /dev/null
+++ b/src/spdk/module/blobfs/bdev/blobfs_bdev.c
@@ -0,0 +1,361 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright (c) Intel Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "spdk/stdinc.h"
+#include "spdk/blobfs.h"
+#include "spdk/bdev.h"
+#include "spdk/bdev_module.h"
+#include "spdk/event.h"
+#include "spdk/blob_bdev.h"
+#include "spdk/blobfs_bdev.h"
+#include "spdk/log.h"
+#include "spdk/string.h"
+#include "spdk/rpc.h"
+#include "spdk/util.h"
+
+#include "spdk_internal/log.h"
+
+#include "blobfs_fuse.h"
+
+/* Dummy bdev module used to to claim bdevs. */
+static struct spdk_bdev_module blobfs_bdev_module = {
+ .name = "blobfs",
+};
+
+static void
+blobfs_bdev_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev *bdev,
+ void *event_ctx)
+{
+ SPDK_WARNLOG("Async event(%d) is triggered in bdev %s\n", type, spdk_bdev_get_name(bdev));
+}
+
+struct blobfs_bdev_operation_ctx {
+ const char *bdev_name;
+ struct spdk_filesystem *fs;
+
+ /* If cb_fn is already called in other function, not _blobfs_bdev_unload_cb.
+ * cb_fn should be set NULL after its being called, in order to avoid repeated
+ * calling in _blobfs_bdev_unload_cb.
+ */
+ spdk_blobfs_bdev_op_complete cb_fn;
+ void *cb_arg;
+
+ /* Variables for mount operation */
+ const char *mountpoint;
+ struct spdk_thread *fs_loading_thread;
+
+ /* Used in bdev_event_cb to do some proper operations on blobfs_fuse for
+ * asynchronous event of the backend bdev.
+ */
+ struct spdk_blobfs_fuse *bfuse;
+};
+
+static void
+_blobfs_bdev_unload_cb(void *_ctx, int fserrno)
+{
+ struct blobfs_bdev_operation_ctx *ctx = _ctx;
+
+ if (fserrno) {
+ SPDK_ERRLOG("Failed to unload blobfs on bdev %s: errno %d\n", ctx->bdev_name, fserrno);
+ }
+
+ if (ctx->cb_fn) {
+ ctx->cb_fn(ctx->cb_arg, fserrno);
+ }
+
+ free(ctx);
+}
+
+static void
+blobfs_bdev_unload(void *_ctx)
+{
+ struct blobfs_bdev_operation_ctx *ctx = _ctx;
+
+ spdk_fs_unload(ctx->fs, _blobfs_bdev_unload_cb, ctx);
+}
+
+static void
+blobfs_bdev_load_cb_to_unload(void *_ctx, struct spdk_filesystem *fs, int fserrno)
+{
+ struct blobfs_bdev_operation_ctx *ctx = _ctx;
+
+ if (fserrno) {
+ ctx->cb_fn(ctx->cb_arg, fserrno);
+ free(ctx);
+ return;
+ }
+
+ ctx->fs = fs;
+ spdk_thread_send_msg(spdk_get_thread(), blobfs_bdev_unload, ctx);
+}
+
+void
+spdk_blobfs_bdev_detect(const char *bdev_name,
+ spdk_blobfs_bdev_op_complete cb_fn, void *cb_arg)
+{
+ struct blobfs_bdev_operation_ctx *ctx;
+ struct spdk_bs_dev *bs_dev;
+ struct spdk_bdev_desc *desc;
+ int rc;
+
+ ctx = calloc(1, sizeof(*ctx));
+ if (ctx == NULL) {
+ SPDK_ERRLOG("Failed to allocate ctx.\n");
+ cb_fn(cb_arg, -ENOMEM);
+
+ return;
+ }
+
+ ctx->bdev_name = bdev_name;
+ ctx->cb_fn = cb_fn;
+ ctx->cb_arg = cb_arg;
+
+ rc = spdk_bdev_open_ext(bdev_name, true, blobfs_bdev_event_cb, NULL, &desc);
+ if (rc != 0) {
+ SPDK_INFOLOG(SPDK_LOG_BLOBFS_BDEV, "Failed to open bdev(%s): %s\n", ctx->bdev_name,
+ spdk_strerror(rc));
+
+ goto invalid;
+ }
+
+ bs_dev = spdk_bdev_create_bs_dev_from_desc(desc);
+ if (bs_dev == NULL) {
+ SPDK_INFOLOG(SPDK_LOG_BLOBFS_BDEV, "Failed to create a blobstore block device from bdev desc");
+ rc = -ENOMEM;
+ spdk_bdev_close(desc);
+
+ goto invalid;
+ }
+
+ spdk_fs_load(bs_dev, NULL, blobfs_bdev_load_cb_to_unload, ctx);
+
+ return;
+
+invalid:
+ free(ctx);
+
+ cb_fn(cb_arg, rc);
+}
+
+void
+spdk_blobfs_bdev_create(const char *bdev_name, uint32_t cluster_sz,
+ spdk_blobfs_bdev_op_complete cb_fn, void *cb_arg)
+{
+ struct blobfs_bdev_operation_ctx *ctx;
+ struct spdk_blobfs_opts blobfs_opt;
+ struct spdk_bs_dev *bs_dev;
+ struct spdk_bdev_desc *desc;
+ int rc;
+
+ ctx = calloc(1, sizeof(*ctx));
+ if (ctx == NULL) {
+ SPDK_ERRLOG("Failed to allocate ctx.\n");
+ cb_fn(cb_arg, -ENOMEM);
+
+ return;
+ }
+
+ ctx->bdev_name = bdev_name;
+ ctx->cb_fn = cb_fn;
+ ctx->cb_arg = cb_arg;
+
+ /* Creation requires WRITE operation */
+ rc = spdk_bdev_open_ext(bdev_name, true, blobfs_bdev_event_cb, NULL, &desc);
+ if (rc != 0) {
+ SPDK_INFOLOG(SPDK_LOG_BLOBFS_BDEV, "Failed to open bdev(%s): %s\n", ctx->bdev_name,
+ spdk_strerror(rc));
+
+ goto invalid;
+ }
+
+ bs_dev = spdk_bdev_create_bs_dev_from_desc(desc);
+ if (bs_dev == NULL) {
+ SPDK_INFOLOG(SPDK_LOG_BLOBFS_BDEV, "Failed to create a blobstore block device from bdev desc\n");
+ rc = -ENOMEM;
+ spdk_bdev_close(desc);
+
+ goto invalid;
+ }
+
+ rc = spdk_bs_bdev_claim(bs_dev, &blobfs_bdev_module);
+ if (rc) {
+ SPDK_INFOLOG(SPDK_LOG_BLOBFS_BDEV, "Blobfs base bdev already claimed by another bdev\n");
+ bs_dev->destroy(bs_dev);
+
+ goto invalid;
+ }
+
+ spdk_fs_opts_init(&blobfs_opt);
+ if (cluster_sz) {
+ blobfs_opt.cluster_sz = cluster_sz;
+ }
+
+ spdk_fs_init(bs_dev, &blobfs_opt, NULL, blobfs_bdev_load_cb_to_unload, ctx);
+
+ return;
+
+invalid:
+ free(ctx);
+
+ cb_fn(cb_arg, rc);
+}
+SPDK_LOG_REGISTER_COMPONENT("blobfs_bdev", SPDK_LOG_BLOBFS_BDEV)
+#ifdef SPDK_CONFIG_FUSE
+
+static void
+blobfs_bdev_unmount(void *arg)
+{
+ struct blobfs_bdev_operation_ctx *ctx = arg;
+
+ /* Keep blobfs unloaded in a same spdk thread with spdk_fs_load */
+ spdk_thread_send_msg(ctx->fs_loading_thread, blobfs_bdev_unload, ctx);
+}
+
+static void
+_blobfs_bdev_mount_fuse_start(void *_ctx)
+{
+ struct blobfs_bdev_operation_ctx *ctx = _ctx;
+ spdk_blobfs_bdev_op_complete cb_fn = ctx->cb_fn;
+ int rc;
+
+ /* Since function of ctx->cb_fn will be called in this function, set
+ * ctx->cb_fn to be NULL, in order to avoid repeated calling in unload_cb.
+ */
+ ctx->cb_fn = NULL;
+
+ rc = blobfs_fuse_start(ctx->bdev_name, ctx->mountpoint, ctx->fs,
+ blobfs_bdev_unmount, ctx, &ctx->bfuse);
+ if (rc != 0) {
+ SPDK_ERRLOG("Failed to mount blobfs on bdev %s to %s\n", ctx->bdev_name, ctx->mountpoint);
+
+ /* Return failure state back */
+ cb_fn(ctx->cb_arg, rc);
+
+ blobfs_bdev_unmount(ctx);
+
+ return;
+ }
+
+ cb_fn(ctx->cb_arg, 0);
+}
+
+static void
+_blobfs_bdev_mount_load_cb(void *_ctx, struct spdk_filesystem *fs, int fserrno)
+{
+ struct blobfs_bdev_operation_ctx *ctx = _ctx;
+
+ if (fserrno) {
+ SPDK_ERRLOG("Failed to load blobfs on bdev %s: errno %d\n", ctx->bdev_name, fserrno);
+
+ ctx->cb_fn(ctx->cb_arg, fserrno);
+ free(ctx);
+ return;
+ }
+
+ ctx->fs = fs;
+ ctx->fs_loading_thread = spdk_get_thread();
+
+ spdk_thread_send_msg(spdk_get_thread(), _blobfs_bdev_mount_fuse_start, ctx);
+}
+
+static void
+blobfs_bdev_fuse_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev *bdev,
+ void *event_ctx)
+{
+ struct blobfs_bdev_operation_ctx *ctx = event_ctx;
+
+ SPDK_WARNLOG("Async event(%d) is triggered in bdev %s\n", type, spdk_bdev_get_name(bdev));
+
+ if (type == SPDK_BDEV_EVENT_REMOVE) {
+ blobfs_fuse_stop(ctx->bfuse);
+ }
+}
+
+void
+spdk_blobfs_bdev_mount(const char *bdev_name, const char *mountpoint,
+ spdk_blobfs_bdev_op_complete cb_fn, void *cb_arg)
+{
+ struct blobfs_bdev_operation_ctx *ctx;
+ struct spdk_bs_dev *bs_dev;
+ struct spdk_bdev_desc *desc;
+ int rc;
+
+ ctx = calloc(1, sizeof(*ctx));
+ if (ctx == NULL) {
+ SPDK_ERRLOG("Failed to allocate ctx.\n");
+ cb_fn(cb_arg, -ENOMEM);
+
+ return;
+ }
+
+ ctx->bdev_name = bdev_name;
+ ctx->mountpoint = mountpoint;
+ ctx->cb_fn = cb_fn;
+ ctx->cb_arg = cb_arg;
+
+ rc = spdk_bdev_open_ext(bdev_name, true, blobfs_bdev_fuse_event_cb, ctx, &desc);
+ if (rc != 0) {
+ SPDK_INFOLOG(SPDK_LOG_BLOBFS_BDEV, "Failed to open bdev(%s): %s\n", ctx->bdev_name,
+ spdk_strerror(rc));
+
+ goto invalid;
+ }
+
+ bs_dev = spdk_bdev_create_bs_dev_from_desc(desc);
+ if (bs_dev == NULL) {
+ SPDK_INFOLOG(SPDK_LOG_BLOBFS_BDEV, "Failed to create a blobstore block device from bdev desc");
+ rc = -ENOMEM;
+ spdk_bdev_close(desc);
+
+ goto invalid;
+ }
+
+ rc = spdk_bs_bdev_claim(bs_dev, &blobfs_bdev_module);
+ if (rc != 0) {
+ SPDK_INFOLOG(SPDK_LOG_BLOBFS_BDEV, "Blobfs base bdev already claimed by another bdev\n");
+ bs_dev->destroy(bs_dev);
+
+ goto invalid;
+ }
+
+ spdk_fs_load(bs_dev, blobfs_fuse_send_request, _blobfs_bdev_mount_load_cb, ctx);
+
+ return;
+
+invalid:
+ free(ctx);
+
+ cb_fn(cb_arg, rc);
+}
+
+#endif
diff --git a/src/spdk/module/blobfs/bdev/blobfs_bdev_rpc.c b/src/spdk/module/blobfs/bdev/blobfs_bdev_rpc.c
new file mode 100644
index 000000000..62d9fa98e
--- /dev/null
+++ b/src/spdk/module/blobfs/bdev/blobfs_bdev_rpc.c
@@ -0,0 +1,344 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright (c) Intel Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "spdk/stdinc.h"
+#include "spdk/blobfs.h"
+#include "spdk/bdev.h"
+#include "spdk/event.h"
+#include "spdk/blob_bdev.h"
+#include "spdk/blobfs_bdev.h"
+#include "spdk/log.h"
+#include "spdk/string.h"
+#include "spdk/rpc.h"
+#include "spdk/util.h"
+
+#include "spdk_internal/log.h"
+
+#ifndef PAGE_SIZE
+#define PAGE_SIZE 4096
+#endif
+
+#define MIN_CLUSTER_SZ (1024 * 1024)
+
+struct rpc_blobfs_set_cache_size {
+ uint64_t size_in_mb;
+};
+
+static const struct spdk_json_object_decoder rpc_blobfs_set_cache_size_decoders[] = {
+ {"size_in_mb", offsetof(struct rpc_blobfs_set_cache_size, size_in_mb), spdk_json_decode_uint64},
+};
+
+static void
+rpc_blobfs_set_cache_size(struct spdk_jsonrpc_request *request,
+ const struct spdk_json_val *params)
+{
+ struct rpc_blobfs_set_cache_size req;
+ struct spdk_json_write_ctx *w;
+ int rc;
+
+ if (spdk_json_decode_object(params, rpc_blobfs_set_cache_size_decoders,
+ SPDK_COUNTOF(rpc_blobfs_set_cache_size_decoders),
+ &req)) {
+ SPDK_ERRLOG("spdk_json_decode_object failed\n");
+ spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
+ "spdk_json_decode_object failed");
+
+ return;
+ }
+
+ if (req.size_in_mb == 0) {
+ spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
+ "spdk_json_decode_object failed");
+
+ return;
+ }
+
+ rc = spdk_fs_set_cache_size(req.size_in_mb);
+
+ w = spdk_jsonrpc_begin_result(request);
+ spdk_json_write_bool(w, rc == 0);
+ spdk_jsonrpc_end_result(request, w);
+}
+
+SPDK_RPC_REGISTER("blobfs_set_cache_size", rpc_blobfs_set_cache_size,
+ SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)
+
+struct rpc_blobfs_detect {
+ char *bdev_name;
+
+ struct spdk_jsonrpc_request *request;
+};
+
+static void
+free_rpc_blobfs_detect(struct rpc_blobfs_detect *req)
+{
+ free(req->bdev_name);
+ free(req);
+}
+
+static const struct spdk_json_object_decoder rpc_blobfs_detect_decoders[] = {
+ {"bdev_name", offsetof(struct rpc_blobfs_detect, bdev_name), spdk_json_decode_string},
+};
+
+static void
+_rpc_blobfs_detect_done(void *cb_arg, int fserrno)
+{
+ struct rpc_blobfs_detect *req = cb_arg;
+ struct spdk_json_write_ctx *w;
+ bool existed = true;
+
+ if (fserrno == -EILSEQ) {
+ /* There is no blobfs existing on bdev */
+ existed = false;
+ } else if (fserrno != 0) {
+ spdk_jsonrpc_send_error_response(req->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
+ spdk_strerror(-fserrno));
+
+ return;
+ }
+
+ w = spdk_jsonrpc_begin_result(req->request);
+ spdk_json_write_bool(w, existed);
+ spdk_jsonrpc_end_result(req->request, w);
+
+ free_rpc_blobfs_detect(req);
+}
+
+static void
+rpc_blobfs_detect(struct spdk_jsonrpc_request *request,
+ const struct spdk_json_val *params)
+{
+ struct rpc_blobfs_detect *req;
+
+ req = calloc(1, sizeof(*req));
+ if (req == NULL) {
+ SPDK_ERRLOG("could not allocate rpc_blobfs_detect request.\n");
+ spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR, "Out of memory");
+ return;
+ }
+
+ if (spdk_json_decode_object(params, rpc_blobfs_detect_decoders,
+ SPDK_COUNTOF(rpc_blobfs_detect_decoders),
+ req)) {
+ SPDK_ERRLOG("spdk_json_decode_object failed\n");
+ spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
+ "spdk_json_decode_object failed");
+
+ free_rpc_blobfs_detect(req);
+
+ return;
+ }
+
+ req->request = request;
+ spdk_blobfs_bdev_detect(req->bdev_name, _rpc_blobfs_detect_done, req);
+}
+
+SPDK_RPC_REGISTER("blobfs_detect", rpc_blobfs_detect, SPDK_RPC_RUNTIME)
+
+struct rpc_blobfs_create {
+ char *bdev_name;
+ uint64_t cluster_sz;
+
+ struct spdk_jsonrpc_request *request;
+};
+
+static void
+free_rpc_blobfs_create(struct rpc_blobfs_create *req)
+{
+ free(req->bdev_name);
+ free(req);
+}
+
+static int
+rpc_decode_cluster_sz(const struct spdk_json_val *val, void *out)
+{
+ uint64_t *cluster_sz = out;
+ char *sz_str = NULL;
+ bool has_prefix;
+ int rc;
+
+ rc = spdk_json_decode_string(val, &sz_str);
+ if (rc) {
+ SPDK_NOTICELOG("Invalid parameter value: cluster_sz\n");
+ return -EINVAL;
+ }
+
+ rc = spdk_parse_capacity(sz_str, cluster_sz, &has_prefix);
+ free(sz_str);
+
+ if (rc || *cluster_sz % PAGE_SIZE != 0 || *cluster_sz < MIN_CLUSTER_SZ) {
+ SPDK_NOTICELOG("Invalid parameter value: cluster_sz\n");
+ return -EINVAL;
+ }
+
+ SPDK_DEBUGLOG(SPDK_LOG_BLOBFS_BDEV_RPC, "cluster_sz of blobfs: %ld\n", *cluster_sz);
+ return 0;
+}
+
+static const struct spdk_json_object_decoder rpc_blobfs_create_decoders[] = {
+ {"bdev_name", offsetof(struct rpc_blobfs_create, bdev_name), spdk_json_decode_string},
+ {"cluster_sz", offsetof(struct rpc_blobfs_create, cluster_sz), rpc_decode_cluster_sz, true},
+};
+
+static void
+_rpc_blobfs_create_done(void *cb_arg, int fserrno)
+{
+ struct rpc_blobfs_create *req = cb_arg;
+ struct spdk_json_write_ctx *w;
+
+ if (fserrno != 0) {
+ spdk_jsonrpc_send_error_response(req->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
+ spdk_strerror(-fserrno));
+
+ return;
+ }
+
+ w = spdk_jsonrpc_begin_result(req->request);
+ spdk_json_write_bool(w, true);
+ spdk_jsonrpc_end_result(req->request, w);
+
+ free_rpc_blobfs_create(req);
+}
+
+static void
+rpc_blobfs_create(struct spdk_jsonrpc_request *request,
+ const struct spdk_json_val *params)
+{
+ struct rpc_blobfs_create *req;
+
+ req = calloc(1, sizeof(*req));
+ if (req == NULL) {
+ SPDK_ERRLOG("could not allocate rpc_blobfs_create request.\n");
+ spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR, "Out of memory");
+ return;
+ }
+
+ if (spdk_json_decode_object(params, rpc_blobfs_create_decoders,
+ SPDK_COUNTOF(rpc_blobfs_create_decoders),
+ req)) {
+ SPDK_ERRLOG("spdk_json_decode_object failed\n");
+ spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
+ "spdk_json_decode_object failed");
+
+ free_rpc_blobfs_create(req);
+
+ return;
+ }
+
+ req->request = request;
+ spdk_blobfs_bdev_create(req->bdev_name, req->cluster_sz, _rpc_blobfs_create_done, req);
+}
+
+SPDK_RPC_REGISTER("blobfs_create", rpc_blobfs_create, SPDK_RPC_RUNTIME)
+
+SPDK_LOG_REGISTER_COMPONENT("blobfs_bdev_rpc", SPDK_LOG_BLOBFS_BDEV_RPC)
+#ifdef SPDK_CONFIG_FUSE
+
+struct rpc_blobfs_mount {
+ char *bdev_name;
+ char *mountpoint;
+
+ struct spdk_jsonrpc_request *request;
+};
+
+static void
+free_rpc_blobfs_mount(struct rpc_blobfs_mount *req)
+{
+ free(req->bdev_name);
+ free(req->mountpoint);
+ free(req);
+}
+
+static const struct spdk_json_object_decoder rpc_blobfs_mount_decoders[] = {
+ {"bdev_name", offsetof(struct rpc_blobfs_mount, bdev_name), spdk_json_decode_string},
+ {"mountpoint", offsetof(struct rpc_blobfs_mount, mountpoint), spdk_json_decode_string},
+};
+
+static void
+_rpc_blobfs_mount_done(void *cb_arg, int fserrno)
+{
+ struct rpc_blobfs_mount *req = cb_arg;
+ struct spdk_json_write_ctx *w;
+
+ if (fserrno == -EILSEQ) {
+ /* There is no blobfs existing on bdev */
+ spdk_jsonrpc_send_error_response(req->request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
+ "No blobfs detected on given bdev");
+
+ return;
+ } else if (fserrno != 0) {
+ spdk_jsonrpc_send_error_response(req->request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
+ spdk_strerror(-fserrno));
+
+ return;
+ }
+
+ w = spdk_jsonrpc_begin_result(req->request);
+ spdk_json_write_bool(w, true);
+ spdk_jsonrpc_end_result(req->request, w);
+
+ free_rpc_blobfs_mount(req);
+}
+
+static void
+rpc_blobfs_mount(struct spdk_jsonrpc_request *request,
+ const struct spdk_json_val *params)
+{
+ struct rpc_blobfs_mount *req;
+
+ req = calloc(1, sizeof(*req));
+ if (req == NULL) {
+ SPDK_ERRLOG("could not allocate rpc_blobfs_mount request.\n");
+ spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR, "Out of memory");
+ return;
+ }
+
+ if (spdk_json_decode_object(params, rpc_blobfs_mount_decoders,
+ SPDK_COUNTOF(rpc_blobfs_mount_decoders),
+ req)) {
+ SPDK_ERRLOG("spdk_json_decode_object failed\n");
+ spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
+ "spdk_json_decode_object failed");
+
+ free_rpc_blobfs_mount(req);
+
+ return;
+ }
+
+ req->request = request;
+ spdk_blobfs_bdev_mount(req->bdev_name, req->mountpoint, _rpc_blobfs_mount_done, req);
+}
+
+SPDK_RPC_REGISTER("blobfs_mount", rpc_blobfs_mount, SPDK_RPC_RUNTIME)
+
+#endif
diff --git a/src/spdk/module/blobfs/bdev/blobfs_fuse.c b/src/spdk/module/blobfs/bdev/blobfs_fuse.c
new file mode 100644
index 000000000..df6d61e04
--- /dev/null
+++ b/src/spdk/module/blobfs/bdev/blobfs_fuse.c
@@ -0,0 +1,358 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright (c) Intel Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "spdk/stdinc.h"
+
+#include "spdk/log.h"
+#include "spdk/env.h"
+#include "spdk/event.h"
+#include "spdk/thread.h"
+#include "spdk/string.h"
+#include "spdk/blobfs.h"
+
+#include "blobfs_fuse.h"
+
+#define FUSE_USE_VERSION 30
+#include "fuse3/fuse.h"
+#include "fuse3/fuse_lowlevel.h"
+
+struct spdk_blobfs_fuse {
+ char *bdev_name;
+ char *mountpoint;
+ struct spdk_fs_thread_ctx *channel;
+ struct spdk_filesystem *fs;
+
+ struct fuse *fuse_handle;
+ pthread_t fuse_tid;
+
+ blobfs_fuse_unmount_cb cb_fn;
+ void *cb_arg;
+};
+
+/* Each thread serves one blobfs */
+static __thread struct spdk_blobfs_fuse *thd_bfuse;
+
+static void
+blobfs_fuse_free(struct spdk_blobfs_fuse *bfuse)
+{
+ if (bfuse == NULL) {
+ return;
+ }
+
+ free(bfuse->bdev_name);
+ free(bfuse->mountpoint);
+ free(bfuse);
+}
+
+static void
+__call_fn(void *arg1, void *arg2)
+{
+ fs_request_fn fn;
+
+ fn = (fs_request_fn)arg1;
+ fn(arg2);
+}
+
+void
+blobfs_fuse_send_request(fs_request_fn fn, void *arg)
+{
+ struct spdk_event *event;
+
+ event = spdk_event_allocate(0, __call_fn, (void *)fn, arg);
+ spdk_event_call(event);
+}
+
+static int
+fuse_getattr(const char *path, struct stat *stbuf, struct fuse_file_info *fi)
+{
+ struct spdk_file_stat stat;
+ int rc;
+
+ if (!strcmp(path, "/")) {
+ stbuf->st_mode = S_IFDIR | 0755;
+ stbuf->st_nlink = 2;
+ return 0;
+ }
+
+ rc = spdk_fs_file_stat(thd_bfuse->fs, thd_bfuse->channel, path, &stat);
+ if (rc == 0) {
+ stbuf->st_mode = S_IFREG | 0644;
+ stbuf->st_nlink = 1;
+ stbuf->st_size = stat.size;
+ }
+
+ return rc;
+}
+
+static int
+fuse_readdir(const char *path, void *buf, fuse_fill_dir_t filler,
+ off_t offset, struct fuse_file_info *fi,
+ enum fuse_readdir_flags flags)
+{
+ struct spdk_file *file;
+ const char *filename;
+ spdk_fs_iter iter;
+
+ filler(buf, ".", NULL, 0, 0);
+ filler(buf, "..", NULL, 0, 0);
+
+ iter = spdk_fs_iter_first(thd_bfuse->fs);
+ while (iter != NULL) {
+ file = spdk_fs_iter_get_file(iter);
+ iter = spdk_fs_iter_next(iter);
+ filename = spdk_file_get_name(file);
+ filler(buf, &filename[1], NULL, 0, 0);
+ }
+
+ return 0;
+}
+
+static int
+fuse_mknod(const char *path, mode_t mode, dev_t rdev)
+{
+ return spdk_fs_create_file(thd_bfuse->fs, thd_bfuse->channel, path);
+}
+
+static int
+fuse_unlink(const char *path)
+{
+ return spdk_fs_delete_file(thd_bfuse->fs, thd_bfuse->channel, path);
+}
+
+static int
+fuse_truncate(const char *path, off_t size, struct fuse_file_info *fi)
+{
+ struct spdk_file *file;
+ int rc;
+
+ rc = spdk_fs_open_file(thd_bfuse->fs, thd_bfuse->channel, path, 0, &file);
+ if (rc != 0) {
+ return -rc;
+ }
+
+ rc = spdk_file_truncate(file, thd_bfuse->channel, size);
+ if (rc != 0) {
+ return -rc;
+ }
+
+ spdk_file_close(file, thd_bfuse->channel);
+
+ return 0;
+}
+
+static int
+fuse_utimens(const char *path, const struct timespec tv[2], struct fuse_file_info *fi)
+{
+ return 0;
+}
+
+static int
+fuse_open(const char *path, struct fuse_file_info *info)
+{
+ struct spdk_file *file;
+ int rc;
+
+ rc = spdk_fs_open_file(thd_bfuse->fs, thd_bfuse->channel, path, 0, &file);
+ if (rc != 0) {
+ return -rc;
+ }
+
+ info->fh = (uintptr_t)file;
+ return 0;
+}
+
+static int
+fuse_release(const char *path, struct fuse_file_info *info)
+{
+ struct spdk_file *file = (struct spdk_file *)info->fh;
+
+ return spdk_file_close(file, thd_bfuse->channel);
+}
+
+static int
+fuse_read(const char *path, char *buf, size_t len, off_t offset, struct fuse_file_info *info)
+{
+ struct spdk_file *file = (struct spdk_file *)info->fh;
+
+ return spdk_file_read(file, thd_bfuse->channel, buf, offset, len);
+}
+
+static int
+fuse_write(const char *path, const char *buf, size_t len, off_t offset,
+ struct fuse_file_info *info)
+{
+ struct spdk_file *file = (struct spdk_file *)info->fh;
+ int rc;
+
+ rc = spdk_file_write(file, thd_bfuse->channel, (void *)buf, offset, len);
+ if (rc == 0) {
+ return len;
+ } else {
+ return rc;
+ }
+}
+
+static int
+fuse_flush(const char *path, struct fuse_file_info *info)
+{
+ return 0;
+}
+
+static int
+fuse_fsync(const char *path, int datasync, struct fuse_file_info *info)
+{
+ return 0;
+}
+
+static int
+fuse_rename(const char *old_path, const char *new_path, unsigned int flags)
+{
+ return spdk_fs_rename_file(thd_bfuse->fs, thd_bfuse->channel, old_path, new_path);
+}
+
+static struct fuse_operations spdk_fuse_oper = {
+ .getattr = fuse_getattr,
+ .readdir = fuse_readdir,
+ .mknod = fuse_mknod,
+ .unlink = fuse_unlink,
+ .truncate = fuse_truncate,
+ .utimens = fuse_utimens,
+ .open = fuse_open,
+ .release = fuse_release,
+ .read = fuse_read,
+ .write = fuse_write,
+ .flush = fuse_flush,
+ .fsync = fuse_fsync,
+ .rename = fuse_rename,
+};
+
+static void *
+fuse_loop_new_thread(void *arg)
+{
+ struct spdk_blobfs_fuse *bfuse = arg;
+
+ spdk_unaffinitize_thread();
+
+ thd_bfuse = bfuse;
+ SPDK_NOTICELOG("Start to loop blobfs on bdev %s mounted at %s\n", bfuse->bdev_name,
+ bfuse->mountpoint);
+
+ bfuse->channel = spdk_fs_alloc_thread_ctx(bfuse->fs);
+
+ fuse_loop(bfuse->fuse_handle);
+ fuse_unmount(bfuse->fuse_handle);
+ fuse_destroy(bfuse->fuse_handle);
+ SPDK_NOTICELOG("Blobfs on bdev %s unmounted from %s\n", bfuse->bdev_name, bfuse->mountpoint);
+
+ spdk_fs_free_thread_ctx(bfuse->channel);
+
+ bfuse->cb_fn(bfuse->cb_arg);
+
+ blobfs_fuse_free(bfuse);
+
+ pthread_exit(NULL);
+}
+
+int
+blobfs_fuse_start(const char *bdev_name, const char *mountpoint, struct spdk_filesystem *fs,
+ blobfs_fuse_unmount_cb cb_fn, void *cb_arg, struct spdk_blobfs_fuse **_bfuse)
+{
+ /* Set argv[1] as bdev_name in order to show bdev_name as the mounting source */
+ char *argv[1] = {(char *)bdev_name};
+ struct fuse_args args = FUSE_ARGS_INIT(1, argv);
+ struct fuse_cmdline_opts opts = {};
+ struct fuse *fuse_handle;
+ struct spdk_blobfs_fuse *bfuse;
+ pthread_t tid;
+ int rc;
+
+ bfuse = (struct spdk_blobfs_fuse *)calloc(1, sizeof(*bfuse));
+ if (bfuse == NULL) {
+ return -ENOMEM;
+ }
+
+ rc = fuse_parse_cmdline(&args, &opts);
+ assert(rc == 0);
+
+ bfuse->bdev_name = strdup(bdev_name);
+ bfuse->mountpoint = strdup(mountpoint);
+ bfuse->fs = fs;
+ bfuse->cb_fn = cb_fn;
+ bfuse->cb_arg = cb_arg;
+
+ fuse_handle = fuse_new(&args, &spdk_fuse_oper, sizeof(spdk_fuse_oper), NULL);
+ fuse_opt_free_args(&args);
+ if (fuse_handle == NULL) {
+ SPDK_ERRLOG("could not create fuse handle!\n");
+ rc = -1;
+ goto err;
+ }
+ bfuse->fuse_handle = fuse_handle;
+
+ rc = fuse_mount(bfuse->fuse_handle, bfuse->mountpoint);
+ if (rc != 0) {
+ SPDK_ERRLOG("could not mount fuse handle\n");
+ rc = -1;
+ goto err;
+ }
+
+ rc = pthread_create(&tid, NULL, fuse_loop_new_thread, bfuse);
+ if (rc != 0) {
+ SPDK_ERRLOG("could not create thread: %s\n", spdk_strerror(rc));
+ rc = -rc;
+ goto err;
+ }
+ bfuse->fuse_tid = tid;
+
+ rc = pthread_detach(tid);
+ if (rc != 0) {
+ SPDK_ERRLOG("could not detach thread for fuse loop thread: %s\n", spdk_strerror(rc));
+ rc = -rc;
+ goto err;
+ }
+
+ *_bfuse = bfuse;
+ return 0;
+
+err:
+ blobfs_fuse_free(bfuse);
+
+ return rc;
+}
+
+void
+blobfs_fuse_stop(struct spdk_blobfs_fuse *bfuse)
+{
+ fuse_session_exit(fuse_get_session(bfuse->fuse_handle));
+ pthread_kill(bfuse->fuse_tid, SIGINT);
+}
diff --git a/src/spdk/module/blobfs/bdev/blobfs_fuse.h b/src/spdk/module/blobfs/bdev/blobfs_fuse.h
new file mode 100644
index 000000000..b14c261da
--- /dev/null
+++ b/src/spdk/module/blobfs/bdev/blobfs_fuse.h
@@ -0,0 +1,52 @@
+/*-
+ * BSD LICENSE
+ *
+ * Copyright (c) Intel Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Intel Corporation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SPDK_BLOBFS_FUSE_H
+#define SPDK_BLOBFS_FUSE_H
+
+#include "spdk/stdinc.h"
+#include "spdk/blobfs.h"
+
+struct spdk_blobfs_fuse;
+
+void blobfs_fuse_send_request(fs_request_fn fn, void *arg);
+
+typedef void (*blobfs_fuse_unmount_cb)(void *arg);
+
+int blobfs_fuse_start(const char *bdev_name, const char *mountpoint,
+ struct spdk_filesystem *fs, blobfs_fuse_unmount_cb cb_fn,
+ void *cb_arg, struct spdk_blobfs_fuse **bfuse);
+
+void blobfs_fuse_stop(struct spdk_blobfs_fuse *bfuse);
+
+#endif /* SPDK_BLOBFS_FUSE_H */
diff --git a/src/spdk/module/blobfs/bdev/spdk_blobfs_bdev.map b/src/spdk/module/blobfs/bdev/spdk_blobfs_bdev.map
new file mode 100644
index 000000000..e3d461c6f
--- /dev/null
+++ b/src/spdk/module/blobfs/bdev/spdk_blobfs_bdev.map
@@ -0,0 +1,8 @@
+{
+ global:
+ spdk_blobfs_bdev_detect;
+ spdk_blobfs_bdev_create;
+ spdk_blobfs_bdev_mount;
+
+ local: *;
+};