All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: shinichiro.kawasaki@wdc.com
Cc: linux-block@vger.kernel.org, hare@suse.de,
	patches@lists.linux.dev, gost.dev@samsung.com, mcgrof@kernel.org
Subject: [PATCH blktests 1/4] common: add and use min io for fio
Date: Wed, 18 Dec 2024 03:21:50 -0800	[thread overview]
Message-ID: <20241218112153.3917518-2-mcgrof@kernel.org> (raw)
In-Reply-To: <20241218112153.3917518-1-mcgrof@kernel.org>

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(-)

diff --git a/common/fio b/common/fio
index b9ea087fc6c5..5676338d3c97 100644
--- a/common/fio
+++ b/common/fio
@@ -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 "$@"
 }
 
diff --git a/common/rc b/common/rc
index 0c8b51f64291..884677149c9e 100644
--- a/common/rc
+++ b/common/rc
@@ -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() {
-- 
2.43.0


  reply	other threads:[~2024-12-18 11:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18 11:21 [PATCH blktests 0/4] enable bs > ps device testing Luis Chamberlain
2024-12-18 11:21 ` Luis Chamberlain [this message]
2024-12-23  9:37   ` [PATCH blktests 1/4] common: add and use min io for fio Shinichiro Kawasaki
2025-01-04  4:10     ` Luis Chamberlain
2025-01-07  5:19       ` Shinichiro Kawasaki
2025-02-04 19:06         ` Luis Chamberlain
2024-12-18 11:21 ` [PATCH blktests 2/4] common/xfs: use min io for fs blocksize Luis Chamberlain
2024-12-18 11:21 ` [PATCH blktests 3/4] tests: use test device min io to support bs > ps Luis Chamberlain
2024-12-18 11:21 ` [PATCH blktests 4/4] nvme/053: provide time extension alternative Luis Chamberlain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241218112153.3917518-2-mcgrof@kernel.org \
    --to=mcgrof@kernel.org \
    --cc=gost.dev@samsung.com \
    --cc=hare@suse.de \
    --cc=linux-block@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.