public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] xfs: new EOF fragmentation tests
Date: Wed, 13 Feb 2019 08:39:50 -0500	[thread overview]
Message-ID: <20190213133950.GA42812@bfoster> (raw)
In-Reply-To: <20190212210422.GJ20493@dastard>

On Wed, Feb 13, 2019 at 08:04:22AM +1100, Dave Chinner wrote:
> On Tue, Feb 12, 2019 at 09:03:30AM -0500, Brian Foster wrote:
> > On Mon, Feb 11, 2019 at 12:36:47PM +1100, Dave Chinner wrote:
> > > From: Dave Chinner <dchinner@redhat.com>
> > > 
> > > These tests create substantial file fragmentation as a result of
> > > application actions that defeat post-EOF preallocation
> > > optimisations. They are intended to replicate known vectors for
> > > these problems, and provide a check that the fragmentation levels
> > > have been controlled. The mitigations we make may not completely
> > > remove fragmentation (e.g. they may demonstrate speculative delalloc
> > > related extent size growth) so the checks don't assume we'll end up
> > > with perfect layouts and hence check for an exceptable level of
> > > fragmentation rather than none.
> .....
> > > +workfile=$SCRATCH_MNT/file
> > > +nfiles=8
> > > +wsize=4096
> > > +wcnt=1000
> > > +
> > > +write_sync_file()
> > > +{
> > > +	idx=$1
> > > +
> > > +	for ((cnt=0; cnt<$wcnt; cnt++)); do
> > > +		$XFS_IO_PROG -f -s -c "pwrite $((cnt * wsize)) $wsize" $workfile.$idx
> > > +	done
> > > +}
> > > +
> > > +rm -f $workfile*
> > > +for ((n=0; n<$nfiles; n++)); do
> > > +	write_sync_file $n > /dev/null 2>&1 &
> > > +done
> > > +wait
> > > +sync
> > 
> > I'm not a huge fan of seeing these global syncs sprinkled around tests
> > where they might not be needed. Are these here for a reason? If so, could
> > they be replaced with an xfs_io -c syncfs or some such?
> 
> sync is there to ensure that everything is stable and I don't need
> to care about using sync flags for counting extents.
> 
> I could use syncfs (either binary or xfs_io) but that's not
> supported on all the OS's that fstests runs on. And I don't think
> using sync really matters - if "sync" causes problems for fstests
> that using syncfs fixes, then we've got bigger issues to worry
> about.
> 

It's not a matter of sync causing problems, I just think it's a kludge
to sync the entire system. syncfs by definition is localized to a target
fs.

Having taken a closer look, xfs_io unconditionally uses the fiemap sync
flag so this is an instance where we don't need either.

> > > +
> > > +for ((n=0; n<$nfiles; n++)); do
> > > +	count=$(_count_extents $workfile.$n)
> > > +	# Acceptible extent count range is 1-40
> > > +	_within_tolerance "file.$n extent count" $count 21 19 -v
> > > +done
> > > +
> > > +# success, all done
> > > +status=0
> > > +exit
> > ...
> > > diff --git a/tests/xfs/502 b/tests/xfs/502
> > > new file mode 100755
> > > index 00000000..9f314a3d
> > > --- /dev/null
> > > +++ b/tests/xfs/502
> > > @@ -0,0 +1,81 @@
> > ...
> > > +
> > > +# Write multiple files in parallel using O_DIRECT writes w/ extent size hints.
> > > +# Aim is to interleave allocations to fragment the files. O_DIRECT writes defeat
> > > +# the open/write/close heuristics in xfs_release() that prevent EOF block
> > > +# removal, so this should fragment badly. Typical problematic behaviour shows
> > > +# per-file extent counts of ~1000 (worst case) whilst fixed behaviour typically
> > > +# shows extent counts in the low single digits (almost best case)
> > > +#
> > 
> > This is essentially equivalent to the previous test, right? E.g.,
> 
> IMO, no. This is a different IO pattern that demonstrates a
> fragmentation problem, regardless of the underlying cause. We may
> fix the buffered write problem (e.g. via enabling delalloc on extent
> size hints) but that leaves the direct IO variant unchanged. Hence,
> if we drop this test, we'll never realise we still have a direct IO
> variant we have to ensure we don't break.
> 
> IOWs, I'm attempting to characterise and exercise the userspace IO
> patterns that cause fragmentation problems rather than exercise a
> specific bug in the filesystem implementation.
> 
> > path as direct I/O with an extent size hint in current XFS. Of course
> > that may not always be so, but I wonder if these two could be combined.
> 
> That's kinda my point - these IO patterns haven't always (and won't
> always) exercised the same code paths and allocation behaviours.
> Hence we nee dto exercise them both, even if they currently both
> expose the same underlying problem.
> 

Ok, but I wasn't suggesting to not test any of these codepaths. I wanted
to make sure the duplication of (current) behavior across the separate
tests was intentional, for one. I'm also noting that the difference
between this test and the previous is the xfs_io '-d' flag, and thus
wondering why we wouldn't combine that into a single test (that tests
extsz hint fragmentation on buffered and direct I/O).

Brian

> Cheers,
> 
> Dave.
> 
> -- 
> Dave Chinner
> david@fromorbit.com

  reply	other threads:[~2019-02-13 13:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11  1:36 [PATCH] xfs: new EOF fragmentation tests Dave Chinner
2019-02-11  1:55 ` Dave Chinner
2019-02-12 14:03 ` Brian Foster
2019-02-12 21:04   ` Dave Chinner
2019-02-13 13:39     ` Brian Foster [this message]
2019-02-16 10:04 ` Eryu Guan
2019-02-17 21:56   ` Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2024-06-23  5:38 xfs post-EOF block freeing fixes Christoph Hellwig
2024-06-23  5:38 ` [PATCH] xfs: new EOF fragmentation tests Christoph Hellwig
2024-06-23 13:03   ` Zorro Lang
2024-06-24  8:49     ` Christoph Hellwig
2024-09-24  8:45 xfs post-EOF block freeing fixes v2 Christoph Hellwig
2024-09-24  8:45 ` [PATCH] xfs: new EOF fragmentation tests Christoph Hellwig
2024-09-24 15:03   ` Darrick J. Wong
2024-09-25 11:15   ` Zorro Lang
2024-09-26 12:31     ` Zorro Lang
2024-10-01 14:59   ` Darrick J. Wong
2024-10-02 13:38     ` Zorro Lang
2024-10-02 14:35       ` Brian Foster
2024-10-02 14:57         ` Darrick J. Wong
2024-10-02 15:56           ` Brian Foster
2024-10-02 20:04             ` Darrick J. Wong
2024-10-13 17:49     ` Zorro Lang
2024-10-14  6:07       ` Christoph Hellwig
2024-10-14 14:14         ` Zorro Lang
2024-10-14 15:24         ` Darrick J. Wong
2024-10-14 17:46           ` Zorro Lang
2024-10-15  3:39             ` Christoph Hellwig

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=20190213133950.GA42812@bfoster \
    --to=bfoster@redhat.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    /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