Skip to content

Commit

Permalink
add a first fio test "sequental_read"
Browse files Browse the repository at this point in the history
The snapshot image is a virtual block device. I/O units to the image are
redirected to the original device. Therefore, the reading performance
from the snapshot image should be slightly lower than from the original
block device. It is important to know what the difference is. The test
allows to measure this difference.
  • Loading branch information
SergeiShtepa committed Feb 20, 2024
1 parent 3bd8de9 commit eefb2a8
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/blksnap.fio
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[global]
kb_base=1024
directory=${DIR}
; filename_format=jobname.jobnumber.filenumber
direct=1
iodepth=8

[sequental_read]
ioengine=libaio
rw=read
bs=1m
size=512m

[sequental_read_4k]
ioengine=libaio
rw=read
bs=4k
size=32m
59 changes: 59 additions & 0 deletions tests/fio-1000-sequental_read.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash -e
#
# SPDX-License-Identifier: GPL-2.0+

. ./functions.sh
. ./blksnap.sh

echo "---"
echo "FIO sequental read test"

fio --version
blksnap_load
blksnap_version

if [ -z $1 ]
then
TEST_DIR=${HOME}/blksnap-test
else
TEST_DIR=$(realpath $1"/blksnap-test")
fi
mkdir -p ${TEST_DIR}
rm -rf ${TEST_DIR}/*

MP_TEST_DIR=$(stat -c %m ${TEST_DIR})
DEVICE="/dev/block/"$(mountpoint -d ${MP_TEST_DIR})
echo "Test directory [${TEST_DIR}] on device [${DEVICE}] selected"

MP_DIR=/mnt/blksnap-test
rm -rf ${MP_DIR}
mkdir -p ${MP_DIR}

DIR=${MP_TEST_DIR} fio --section sequental_read ./blksnap.fio

blksnap_snapshot_create "${DEVICE}" "/dev/shm" "1G"
blksnap_snapshot_watcher
blksnap_snapshot_take


IMAGE=${MP_DIR}/image0
mkdir -p ${IMAGE}

echo "Mount image"
DEVICE_IMAGE=$(blksnap_get_image ${DEVICE})
mount ${DEVICE_IMAGE} ${IMAGE}

DIR="${IMAGE}/${MP_TEST_DIR}" fio --section sequental_read ./blksnap.fio

echo "Umount image"
umount ${IMAGE}

echo "Destroy snapshot"
blksnap_snapshot_destroy
blksnap_detach ${DEVICE}
blksnap_watcher_wait

blksnap_unload

echo "FIO sequental read test finish"
echo "---"

2 comments on commit eefb2a8

@Fantu
Copy link
Contributor

@Fantu Fantu commented on eefb2a8 Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SergeiShtepa as reported by codacy ( https://app.codacy.com/gh/Fantu/blksnap/issues/current?levels=Warning&categories=CodeStyle ) there are many variables used without double quote to prevent globbing and word splitting
without fixing them all right, which could take a long time, but could you quote them correctly in new scripts or ones you will modify please?

@SergeiShtepa
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this can be a problem if there are spaces in the names of directories and files.
I won't think about it yet.

Please sign in to comment.