diff --git a/examples/bdev/fio_plugin/fio_plugin.c b/examples/bdev/fio_plugin/fio_plugin.c index 465dfd0d6..83dfcb3a4 100644 --- a/examples/bdev/fio_plugin/fio_plugin.c +++ b/examples/bdev/fio_plugin/fio_plugin.c @@ -501,6 +501,11 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u) io_u->buf, io_u->offset, io_u->xfer_buflen, spdk_fio_completion_cb, fio_req); break; + case DDIR_TRIM: + rc = spdk_bdev_unmap(target->desc, target->ch, + io_u->offset, io_u->xfer_buflen, + spdk_fio_completion_cb, fio_req); + break; default: assert(false); break; diff --git a/scripts/autotest_common.sh b/scripts/autotest_common.sh index 051542d6b..23a4057cb 100755 --- a/scripts/autotest_common.sh +++ b/scripts/autotest_common.sh @@ -400,6 +400,8 @@ EOL if [ "$workload" == "verify" ]; then echo "verify=sha1" >> $config_file echo "rw=randwrite" >> $config_file + elif [ "$workload" == "trim" ]; then + echo "rw=trimwrite" >> $config_file else echo "rw=$workload" >> $config_file fi diff --git a/test/lib/bdev/blockdev.sh b/test/lib/bdev/blockdev.sh index 6a7a88515..7fdc06d1d 100755 --- a/test/lib/bdev/blockdev.sh +++ b/test/lib/bdev/blockdev.sh @@ -33,6 +33,7 @@ timing_exit bdev_svc if [ -d /usr/src/fio ] && [ $SPDK_RUN_ASAN -eq 0 ]; then timing_enter fio + timing_enter fio_rw_verify # Generate the fio config file given the list of all unclaimed bdevs fio_config_gen $testdir/bdev.fio verify for b in $(echo $bdevs | jq -r '.name'); do @@ -49,18 +50,35 @@ if [ -d /usr/src/fio ] && [ $SPDK_RUN_ASAN -eq 0 ]; then rm -f *.state rm -f $testdir/bdev.fio + timing_exit fio_rw_verify + + timing_enter fio_trim + # Generate the fio config file given the list of all unclaimed bdevs that support unmap + fio_config_gen $testdir/bdev.fio trim + for b in $(echo $bdevs | jq -r 'select(.supported_io_types.unmap == true) | .name'); do + fio_config_add_job $testdir/bdev.fio $b + done + + if [ $RUN_NIGHTLY -eq 0 ]; then + LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio --ioengine=spdk_bdev --spdk_conf=./test/lib/bdev/bdev.conf --iodepth=8 --bs=4k --runtime=10 $testdir/bdev.fio + else + # Use size 192KB which both exceeds typical 128KB max NVMe I/O + # size and will cross 128KB Intel DC P3700 stripe boundaries. + LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio --ioengine=spdk_bdev --spdk_conf=./test/lib/bdev/bdev.conf --iodepth=128 --bs=192k --runtime=100 $testdir/bdev.fio + fi + + rm -f *.state + rm -f $testdir/bdev.fio + timing_exit fio_trim + timing_exit fio fi if [ $RUN_NIGHTLY -eq 1 ]; then # Temporarily disabled - infinite loop - #timing_enter reset + timing_enter reset #$testdir/bdevperf/bdevperf -c $testdir/bdev.conf -q 16 -w reset -s 4096 -t 60 - #timing_exit reset - - timing_enter unmap - $testdir/bdevperf/bdevperf -c $testdir/bdev.conf -q 1 -w unmap -s 4096 -t 60 - timing_exit unmap + timing_exit reset fi rm -f /tmp/aiofile