public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Zorro Lang <zlang@redhat.com>
Cc: linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs/547: fix problems with realtime
Date: Thu, 7 Jul 2022 11:05:25 -0700	[thread overview]
Message-ID: <YscgZQsgDjkgEkQM@magnolia> (raw)
In-Reply-To: <20220707131527.g73ablzdf7p7pmsu@zlang-mailbox>

On Thu, Jul 07, 2022 at 09:15:27PM +0800, Zorro Lang wrote:
> On Tue, Jul 05, 2022 at 03:02:19PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > This test needs to fragment the free space on the data device so that
> > each block added to the attr fork gets its own mapping.  If the test
> > configuration sets up a rt device and rtinherit=1 on the root dir, the
> > test will erroneously fragment space on the *realtime* volume.  When
> > this happens, attr fork allocations are contiguous and get merged into
> > fewer than 10 extents and the test fails.
> > 
> > Fix this test to force all allocations to be on the data device, and fix
> > incorrect variable usage in the error messages.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/xfs/547 |   14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> > 
> > 
> > diff --git a/tests/xfs/547 b/tests/xfs/547
> > index 9d4216ca..60121eb9 100755
> > --- a/tests/xfs/547
> > +++ b/tests/xfs/547
> > @@ -33,6 +33,10 @@ for nrext64 in 0 1; do
> >  		      >> $seqres.full
> >  	_scratch_mount >> $seqres.full
> >  
> > +	# Force data device extents so that we can fragment the free space
> > +	# and force attr fork allocations to be non-contiguous
> > +	_xfs_force_bdev data $SCRATCH_MNT
> > +
> >  	bsize=$(_get_file_block_size $SCRATCH_MNT)
> >  
> >  	testfile=$SCRATCH_MNT/testfile
> > @@ -76,13 +80,15 @@ for nrext64 in 0 1; do
> >  	acnt=$(_scratch_xfs_get_metadata_field core.naextents \
> >  					       "path /$(basename $testfile)")
> >  
> > -	if (( $dcnt != 10 )); then
> > -		echo "Invalid data fork extent count: $dextcnt"
> > +	echo "nrext64: $nrext64 dcnt: $dcnt acnt: $acnt" >> $seqres.full
> > +
> > +	if [ -z "$dcnt" ] || (( $dcnt != 10 )); then
> 
> I'm wondering why we need to use bash ((...)) operator at here, is $dcnt
> an expression? Can [ "$dcnt" != "10" ] help that?

dcnt should be a decimal number, or the empty string if the xfs_db
totally failed.  The fancy comparison protects against xfs_db someday
returning results in hexadecimal or a non-number string, but I don't
think it'll ever do that.  I think your suggestion would work for this
case.

I don't think it works so well for the second case, since the fancy
comparison "(( $acnt < 10 ))" apparently returns false even if acnt is
non-numeric, whereas "[ $acnt -lt 10 ]" would error out.

--D

> Thanks,
> Zorro
> 
> > +		echo "Invalid data fork extent count: $dcnt"
> >  		exit 1
> >  	fi
> >  
> > -	if (( $acnt < 10 )); then
> > -		echo "Invalid attr fork extent count: $aextcnt"
> > +	if [ -z "$acnt" ] || (( $acnt < 10 )); then
> > +		echo "Invalid attr fork extent count: $acnt"
> >  		exit 1
> >  	fi
> >  done
> > 
> 

  reply	other threads:[~2022-07-07 18:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05 22:02 [PATCHSET v2 0/3] fstests: random fixes Darrick J. Wong
2022-07-05 22:02 ` [PATCH 1/3] xfs: fix test mkfs.xfs sizing of internal logs that overflow the AG Darrick J. Wong
2022-07-07 13:29   ` Zorro Lang
2022-07-05 22:02 ` [PATCH 2/3] xfs/018: fix LARP testing for small block sizes Darrick J. Wong
2022-07-07 18:06   ` Darrick J. Wong
2022-07-07 21:55     ` Alli
2022-07-07 22:10       ` Darrick J. Wong
2022-07-07 22:57         ` Alli
2022-07-05 22:02 ` [PATCH 3/3] xfs/547: fix problems with realtime Darrick J. Wong
2022-07-07 13:15   ` Zorro Lang
2022-07-07 18:05     ` Darrick J. Wong [this message]
2022-07-08 14:56       ` Zorro Lang
2022-07-11  7:10 ` [PATCHSET v2 0/3] fstests: random fixes Zorro Lang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YscgZQsgDjkgEkQM@magnolia \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zlang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox