diff mbox series

[21/24] common/rc: teach _scratch_mkfs_sized to set a size on an xfs realtime volume

Message ID 160013430895.2923511.7033338053997588353.stgit@magnolia
State Superseded
Headers show
Series fstests: tons of random fixes | expand

Commit Message

Darrick J. Wong Sept. 15, 2020, 1:45 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Generally speaking, tests that call _scratch_mkfs_sized are trying to
constrain a test's run time by formatting a filesystem that's smaller
than the device.  The current helper does this for the scratch device,
but it doesn't do this for the xfs realtime volume.

If fstests has been configured to create files on the realtime device by
default ("-d rtinherit=1) then those tests that want to run with a small
volume size will instead be running with a huge realtime device.  This
makes certain tests take forever to run, so apply the same sizing to the
rt volume if one exists.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/rc |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Christoph Hellwig Sept. 17, 2020, 8 a.m. UTC | #1
On Mon, Sep 14, 2020 at 06:45:08PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Generally speaking, tests that call _scratch_mkfs_sized are trying to
> constrain a test's run time by formatting a filesystem that's smaller
> than the device.  The current helper does this for the scratch device,
> but it doesn't do this for the xfs realtime volume.
> 
> If fstests has been configured to create files on the realtime device by
> default ("-d rtinherit=1) then those tests that want to run with a small
> volume size will instead be running with a huge realtime device.  This
> makes certain tests take forever to run, so apply the same sizing to the
> rt volume if one exists.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/rc |   10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/common/rc b/common/rc
> index f78b1cfc..b2d45fa2 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -976,14 +976,20 @@ _scratch_mkfs_sized()
>  	[ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"
>      fi
>  
> +    if [ "$HOSTOS" == "Linux" ] && [ "$FSTYP" = "xfs" ] && [ -b "$SCRATCH_RTDEV" ]; then
> +	local rtdevsize=`blockdev --getsize64 $SCRATCH_RTDEV`
> +	[ "$fssize" -gt "$rtdevsize" ] && _notrun "Scratch rt device too small"
> +	rt_ops="-r size=$fssize"
> +    fi

The indentation here looks rather weird.  I also don't think we need
the HOSTOS check.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Darrick J. Wong Sept. 17, 2020, 4:04 p.m. UTC | #2
On Thu, Sep 17, 2020 at 09:00:54AM +0100, Christoph Hellwig wrote:
> On Mon, Sep 14, 2020 at 06:45:08PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Generally speaking, tests that call _scratch_mkfs_sized are trying to
> > constrain a test's run time by formatting a filesystem that's smaller
> > than the device.  The current helper does this for the scratch device,
> > but it doesn't do this for the xfs realtime volume.
> > 
> > If fstests has been configured to create files on the realtime device by
> > default ("-d rtinherit=1) then those tests that want to run with a small
> > volume size will instead be running with a huge realtime device.  This
> > makes certain tests take forever to run, so apply the same sizing to the
> > rt volume if one exists.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/rc |   10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > 
> > diff --git a/common/rc b/common/rc
> > index f78b1cfc..b2d45fa2 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -976,14 +976,20 @@ _scratch_mkfs_sized()
> >  	[ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"
> >      fi
> >  
> > +    if [ "$HOSTOS" == "Linux" ] && [ "$FSTYP" = "xfs" ] && [ -b "$SCRATCH_RTDEV" ]; then
> > +	local rtdevsize=`blockdev --getsize64 $SCRATCH_RTDEV`
> > +	[ "$fssize" -gt "$rtdevsize" ] && _notrun "Scratch rt device too small"
> > +	rt_ops="-r size=$fssize"
> > +    fi
> 
> The indentation here looks rather weird.  I also don't think we need
> the HOSTOS check.

<nod> it's copy-pastaing the clause above it.  I guess I could just send
an indentation cleanup for that, since it's a bit fugly.

--D

> 
> Otherwise looks good:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index f78b1cfc..b2d45fa2 100644
--- a/common/rc
+++ b/common/rc
@@ -976,14 +976,20 @@  _scratch_mkfs_sized()
 	[ "$fssize" -gt "$devsize" ] && _notrun "Scratch device too small"
     fi
 
+    if [ "$HOSTOS" == "Linux" ] && [ "$FSTYP" = "xfs" ] && [ -b "$SCRATCH_RTDEV" ]; then
+	local rtdevsize=`blockdev --getsize64 $SCRATCH_RTDEV`
+	[ "$fssize" -gt "$rtdevsize" ] && _notrun "Scratch rt device too small"
+	rt_ops="-r size=$fssize"
+    fi
+
     case $FSTYP in
     xfs)
 	# don't override MKFS_OPTIONS that set a block size.
 	echo $MKFS_OPTIONS |egrep -q "b?size="
 	if [ $? -eq 0 ]; then
-		_scratch_mkfs_xfs -d size=$fssize
+		_scratch_mkfs_xfs -d size=$fssize $rt_ops
 	else
-		_scratch_mkfs_xfs -d size=$fssize -b size=$blocksize
+		_scratch_mkfs_xfs -d size=$fssize $rt_ops -b size=$blocksize
 	fi
 	;;
     ext2|ext3|ext4|ext4dev)