2017-09-12 13:47:30 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
|
|
|
plugindir=$rootdir/examples/bdev/fio_plugin
|
|
|
|
rpc_py="$rootdir/scripts/rpc.py"
|
|
|
|
|
2017-10-25 12:23:27 +00:00
|
|
|
if [ $RUN_NIGHTLY -eq 1 ]; then
|
|
|
|
fio_rw=("write" "randwrite" "rw" "randrw")
|
|
|
|
else
|
|
|
|
fio_rw=("randwrite")
|
|
|
|
fi
|
2017-10-06 14:42:32 +00:00
|
|
|
|
2017-10-25 12:23:27 +00:00
|
|
|
function run_fio() {
|
2017-09-12 13:47:30 +00:00
|
|
|
LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio --ioengine=spdk_bdev --iodepth=128 --bs=4k --runtime=10 $testdir/bdev.fio "$@" --spdk_mem=1024
|
|
|
|
fio_status=$?
|
|
|
|
if [ $fio_status != 0 ]; then
|
|
|
|
spdk_vhost_kill
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-10-25 12:23:27 +00:00
|
|
|
rm -f *.state
|
|
|
|
rm -f $testdir/bdev.fio
|
2017-09-12 13:47:30 +00:00
|
|
|
}
|
|
|
|
|
2017-10-03 19:06:27 +00:00
|
|
|
function prepare_fio_job_4G() {
|
|
|
|
rw="$1"
|
|
|
|
fio_bdevs="$2"
|
|
|
|
echo "size=1G" >> $testdir/bdev.fio
|
|
|
|
echo "io_size=4G" >> $testdir/bdev.fio
|
|
|
|
echo "offset=4G" >> $testdir/bdev.fio
|
|
|
|
echo "[job_$rw]" >> $testdir/bdev.fio
|
|
|
|
echo "stonewall" >> $testdir/bdev.fio
|
|
|
|
echo "rw=$rw" >> $testdir/bdev.fio
|
|
|
|
echo -n "filename=" >> $testdir/bdev.fio
|
|
|
|
for b in $(echo $fio_bdevs | jq -r '.name'); do
|
|
|
|
echo -n "$b:" >> $testdir/bdev.fio
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2017-10-06 14:42:32 +00:00
|
|
|
function prepare_fio_job_for_unmap() {
|
2017-10-03 19:06:27 +00:00
|
|
|
fio_bdevs="$1"
|
2017-10-06 14:42:32 +00:00
|
|
|
echo -n "filename=" >> $testdir/bdev.fio
|
2017-10-03 19:06:27 +00:00
|
|
|
for b in $(echo $fio_bdevs | jq -r '.name'); do
|
2017-10-06 14:42:32 +00:00
|
|
|
echo -n "$b:" >> $testdir/bdev.fio
|
|
|
|
done
|
|
|
|
echo "" >> $testdir/bdev.fio
|
|
|
|
echo "size=100m" >> $testdir/bdev.fio
|
|
|
|
echo "io_size=400m" >> $testdir/bdev.fio
|
|
|
|
|
|
|
|
# Check that sequential TRIM/UNMAP operations 'zeroes' disk space
|
|
|
|
echo "[trim_sequential]" >> $testdir/bdev.fio
|
|
|
|
echo "stonewall" >> $testdir/bdev.fio
|
|
|
|
echo "rw=trim" >> $testdir/bdev.fio
|
|
|
|
echo "trim_verify_zero=1" >> $testdir/bdev.fio
|
|
|
|
|
|
|
|
# Check that random TRIM/UNMAP operations 'zeroes' disk space
|
|
|
|
echo "[trim_random]" >> $testdir/bdev.fio
|
|
|
|
echo "stonewall" >> $testdir/bdev.fio
|
|
|
|
echo "rw=randtrim" >> $testdir/bdev.fio
|
|
|
|
echo "trim_verify_zero=1" >> $testdir/bdev.fio
|
|
|
|
|
|
|
|
# Check that after TRIM/UNMAP operation disk space can be used for read
|
|
|
|
# by using write with verify (which implies reads)
|
2017-10-23 16:33:54 +00:00
|
|
|
echo "[write]" >> $testdir/bdev.fio
|
2017-10-06 14:42:32 +00:00
|
|
|
echo "stonewall" >> $testdir/bdev.fio
|
2017-10-23 16:33:54 +00:00
|
|
|
echo "rw=write" >> $testdir/bdev.fio
|
2017-10-06 14:42:32 +00:00
|
|
|
}
|
|
|
|
|
2017-09-12 13:47:30 +00:00
|
|
|
source $rootdir/test/vhost/common/common.sh
|
|
|
|
$rootdir/scripts/gen_nvme.sh
|
|
|
|
spdk_vhost_run $testdir
|
|
|
|
$rpc_py construct_malloc_bdev 128 512
|
|
|
|
$rpc_py construct_malloc_bdev 128 4096
|
|
|
|
$rpc_py add_vhost_scsi_lun vhost.0 0 Nvme0n1
|
|
|
|
$rpc_py add_vhost_scsi_lun vhost.1 0 Malloc0
|
|
|
|
$rpc_py add_vhost_scsi_lun vhost.2 0 Malloc1
|
|
|
|
$rpc_py get_bdevs
|
|
|
|
bdevs=$($rpc_py get_bdevs | jq -r '.[] | .name')
|
|
|
|
|
|
|
|
for bdev in $bdevs; do
|
|
|
|
timing_enter bdev
|
|
|
|
|
|
|
|
cp $testdir/bdev.conf.in $testdir/bdev.conf
|
|
|
|
if [ $bdev == "Nvme0n1" ]; then
|
|
|
|
sed -i "s|/tmp/vhost.0|$rootdir/../vhost/vhost.0|g" $testdir/bdev.conf
|
|
|
|
elif [ $bdev == "Malloc0" ]; then
|
|
|
|
sed -i "s|/tmp/vhost.0|$rootdir/../vhost/vhost.1|g" $testdir/bdev.conf
|
|
|
|
else
|
|
|
|
sed -i "s|/tmp/vhost.0|$rootdir/../vhost/vhost.2|g" $testdir/bdev.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
timing_enter bounds
|
|
|
|
$rootdir/test/lib/bdev/bdevio/bdevio $testdir/bdev.conf
|
|
|
|
timing_exit bounds
|
|
|
|
|
|
|
|
timing_enter bdev_svc
|
2017-12-04 21:30:34 +00:00
|
|
|
bdevs=$(discover_bdevs $rootdir $testdir/bdev.conf | jq -r '.[] | select(.claimed == false)')
|
2017-09-12 13:47:30 +00:00
|
|
|
timing_exit bdev_svc
|
|
|
|
|
2017-11-23 20:26:36 +00:00
|
|
|
if [ -d /usr/src/fio ]; then
|
2017-09-12 13:47:30 +00:00
|
|
|
timing_enter fio
|
|
|
|
for rw in "${fio_rw[@]}"; do
|
|
|
|
timing_enter fio_rw_verify
|
|
|
|
cp $testdir/../common/fio_jobs/default_initiator.job $testdir/bdev.fio
|
|
|
|
echo "[job_$rw]" >> $testdir/bdev.fio
|
|
|
|
echo "stonewall" >> $testdir/bdev.fio
|
|
|
|
echo "rw=$rw" >> $testdir/bdev.fio
|
|
|
|
echo -n "filename=" >> $testdir/bdev.fio
|
|
|
|
for b in $(echo $bdevs | jq -r '.name'); do
|
|
|
|
echo -n "$b:" >> $testdir/bdev.fio
|
|
|
|
done
|
|
|
|
|
|
|
|
run_fio --spdk_conf=$testdir/bdev.conf
|
|
|
|
|
|
|
|
timing_exit fio_rw_verify
|
|
|
|
done
|
|
|
|
|
2017-10-06 14:42:32 +00:00
|
|
|
#Host test for unmap
|
|
|
|
cp $testdir/../common/fio_jobs/default_initiator.job $testdir/bdev.fio
|
2017-10-03 19:06:27 +00:00
|
|
|
prepare_fio_job_for_unmap "$bdevs"
|
2017-10-06 14:42:32 +00:00
|
|
|
run_fio --spdk_conf=$testdir/bdev.conf
|
2017-10-03 19:06:27 +00:00
|
|
|
|
|
|
|
#Host test for +4G
|
|
|
|
if [ $bdev == "Nvme0n1" ]; then
|
|
|
|
for rw in "${fio_rw[@]}"; do
|
|
|
|
timing_enter fio_4G_rw_verify
|
|
|
|
echo "INFO: Running 4G test $rw for disk $bdev"
|
|
|
|
cp $testdir/../common/fio_jobs/default_initiator.job $testdir/bdev.fio
|
|
|
|
prepare_fio_job_4G "$rw" "$bdevs"
|
|
|
|
run_fio --spdk_conf=$testdir/bdev.conf
|
|
|
|
timing_exit fio_4G_rw_verify
|
|
|
|
done
|
|
|
|
fi
|
2017-09-12 13:47:30 +00:00
|
|
|
timing_exit fio
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -f $testdir/bdev.conf
|
|
|
|
timing_exit bdev
|
|
|
|
done
|
|
|
|
spdk_vhost_kill
|