From 093d01421d0c23288dba4b2342c2f9398a5483de Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Thu, 10 Jun 2021 16:06:53 +0200 Subject: [PATCH] test/ftl: Remove dead code In particular, non-volatile cache setup and EXTENDED fio tests: these haven't been supported nor tested by the CI, thus there's no value in keeping these routines anymore. fio tests are limited to what was previously called as a "basic" suite and hooked to standard SPDK_TEST_FTL flow. Code which is not used by the remaining tests is removed as well. Signed-off-by: Michal Berger Change-Id: I865da1ea4d8743322d4c303908c598efe6ecd40b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8294 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Reviewed-by: Karol Latecki Reviewed-by: Konrad Sztyber --- test/common/autotest_common.sh | 2 - test/ftl/common.sh | 32 ------------- test/ftl/config/fio/drive-prep.fio | 15 ------ test/ftl/config/fio/randr.fio | 19 -------- test/ftl/config/fio/randrw.fio | 20 -------- .../ftl/config/fio/randw-verify-qd128-ext.fio | 20 -------- test/ftl/config/fio/randw.fio | 4 +- test/ftl/dirty_shutdown.sh | 35 ++++---------- test/ftl/fio.sh | 20 ++------ test/ftl/ftl.sh | 48 +------------------ test/ftl/restore.sh | 37 ++++---------- 11 files changed, 26 insertions(+), 226 deletions(-) delete mode 100644 test/ftl/config/fio/drive-prep.fio delete mode 100644 test/ftl/config/fio/randr.fio delete mode 100644 test/ftl/config/fio/randrw.fio delete mode 100644 test/ftl/config/fio/randw-verify-qd128-ext.fio diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index f6f8549a3..4b85c6179 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -135,8 +135,6 @@ export SPDK_TEST_CRYPTO export SPDK_TEST_FTL : ${SPDK_TEST_OCF=0} export SPDK_TEST_OCF -: ${SPDK_TEST_FTL_EXTENDED=0} -export SPDK_TEST_FTL_EXTENDED : ${SPDK_TEST_VMD=0} export SPDK_TEST_VMD : ${SPDK_TEST_OPAL=0} diff --git a/test/ftl/common.sh b/test/ftl/common.sh index f4620ac3d..1aecc5e7d 100644 --- a/test/ftl/common.sh +++ b/test/ftl/common.sh @@ -15,38 +15,6 @@ function get_num_pu() { | grep 'PUs' | sed 's/[^0-9]//g' } -function has_separate_md() { - local md_type - md_type=$($SPDK_EXAMPLE_DIR/identify -r "trtype:PCIe traddr:$1" \ - | grep 'Metadata Transferred' | cut -d: -f2) - if [[ "$md_type" =~ Separate ]]; then - return 0 - else - return 1 - fi -} - -function create_nv_cache_bdev() { - local name=$1 - local ocssd_bdf=$2 - local cache_bdf=$3 - local num_punits=$4 - - local bytes_to_mb=$((1024 * 1024)) - local chunk_size - chunk_size=$(get_chunk_size $ocssd_bdf) - - # We need at least 2 bands worth of data + 1 block - local size=$((2 * 4096 * chunk_size * num_punits + 1)) - # Round the size up to the nearest megabyte - local size=$(((size + bytes_to_mb) / bytes_to_mb)) - - # Create NVMe bdev on specified device and split it so that it has the desired size - local nvc_bdev - nvc_bdev=$($rootdir/scripts/rpc.py bdev_nvme_attach_controller -b $name -t PCIe -a $cache_bdf) - $rootdir/scripts/rpc.py bdev_split_create $nvc_bdev -s $size 1 -} - function gen_ftl_nvme_conf() { jq . <<- JSON { diff --git a/test/ftl/config/fio/drive-prep.fio b/test/ftl/config/fio/drive-prep.fio deleted file mode 100644 index 430172ca9..000000000 --- a/test/ftl/config/fio/drive-prep.fio +++ /dev/null @@ -1,15 +0,0 @@ -[drive_prep] -ioengine=spdk_bdev -spdk_json_conf=${FTL_JSON_CONF} -filename=${FTL_BDEV_NAME} -thread=1 - -direct=1 -buffered=0 -size=100% -randrepeat=0 -norandommap -bs=4k -iodepth=128 -numjobs=1 -rw=write diff --git a/test/ftl/config/fio/randr.fio b/test/ftl/config/fio/randr.fio deleted file mode 100644 index f3f644476..000000000 --- a/test/ftl/config/fio/randr.fio +++ /dev/null @@ -1,19 +0,0 @@ -[global] -ioengine=spdk_bdev -spdk_json_conf=${FTL_JSON_CONF} -filename=${FTL_BDEV_NAME} -direct=1 -thread=1 -buffered=0 -size=100% -randrepeat=0 -time_based -norandommap - -[test] -stonewall -bs=4k -numjobs=4 -rw=randread -iodepth=128 -runtime=1200 diff --git a/test/ftl/config/fio/randrw.fio b/test/ftl/config/fio/randrw.fio deleted file mode 100644 index fdce9a477..000000000 --- a/test/ftl/config/fio/randrw.fio +++ /dev/null @@ -1,20 +0,0 @@ -[global] -ioengine=spdk_bdev -spdk_json_conf=${FTL_JSON_CONF} -filename=${FTL_BDEV_NAME} -direct=1 -thread=1 -buffered=0 -size=100% -randrepeat=0 -time_based -norandommap - -[test] -stonewall -bs=4k -numjobs=4 -rw=randrw -rwmixread=70 -iodepth=32 -runtime=1200 diff --git a/test/ftl/config/fio/randw-verify-qd128-ext.fio b/test/ftl/config/fio/randw-verify-qd128-ext.fio deleted file mode 100644 index f22b1f2ec..000000000 --- a/test/ftl/config/fio/randw-verify-qd128-ext.fio +++ /dev/null @@ -1,20 +0,0 @@ -[global] -ioengine=spdk_bdev -spdk_json_conf=${FTL_JSON_CONF} -filename=${FTL_BDEV_NAME} -thread=1 -direct=1 -iodepth=128 -rw=randwrite -verify=crc32c -do_verify=1 -verify_dump=0 -verify_state_save=0 -verify_fatal=1 -bs=4k -random_distribution=normal -serialize_overlap=1 - -[test] -io_size=64G -numjobs=1 diff --git a/test/ftl/config/fio/randw.fio b/test/ftl/config/fio/randw.fio index f5b20b124..b4a16b5b0 100644 --- a/test/ftl/config/fio/randw.fio +++ b/test/ftl/config/fio/randw.fio @@ -5,7 +5,7 @@ filename=${FTL_BDEV_NAME} direct=1 thread=1 buffered=0 -size=100% +size=256M randrepeat=0 time_based norandommap @@ -15,4 +15,4 @@ bs=4k numjobs=1 rw=randwrite iodepth=64 -runtime=1200 +runtime=10 diff --git a/test/ftl/dirty_shutdown.sh b/test/ftl/dirty_shutdown.sh index c0e1f3115..5f7a7086c 100755 --- a/test/ftl/dirty_shutdown.sh +++ b/test/ftl/dirty_shutdown.sh @@ -7,21 +7,12 @@ source $testdir/common.sh rpc_py=$rootdir/scripts/rpc.py -while getopts ':u:c:' opt; do - case $opt in - u) uuid=$OPTARG ;; - c) nv_cache=$OPTARG ;; - ?) echo "Usage: $0 [-u UUID] [-c NV_CACHE_PCI_BDF] OCSSD_PCI_BDF" && exit 1 ;; - esac -done -shift $((OPTIND - 1)) - device=$1 restore_kill() { - rm -f $testdir/config/ftl.json - rm -f $testdir/testfile.md5 - rm -f $testdir/testfile2.md5 + rm -f "$config" + rm -f "$SPDK_TEST_STORAGE/testfile.md5" + rm -f "$SPDK_TEST_STORAGE/testfile2.md5" killprocess $svcpid || true rmmod nbd || true @@ -33,6 +24,7 @@ chunk_size=$(get_chunk_size $device) num_group=$(get_num_group $device) num_pu=$(get_num_pu $device) pu_count=$((num_group * num_pu)) +config=$SPDK_TEST_STORAGE/ftl.json # Write one band worth of data + one extra chunk data_size=$((chunk_size * (pu_count + 1))) @@ -41,17 +33,10 @@ data_size=$((chunk_size * (pu_count + 1))) svcpid=$! waitforlisten $svcpid -if [ -n "$nv_cache" ]; then - nvc_bdev=$(create_nv_cache_bdev nvc0 $device $nv_cache $pu_count) -fi - $rpc_py bdev_nvme_attach_controller -b nvme0 -a $device -t pcie $rpc_py bdev_ocssd_create -c nvme0 -b nvme0n1 -n 1 ftl_construct_args="bdev_ftl_create -b ftl0 -d nvme0n1 -o" -[ -n "$nvc_bdev" ] && ftl_construct_args+=" -c $nvc_bdev" -[ -n "$uuid" ] && ftl_construct_args+=" -u $uuid" - $rpc_py $ftl_construct_args # Load the nbd driver @@ -59,11 +44,11 @@ modprobe nbd $rpc_py nbd_start_disk ftl0 /dev/nbd0 waitfornbd nbd0 -$rpc_py save_config > $testdir/config/ftl.json +$rpc_py save_config > "$config" dd if=/dev/urandom of=/dev/nbd0 bs=4K count=$data_size oflag=dsync # Calculate checksum of the data written -dd if=/dev/nbd0 bs=4K count=$data_size | md5sum > $testdir/testfile.md5 +dd if=/dev/nbd0 bs=4K count=$data_size | md5sum > "$SPDK_TEST_STORAGE/testfile.md5" $rpc_py nbd_stop_disk /dev/nbd0 # Force kill bdev service (dirty shutdown) and start it again @@ -74,20 +59,20 @@ rm -f /dev/shm/spdk_tgt_trace.pid$svcpid svcpid=$! waitforlisten $svcpid -$rpc_py load_config < $testdir/config/ftl.json +$rpc_py load_config < "$config" waitfornbd nbd0 # Write extra data after restore dd if=/dev/urandom of=/dev/nbd0 bs=4K count=$chunk_size seek=$data_size oflag=dsync # Save md5 data -dd if=/dev/nbd0 bs=4K count=$chunk_size skip=$data_size | md5sum > $testdir/testfile2.md5 +dd if=/dev/nbd0 bs=4K count=$chunk_size skip=$data_size | md5sum > "$SPDK_TEST_STORAGE/testfile2.md5" # Make sure all data will be read from disk echo 3 > /proc/sys/vm/drop_caches # Verify that the checksum matches and the data is consistent -dd if=/dev/nbd0 bs=4K count=$data_size | md5sum -c $testdir/testfile.md5 -dd if=/dev/nbd0 bs=4K count=$chunk_size skip=$data_size | md5sum -c $testdir/testfile2.md5 +dd if=/dev/nbd0 bs=4K count=$data_size | md5sum -c "$SPDK_TEST_STORAGE/testfile.md5" +dd if=/dev/nbd0 bs=4K count=$chunk_size skip=$data_size | md5sum -c "$SPDK_TEST_STORAGE/testfile2.md5" trap - SIGINT SIGTERM EXIT restore_kill diff --git a/test/ftl/fio.sh b/test/ftl/fio.sh index 3ad2a085a..047b77856 100755 --- a/test/ftl/fio.sh +++ b/test/ftl/fio.sh @@ -5,9 +5,7 @@ rootdir=$(readlink -f $testdir/../..) source $rootdir/test/common/autotest_common.sh source $testdir/common.sh -declare -A suite -suite['basic']='randw-verify randw-verify-j2 randw-verify-depth128' -suite['extended']='drive-prep randw-verify-qd128-ext randw randr randrw' +tests=(randw randw-verify randw-verify-j2 randw-verify-depth128) rpc_py=$rootdir/scripts/rpc.py @@ -17,19 +15,12 @@ fio_kill() { } device=$1 -tests=${suite[$2]} -uuid=$3 if [[ $CONFIG_FIO_PLUGIN != y ]]; then echo "FIO not available" exit 1 fi -if [ -z "$tests" ]; then - echo "Invalid test suite '$2'" - exit 1 -fi - export FTL_BDEV_NAME=ftl0 export FTL_JSON_CONF=$testdir/config/ftl.json @@ -41,12 +32,7 @@ waitforlisten $svcpid $rpc_py bdev_nvme_attach_controller -b nvme0 -a $device -t pcie $rpc_py bdev_ocssd_create -c nvme0 -b nvme0n1 - -if [ -z "$uuid" ]; then - $rpc_py bdev_ftl_create -b ftl0 -d nvme0n1 -else - $rpc_py bdev_ftl_create -b ftl0 -d nvme0n1 -u $uuid -fi +$rpc_py bdev_ftl_create -b ftl0 -d nvme0n1 waitforbdev ftl0 @@ -59,7 +45,7 @@ waitforbdev ftl0 killprocess $svcpid trap - SIGINT SIGTERM EXIT -for test in ${tests}; do +for test in "${tests[@]}"; do timing_enter $test fio_bdev $testdir/config/fio/$test.fio timing_exit $test diff --git a/test/ftl/ftl.sh b/test/ftl/ftl.sh index 9cd448836..7acf6c9b1 100755 --- a/test/ftl/ftl.sh +++ b/test/ftl/ftl.sh @@ -5,8 +5,6 @@ rootdir=$(readlink -f $testdir/../..) source $rootdir/test/common/autotest_common.sh source $testdir/common.sh -rpc_py=$rootdir/scripts/rpc.py - function at_ftl_exit() { # restore original driver PCI_ALLOWED="$device" PCI_BLOCKED="" DRIVER_OVERRIDE="$ocssd_original_dirver" $rootdir/scripts/setup.sh @@ -29,52 +27,8 @@ trap 'at_ftl_exit' SIGINT SIGTERM EXIT # OCSSD is blocked so bind it to vfio/uio driver before testing PCI_ALLOWED="$device" PCI_BLOCKED="" DRIVER_OVERRIDE="" $rootdir/scripts/setup.sh -# Use first regular NVMe disk (non-OC) as non-volatile cache -nvme_disks=$($rootdir/scripts/gen_nvme.sh | jq -r \ - ".config[] | select(.params.traddr != \"$device\").params.traddr") - -for disk in $nvme_disks; do - if has_separate_md $disk; then - nv_cache=$disk - break - fi -done - -if [ -z "$nv_cache" ]; then - # TODO: once CI has devices with separate metadata support fail the test here - echo "Couldn't find NVMe device to be used as non-volatile cache" -fi - run_test "ftl_bdevperf" $testdir/bdevperf.sh $device run_test "ftl_bdevperf_append" $testdir/bdevperf.sh $device --use_append - run_test "ftl_restore" $testdir/restore.sh $device -if [ -n "$nv_cache" ]; then - run_test "ftl_restore_nv_cache" $testdir/restore.sh -c $nv_cache $device -fi - -if [ -n "$nv_cache" ]; then - run_test "ftl_dirty_shutdown" $testdir/dirty_shutdown.sh -c $nv_cache $device -fi - run_test "ftl_json" $testdir/json.sh $device - -if [ $SPDK_TEST_FTL_EXTENDED -eq 1 ]; then - run_test "ftl_fio_basic" $testdir/fio.sh $device basic - - "$SPDK_BIN_DIR/spdk_tgt" --json <(gen_ftl_nvme_conf) & - svcpid=$! - - trap 'killprocess $svcpid; exit 1' SIGINT SIGTERM EXIT - - waitforlisten $svcpid - - $rpc_py bdev_nvme_attach_controller -b nvme0 -a $device -t pcie - $rpc_py bdev_ocssd_create -c nvme0 -b nvme0n1 -n 1 - uuid=$($rpc_py bdev_ftl_create -b ftl0 -d nvme0n1 | jq -r '.uuid') - killprocess $svcpid - - trap - SIGINT SIGTERM EXIT - - run_test "ftl_fio_extended" $testdir/fio.sh $device extended $uuid -fi +run_test "ftl_fio" "$testdir/fio.sh" "$device" diff --git a/test/ftl/restore.sh b/test/ftl/restore.sh index 7b6b0ef05..d63ede56a 100755 --- a/test/ftl/restore.sh +++ b/test/ftl/restore.sh @@ -9,27 +9,17 @@ rpc_py=$rootdir/scripts/rpc.py mount_dir=$(mktemp -d) -while getopts ':u:c:' opt; do - case $opt in - u) uuid=$OPTARG ;; - c) nv_cache=$OPTARG ;; - ?) echo "Usage: $0 [-u UUID] [-c NV_CACHE_PCI_BDF] OCSSD_PCI_BDF" && exit 1 ;; - esac -done -shift $((OPTIND - 1)) device=$1 -num_group=$(get_num_group $device) -num_pu=$(get_num_pu $device) -pu_count=$((num_group * num_pu)) +config=$SPDK_TEST_STORAGE/ftl.json restore_kill() { if mount | grep $mount_dir; then umount $mount_dir fi rm -rf $mount_dir - rm -f $testdir/testfile.md5 - rm -f $testdir/testfile2.md5 - rm -f $testdir/config/ftl.json + rm -f "$SPDK_TEST_STORAGE/testfile.md5" + rm -f "$SPDK_TEST_STORAGE/testfile2.md5" + rm -f "$config" killprocess $svcpid rmmod nbd || true @@ -42,17 +32,10 @@ svcpid=$! # Wait until spdk_tgt starts waitforlisten $svcpid -if [ -n "$nv_cache" ]; then - nvc_bdev=$(create_nv_cache_bdev nvc0 $device $nv_cache $pu_count) -fi - $rpc_py bdev_nvme_attach_controller -b nvme0 -a $device -t pcie $rpc_py bdev_ocssd_create -c nvme0 -b nvme0n1 -n 1 ftl_construct_args="bdev_ftl_create -b ftl0 -d nvme0n1" -[ -n "$uuid" ] && ftl_construct_args+=" -u $uuid" -[ -n "$nv_cache" ] && ftl_construct_args+=" -c $nvc_bdev" - $rpc_py $ftl_construct_args # Load the nbd driver @@ -60,7 +43,7 @@ modprobe nbd $rpc_py nbd_start_disk ftl0 /dev/nbd0 waitfornbd nbd0 -$rpc_py save_config > $testdir/config/ftl.json +$rpc_py save_config > "$config" # Prepare the disk by creating ext4 fs and putting a file on it make_filesystem ext4 /dev/nbd0 @@ -68,7 +51,7 @@ mount /dev/nbd0 $mount_dir dd if=/dev/urandom of=$mount_dir/testfile bs=4K count=256K sync mount -o remount /dev/nbd0 $mount_dir -md5sum $mount_dir/testfile > $testdir/testfile.md5 +md5sum $mount_dir/testfile > "$SPDK_TEST_STORAGE/testfile.md5" # Kill bdev service and start it again umount $mount_dir @@ -79,21 +62,21 @@ svcpid=$! # Wait until spdk_tgt starts waitforlisten $svcpid -$rpc_py load_config < $testdir/config/ftl.json +$rpc_py load_config < "$config" waitfornbd nbd0 mount /dev/nbd0 $mount_dir # Write second file, to make sure writer thread has restored properly dd if=/dev/urandom of=$mount_dir/testfile2 bs=4K count=256K -md5sum $mount_dir/testfile2 > $testdir/testfile2.md5 +md5sum $mount_dir/testfile2 > "$SPDK_TEST_STORAGE/testfile2.md5" # Make sure second file will be read from disk echo 3 > /proc/sys/vm/drop_caches # Check both files have proper data -md5sum -c $testdir/testfile.md5 -md5sum -c $testdir/testfile2.md5 +md5sum -c "$SPDK_TEST_STORAGE/testfile.md5" +md5sum -c "$SPDK_TEST_STORAGE/testfile2.md5" trap - SIGINT SIGTERM EXIT restore_kill