add zv2404fs.c and fio

This commit is contained in:
wangbojing
2024-08-06 14:35:59 +00:00
parent 5f520127a8
commit 2871adf324
9 changed files with 197 additions and 0 deletions

14
Makefile Executable file
View File

@@ -0,0 +1,14 @@
# SPDX-License-Identifier: BSD-3-Clause
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.modules.mk
APP = zvfs
C_SRCS := zv2404fs.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST) event event_bdev
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

18
fio_script/bdev.fio Executable file
View File

@@ -0,0 +1,18 @@
[global]
ioengine=spdk_bdev
spdk_json_conf=/home/king/share/zvfs/fio_script/zvfs.json
thread=1
direct=1
time_based
runtime=10
rw=randwrite
bs=16K
zonemode=zbd
max_open_zones=8
initial_zone_reset=1
zone_append=1
iodepth=64
[test]
filename=Zone0
numjobs=1

19
fio_script/io_uring.fio Executable file
View File

@@ -0,0 +1,19 @@
[global]
thread=1
group_reporting=1
direct=1
verify=0
time_based=1
runtime=10
bs=16K
size=16384
iodepth=64
rw=randwrite
filename=kingfs
ioengine=io_uring
[test]
stonewall
description="variable bs"
bs=16K

BIN
fio_script/kingfs Executable file

Binary file not shown.

19
fio_script/libaio.fio Executable file
View File

@@ -0,0 +1,19 @@
[global]
thread=1
group_reporting=1
direct=1
verify=0
time_based=1
runtime=10
bs=16K
size=16384
iodepth=64
rw=randwrite
filename=kingfs
ioengine=libaio
[test]
stonewall
description="variable bs"
bs=16K

18
fio_script/nvme.fio Executable file
View File

@@ -0,0 +1,18 @@
[global]
thread=1
group_reporting=1
direct=1
verify=0
time_based=1
ramp_time=10
runtime=10
bs=16K
size=16384
iodepth=64
rw=randwrite
ioengine=spdk
[test]
numjobs=1
filename=trtype=PCIe traddr=0000.03.00.0 ns=1
bs=16k

20
fio_script/psync.fio Executable file
View File

@@ -0,0 +1,20 @@
[global]
thread=1
group_reporting=1
direct=1
verify=0
time_based=1
runtime=10
bs=16K
size=16384
iodepth=64
rw=randwrite
filename=kingfs
ioengine=psync
[test]
stonewall
description="variable bs"
bs=16K

35
fio_script/zvfs.json Executable file
View File

@@ -0,0 +1,35 @@
{
"subsystems": [
{
"subsystem": "bdev",
"config": [
{
"method": "bdev_nvme_attach_controller",
"params":
{
"trtype": "PCIe",
"name":"Nvme0",
"traddr":"0000:03:00.0"
}
},
{
"method": "bdev_malloc_create",
"params": {
"name": "Malloc0",
"num_blocks": 2097152,
"block_size": 512
}
},
{
"method": "bdev_zone_block_create",
"params": {
"base_bdev": "Malloc0",
"name": "Zone0",
"zone_capacity": 262144,
"optimal_open_zones": 8
}
}
]
}
]
}

54
zv2404fs.c Executable file
View File

@@ -0,0 +1,54 @@
#include <stdio.h>
#include <spdk/event.h>
#include <spdk/blob.h>
#include <spdk/bdev.h>
#include <spdk/blob_bdev.h>
void zv2404_spdk_bdev_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev *bdev,
void *event_ctx) {
printf("zv2404_spdk_bdev_event_cb\n");
}
static void zv2404fs_entry(void *ctx) {
struct spdk_bs_dev *bs_dev = NULL;
int rc = spdk_bdev_create_bs_dev_ext("Malloc0", zv2404_spdk_bdev_event_cb, NULL, &bs_dev);
if (rc != 0) {
spdk_app_stop(0);
}
printf("zv2404fs_entry\n");
}
int main(int argc, char *argv[]) {
if (argc != 2) return -1;
struct spdk_app_opts opts = {};
spdk_app_opts_init(&opts, sizeof(opts));
opts.name = "zv2404fs";
opts.json_config_file = argv[1];
spdk_app_start(&opts, zv2404fs_entry, NULL);
printf("hello spdk\n");
}