summaryrefslogtreecommitdiffstats
path: root/src/spdk/test/ocf/integrity
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/spdk/test/ocf/integrity
parentInitial commit. (diff)
downloadceph-b26c4052f3542036551aa9dec9caa4226e456195.tar.xz
ceph-b26c4052f3542036551aa9dec9caa4226e456195.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/spdk/test/ocf/integrity')
-rwxr-xr-xsrc/spdk/test/ocf/integrity/bdevperf-iotypes.sh13
-rwxr-xr-xsrc/spdk/test/ocf/integrity/fio-modes.sh90
-rw-r--r--src/spdk/test/ocf/integrity/mallocs.conf59
-rwxr-xr-xsrc/spdk/test/ocf/integrity/stats.sh17
-rw-r--r--src/spdk/test/ocf/integrity/test.fio39
5 files changed, 218 insertions, 0 deletions
diff --git a/src/spdk/test/ocf/integrity/bdevperf-iotypes.sh b/src/spdk/test/ocf/integrity/bdevperf-iotypes.sh
new file mode 100755
index 000000000..2effa21bd
--- /dev/null
+++ b/src/spdk/test/ocf/integrity/bdevperf-iotypes.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+curdir=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
+rootdir=$(readlink -f $curdir/../../..)
+source $rootdir/test/common/autotest_common.sh
+
+bdevperf=$rootdir/test/bdev/bdevperf/bdevperf
+rpc_py="$rootdir/scripts/rpc.py"
+
+source "$curdir/mallocs.conf"
+$bdevperf --json <(gen_malloc_ocf_json) -q 128 -o 4096 -t 4 -w flush
+$bdevperf --json <(gen_malloc_ocf_json) -q 128 -o 4096 -t 4 -w unmap
+$bdevperf --json <(gen_malloc_ocf_json) -q 128 -o 4096 -t 4 -w write
diff --git a/src/spdk/test/ocf/integrity/fio-modes.sh b/src/spdk/test/ocf/integrity/fio-modes.sh
new file mode 100755
index 000000000..0c90f999f
--- /dev/null
+++ b/src/spdk/test/ocf/integrity/fio-modes.sh
@@ -0,0 +1,90 @@
+#!/usr/bin/env bash
+
+curdir=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
+rootdir=$(readlink -f $curdir/../../..)
+
+source $rootdir/test/ocf/common.sh
+
+function fio_verify() {
+ fio_bdev $curdir/test.fio --aux-path=/tmp/ --ioengine=spdk_bdev "$@"
+}
+
+function cleanup() {
+ rm -f $curdir/modes.conf
+}
+
+# Clear nvme device which we will use in test
+clear_nvme
+
+trap "cleanup; exit 1" SIGINT SIGTERM EXIT
+
+# Building config is not backtrace worthy ...
+xtrace_disable
+
+config=() ocf_names=() ocf_modes=()
+
+ocf_names[1]=PT_Nvme ocf_modes[1]=pt
+ocf_names[2]=WT_Nvme ocf_modes[2]=wt
+ocf_names[3]=WB_Nvme0 ocf_modes[3]=wb
+ocf_names[4]=WB_Nvme1 ocf_modes[4]=wb
+
+mapfile -t config < <("$rootdir/scripts/gen_nvme.sh" --json)
+
+# Drop anything from last closing ] so we can inject our own config pieces ...
+config=("${config[@]::${#config[@]}-2}")
+# ... and now convert entire array to a single string item
+config=("${config[*]}")
+
+config+=(
+ "$(
+ cat <<- JSON
+ {
+ "method": "bdev_split_create",
+ "params": {
+ "base_bdev": "Nvme0n1",
+ "split_count": 8,
+ "split_size_mb": 101
+ }
+ }
+ JSON
+ )"
+)
+
+for ((d = 0, c = 1; d <= ${#ocf_names[@]} + 2; d += 2, c++)); do
+ config+=(
+ "$(
+ cat <<- JSON
+ {
+ "method": "bdev_ocf_create",
+ "params": {
+ "name": "${ocf_names[c]}",
+ "mode": "${ocf_modes[c]}",
+ "cache_bdev_name": "Nvme0n1p$d",
+ "core_bdev_name": "Nvme0n1p$((d + 1))"
+ }
+ }
+ JSON
+ )"
+ )
+done
+
+# First ']}' closes our config and bdev subsystem blocks
+cat <<- CONFIG > "$curdir/modes.conf"
+ {"subsystems":[
+ $(
+ IFS=","
+ printf '%s\n' "${config[*]}"
+ )
+ ]}]}
+CONFIG
+
+# Format the config nicely and dump it to stdout for everyone to marvel at it ...
+jq . "$curdir/modes.conf"
+
+# ... and now back to our regularly scheduled program
+xtrace_restore
+
+fio_verify --filename=PT_Nvme:WT_Nvme:WB_Nvme0:WB_Nvme1 --spdk_json_conf="$curdir/modes.conf" --thread=1
+
+trap - SIGINT SIGTERM EXIT
+cleanup
diff --git a/src/spdk/test/ocf/integrity/mallocs.conf b/src/spdk/test/ocf/integrity/mallocs.conf
new file mode 100644
index 000000000..245dd23cf
--- /dev/null
+++ b/src/spdk/test/ocf/integrity/mallocs.conf
@@ -0,0 +1,59 @@
+gen_malloc_ocf_json () {
+ local size=300 # MB
+ local block_size=512
+ local config
+
+ local malloc malloc_devs=3
+ for (( malloc = 0; malloc < malloc_devs; malloc++ )); do
+ config+=(
+ "$(
+ cat <<-JSON
+ {
+ "method": "bdev_malloc_create",
+ "params": {
+ "name": "Malloc$malloc",
+ "num_blocks": $(( (size << 20) / block_size )),
+ "block_size": 512
+ }
+ }
+ JSON
+ )"
+ )
+ done
+
+ local ocfs ocf ocf_mode ocf_cache ocf_core
+ ocfs=(1 2)
+ ocf_mode[1]=wt ocf_cache[1]=Malloc0 ocf_core[1]=Malloc1
+ ocf_mode[2]=pt ocf_cache[2]=Malloc0 ocf_core[2]=Malloc2
+
+ for ocf in "${ocfs[@]}"; do
+ config+=(
+ "$(
+ cat <<-JSON
+ {
+ "method": "bdev_ocf_create",
+ "params": {
+ "name": "MalCache$ocf",
+ "mode": "${ocf_mode[ocf]}",
+ "cache_bdev_name": "${ocf_cache[ocf]}",
+ "core_bdev_name": "${ocf_core[ocf]}"
+ }
+ }
+ JSON
+ )"
+ )
+ done
+
+ jq . <<-JSON
+ {
+ "subsystems": [
+ {
+ "subsystem": "bdev",
+ "config": [
+ $(IFS=","; printf '%s\n' "${config[*]}")
+ ]
+ }
+ ]
+ }
+ JSON
+}
diff --git a/src/spdk/test/ocf/integrity/stats.sh b/src/spdk/test/ocf/integrity/stats.sh
new file mode 100755
index 000000000..c82f89d89
--- /dev/null
+++ b/src/spdk/test/ocf/integrity/stats.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+curdir=$(dirname $(readlink -f "${BASH_SOURCE[0]}"))
+rootdir=$(readlink -f $curdir/../../..)
+source $rootdir/test/common/autotest_common.sh
+
+bdevperf=$rootdir/test/bdev/bdevperf/bdevperf
+rpc_py="$rootdir/scripts/rpc.py"
+
+source "$curdir/mallocs.conf"
+$bdevperf --json <(gen_malloc_ocf_json) -q 128 -o 4096 -w write -t 120 -r /var/tmp/spdk.sock &
+bdev_perf_pid=$!
+waitforlisten $bdev_perf_pid
+sleep 1
+$rpc_py bdev_ocf_get_stats MalCache1
+kill -9 $bdev_perf_pid
+wait $bdev_perf_pid || true
diff --git a/src/spdk/test/ocf/integrity/test.fio b/src/spdk/test/ocf/integrity/test.fio
new file mode 100644
index 000000000..e56895c28
--- /dev/null
+++ b/src/spdk/test/ocf/integrity/test.fio
@@ -0,0 +1,39 @@
+[global]
+thread=1
+group_reporting=1
+direct=1
+serialize_overlap=1
+time_based=1
+do_verify=1
+verify=md5
+verify_backlog=1024
+iodepth=128
+bs=4K
+runtime=10
+
+size=20%
+
+[job_1]
+offset=0
+rw=randwrite
+name=randwrite
+
+[job_2]
+offset=20%
+rw=randrw
+name=randrw
+
+[job_3]
+offset=40%
+rw=write
+name=write
+
+[job_4]
+offset=60%
+rw=rw
+name=rw
+
+[job_5]
+offset=80%
+rw=randwrite
+name=randwrite