@@ -192,12 +192,14 @@ _run_fio() {
# Wrapper around _run_fio used if you need some I/O but don't really care much
# about the details
_run_fio_rand_io() {
- _run_fio --bs=4k --rw=randread --norandommap --numjobs="$(nproc)" \
+ local test_dev_bs=$(_test_dev_min_io $TEST_DEV)
+ _run_fio --bs=$test_dev_bs --rw=randread --norandommap --numjobs="$(nproc)" \
--name=reads --direct=1 "$@"
}
_run_fio_verify_io() {
- _run_fio --name=verify --rw=randwrite --direct=1 --ioengine=libaio --bs=4k \
+ local test_dev_bs=$(_test_dev_min_io $TEST_DEV)
+ _run_fio --name=verify --rw=randwrite --direct=1 --ioengine=libaio --bs=$test_dev_bs \
--iodepth=16 --verify=crc32c --verify_state_save=0 "$@"
}
@@ -387,6 +387,16 @@ _test_dev_is_partition() {
[[ -n ${TEST_DEV_PART_SYSFS} ]]
}
+_test_dev_min_io() {
+ local any_dev=$1
+ if [ -c $any_dev ]; then
+ if [[ "$any_dev" == /dev/ng* ]]; then
+ any_dev="${any_dev/ng/nvme}"
+ fi
+ fi
+ stat --printf=%o $any_dev
+}
+
# Return max open zones or max active zones of the test target device.
# If the device has both, return smaller value.
_test_dev_max_open_active_zones() {
When using fio we should not issue IOs smaller than the device supports. Today a lot of places have in place 4k, but soon we will have devices which support bs > ps. For those devices we should check the minimum supported IO. However, since we also have a min optimal IO, we might as well use that as well. By using this we can also leverage the same lookup with stat whether or not the target file is a block device or a file. Signed-off-by: Luis Chamberlain <mcgrof@kernel.org> --- common/fio | 6 ++++-- common/rc | 10 ++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-)