Re: [PATCH REPOST blktests v2 3/9] common-xfs: Make size argument optional for _xfs_run_fio_verify_io

From: Daniel Wagner
Date: Wed May 03 2023 - 03:31:40 EST


On Wed, May 03, 2023 at 04:04:50AM +0000, Shinichiro Kawasaki wrote:
> On May 02, 2023 / 15:23, Daniel Wagner wrote:
> > > --- a/tests/nvme/035
> > > > +++ b/tests/nvme/035
> > > > @@ -32,7 +32,7 @@ test_device() {
> > > > port=$(_nvmet_passthru_target_setup "${subsys}")
> > > > nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
> > > >
> > > > - _xfs_run_fio_verify_io "${nsdev}" "900m"
> > > > + _xfs_run_fio_verify_io "${nsdev}"
> > >
> > > On the other hand, this change for nvme/035 does not look good. It runs the
> > > test on TEST_DEV, which may take very long time without TIMEOUT config.
> >
> > I'll add the nvme_img_size argument here instead (nvme: Make test image size
> > configurable)
>
> If TEST_DEV has the size same as nvme_img_size, xfs log data will consume some
> part of the TEST_DEV, then _xfs_run_fio_verify_io with nvme_img_size will fail.
>
> I think the size argument of _xfs_run_fio_verify_io should be,
>
> min(size of TEST_DEV, nvm_img_size) - log data size of xfs
>
> But I'm not sure if we can do this calculation correctly.
>
> If the calculation is not possible, it would be the better to leave the hard
> coded constants (1GB for TEST_DEV size and 900mb as fio I/O size) in this test
> case, because nvme/035 is rather unique in the nvme group, which uses TEST_DEV.

I've solved this by extending _xfs_run_fio_verify_io() to limit the max size of
the io job:

_xfs_run_fio_verify_io() {
local mount_dir="/mnt/blktests"
local bdev=$1
local sz=$2
local sz_mb
local avail
local avail_mb

_xfs_mkfs_and_mount "${bdev}" "${mount_dir}" >> "${FULL}" 2>&1

avail="$(df --output=avail "${mount_dir}" | tail -1)"
avail_mb="$((avail / 1024))"

if [[ -z "${sz}" ]]; then
sz_mb="${avail_mb}"
else
sz_mb="$(convert_to_mb "${sz}")"
if [[ "${sz_mb}" -gt "${avail_mb}" ]]; then
sz_mb="${avail_mb}"
fi
fi

_run_fio_verify_io --size="${sz_mb}m" --directory="${mount_dir}/"

umount "${mount_dir}" >> "${FULL}" 2>&1
rm -fr "${mount_dir}"
}

Anyway, I'll send out the updated series shortly