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

Shinichiro Kawasaki shinichiro.kawasaki at wdc.com
Thu Apr 27 19:54:19 PDT 2023


On Apr 21, 2023 / 08:54, Daniel Wagner wrote:
> 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 at suse.de>
> > > ---
> > >   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?

Hmm, AFAIK, bash arithmetic supports integer only. I tried below, and bash did
not return floating value...

  $ avail=90000; echo $((avail/1024))
  87

Assuming bash arithmetic supports integer only, -1 will not be required in the
calculation.


More information about the Linux-nvme mailing list