zvfs: submodule init

This commit is contained in:
2026-02-25 04:25:42 +00:00
parent dd20857440
commit d6a9e673a1
22 changed files with 61 additions and 44 deletions

5
.gitignore vendored
View File

@@ -1,5 +1,6 @@
*.o
*.d
*.so
func_test
zvfs_meta.txt
zvfs/func_test
zvfs_meta.txt
zvfs/zvfs_meta.txt

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule "spdk"]
path = spdk
url = https://github.com/spdk/spdk.git
branch = v24.05

38
Makefile Executable file → Normal file
View File

@@ -1,37 +1,9 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2017 Intel Corporation
# All rights reserved.
#
.PHONY: all clean zvfs
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../spdk)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
include $(SPDK_ROOT_DIR)/mk/spdk.app_vars.mk
all: zvfs
LIBZVFS := libzvfs.so
APP := func_test
C_SRCS := zvfs.c zvfs_hook.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_bdev
LIBS += $(SPDK_LIB_LINKER_ARGS)
LDFLAGS += -shared -rdynamic -Wl,-z,nodelete -Wl,--disable-new-dtags \
-Wl,-rpath,$(SPDK_ROOT_DIR)/build/lib \
-Wl,-rpath,$(SPDK_ROOT_DIR)/dpdk/build/lib
SYS_LIBS += -ldl
all: $(LIBZVFS) $(APP)
@:
rm -rf zvfs_meta.txt
$(LIBZVFS): $(OBJS) $(SPDK_LIB_FILES) $(ENV_LIBS)
$(LINK_C)
$(APP): func_test.c
$(CC) -o $@ $<
zvfs:
$(MAKE) -C zvfs
clean:
$(CLEAN_C) $(LIBZVFS) $(APP)
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk
$(MAKE) -C zvfs clean

View File

@@ -1,6 +1,8 @@
## usage
```shell
git submodule update --init --recursive
cd /home/lian/share/10.1-spdk/spdk
./configure --with-shared
make -j
@@ -23,15 +25,15 @@ zvfs的测试结果
1. iosize = 4K95MiB/s
2. ioszie = 128K1662MiB/s
相当于spdk读写的90%性能。
相当于spdk测试工具读写的90%性能。
对比系统调用:
1. O_DIRECT
1. 大块43MiB/s
2. 小块724MiB/s
1. 大块4K43MiB/s
2. 小块128K724MiB/s
2. !O_DIRECT
1. 大块1460MiB/s
2. 小块1266MiB/s
1. 大块4K1460MiB/s
2. 小块128K1266MiB/s
### spdk_nvme_perf 性能基准测试
```shell

1
spdk Submodule

Submodule spdk added at 40a5c21897

37
zvfs/Makefile Executable file
View File

@@ -0,0 +1,37 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2017 Intel Corporation
# All rights reserved.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../spdk)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
include $(SPDK_ROOT_DIR)/mk/spdk.app_vars.mk
LIBZVFS := libzvfs.so
APP := func_test
C_SRCS := zvfs.c zvfs_hook.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_bdev
LIBS += $(SPDK_LIB_LINKER_ARGS)
LDFLAGS += -shared -rdynamic -Wl,-z,nodelete -Wl,--disable-new-dtags \
-Wl,-rpath,$(SPDK_ROOT_DIR)/build/lib \
-Wl,-rpath,$(SPDK_ROOT_DIR)/dpdk/build/lib
SYS_LIBS += -ldl
all: $(LIBZVFS) $(APP)
@:
$(LIBZVFS): $(OBJS) $(SPDK_LIB_FILES) $(ENV_LIBS)
$(LINK_C)
$(APP): func_test.c
$(CC) -o $@ $<
clean:
$(CLEAN_C) $(LIBZVFS) $(APP)
include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk

View File

@@ -16,8 +16,8 @@ static double time_diff_sec(struct timespec a, struct timespec b)
static int test_single_file_perf(const char *path)
{
// size_t io_size = 128 * 1024;
size_t io_size = 4096;
size_t io_size = 128 * 1024;
// size_t io_size = 4096;
size_t max_size = 2ULL * 1024 * 1024 * 1024; /* 最大 2GB循环覆写 */
size_t max_count = max_size / io_size;
int test_sec = 10;

View File

@@ -10,7 +10,7 @@
#endif
struct spdk_thread *global_thread = NULL;
const char *json_file = "/home/lian/share/10.1-spdk/zvfs/zvfs.json";
const char *json_file = "/home/lian/share/10.1-spdk/zvfs/zvfs/zvfs.json";
// mount
void zvfs_do_mount(void *arg);
@@ -599,7 +599,7 @@ int zvfs_env_setup(void) {
return -1;
}
spdk_log_set_print_level(SPDK_LOG_NOTICE);
spdk_log_set_print_level(SPDK_LOG_ERROR);
spdk_log_set_level(SPDK_LOG_NOTICE);
spdk_log_open(NULL);

View File