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

From: Daniel Wagner
Date: Fri Apr 21 2023 - 02:54:49 EST


On Fri, Apr 21, 2023 at 08:27:35AM +0200, Hannes Reinecke wrote:
> On 4/21/23 08:04, Daniel Wagner wrote:
> > Make the size argument optional by reading the filesystem info. The
> > caller doesn't have to guess (or calculate) how big the max IO size.
> > The log data structure of XFS is reducing the capacity.
> >
> > Signed-off-by: Daniel Wagner <dwagner@xxxxxxx>
> > ---
> > common/xfs | 6 ++++++
> > tests/nvme/012 | 2 +-
> > tests/nvme/013 | 2 +-
> > tests/nvme/035 | 2 +-
> > 4 files changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/common/xfs b/common/xfs
> > index 2c5d96164ac1..ec35599e017b 100644
> > --- a/common/xfs
> > +++ b/common/xfs
> > @@ -27,6 +27,12 @@ _xfs_run_fio_verify_io() {
> > _xfs_mkfs_and_mount "${bdev}" "${mount_dir}" >> "${FULL}" 2>&1
> > + if [[ -z "${sz}" ]]; then
> > + local avail
> > + avail="$(df --output=avail "${mount_dir}" | awk 'NR==2 {print $1}')"
>
> df --output=avail "${mount_dir}" | tail -1

Sure, don't think it matters.

> > + sz="$(printf "%d" $((avail / 1024 - 1 )))m"
>
> sz=$((avail / 1024 - 1))

I tried this but the devision is likely to return a floating point which fio
doesn't like. Is there a way to tell bash to do a pure integer devision?