On Feb 04, 2025 / 14:57, Luis Chamberlain wrote: > 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@xxxxxxxxxx> > --- > common/fio | 23 +++++++++++++++++++++-- > common/rc | 21 +++++++++++++++++++++ > 2 files changed, 42 insertions(+), 2 deletions(-) > > diff --git a/common/fio b/common/fio > index b9ea087fc6c5..557150656b29 100644 > --- a/common/fio > +++ b/common/fio > @@ -189,15 +189,34 @@ _run_fio() { > return $rc > } > > +_fio_opts_to_min_io() { > + local arg path > + local -i min_io=4096 > + > + for arg in "$@"; do > + [[ "$arg" =~ ^--filename= || "$arg" =~ --directory= ]] || continue > + path="${arg##*=}" > + min_io=$(_min_io "$path") > + # Keep 4K minimum IO size for historical consistency > + ((min_io < 4096)) && min_io=4096 > + break > + done > + > + echo "$min_io" > +} Spaces are used for indent in the hunk above. Let's use tabs instead. [...] > diff --git a/common/rc b/common/rc > index bcb215d35114..e12ecd025868 100644 > --- a/common/rc > +++ b/common/rc > @@ -387,6 +387,27 @@ _test_dev_is_partition() { > [[ -n ${TEST_DEV_PART_SYSFS} ]] > } > > +_min_io() { > + local path_or_dev=$1 > + if [ -z "$path_or_dev" ]; then > + echo "path for min_io does not exist" > + return 1 > + fi > + > + if [ -c "$path_or_dev" ]; then > + if [[ "$path_or_dev" == /dev/ng* ]]; then > + path_or_dev="${path_or_dev/ng/nvme}" > + fi > + fi > + > + if [ -e "$path_or_dev" ]; then > + stat --printf=%o "$path_or_dev" > + else > + echo "Error: '$path_or_dev' does not exist or is not accessible" > + return 1 > + fi > +} Same here, let's use tabs.