From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH 13/23] xfs: test fragmentation characteristics of copy-on-write
Date: Tue, 9 Feb 2016 17:02:13 -0800 [thread overview]
Message-ID: <20160210010213.GE6350@birch.djwong.org> (raw)
In-Reply-To: <20160209080144.GL19486@dastard>
On Tue, Feb 09, 2016 at 07:01:44PM +1100, Dave Chinner wrote:
> On Mon, Feb 08, 2016 at 05:13:09PM -0800, Darrick J. Wong wrote:
> > Perform copy-on-writes at random offsets to stress the CoW allocation
> > system. Assess the effectiveness of the extent size hint at
> > combatting fragmentation via unshare, a rewrite, and no-op after the
> > random writes.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ....
> > +seq=`basename "$0"`
> > +seqres="$RESULT_DIR/$seq"
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1 # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > + cd /
> > + #rm -rf "$tmp".* "$testdir"
>
> Now that I've noticed it, a few tests have this line commented out.
> Probably should remove the tmp files, at least.
Done.
> > +rm -f "$seqres.full"
> > +
> > +echo "Format and mount"
> > +_scratch_mkfs > "$seqres.full" 2>&1
> > +_scratch_mount >> "$seqres.full" 2>&1
> > +
> > +testdir="$SCRATCH_MNT/test-$seq"
> > +rm -rf $testdir
> > +mkdir $testdir
>
> Again, somthing that is repeated - we just mkfs'd the scratch
> device, so the $testdir is guaranteed not to exist...
I've done that to the new tests, will do to the existing ones.
> > +echo "Check for damage"
> > +umount "$SCRATCH_MNT"
>
> I've also noticed this in a lot of tests - the scratch device will
> be unmounted by the harness, so I don't think this is necessary....
Done.
> > +free_blocks=$(stat -f -c '%a' "$testdir")
> > +real_blksz=$(stat -f -c '%S' "$testdir")
> > +space_needed=$(((blksz * nr * 3) * 5 / 4))
> > +space_avail=$((free_blocks * real_blksz))
> > +internal_blks=$((blksz * nr / real_blksz))
> > +test $space_needed -gt $space_avail && _notrun "Not enough space. $space_avail < $space_needed"
>
> Why not:
>
> _require_fs_space $space_needed
>
> At minimum, it seems to be a repeated hunk of code, so it shoul dbe
> factored.
Ok, done.
> > +testdir="$SCRATCH_MNT/test-$seq"
> > +rm -rf $testdir
> > +mkdir $testdir
> > +
> > +echo "Create the original files"
> > +"$XFS_IO_PROG" -f -c "pwrite -S 0x61 0 0" "$testdir/file1" >> "$seqres.full"
> > +"$XFS_IO_PROG" -f -c "pwrite -S 0x61 0 1048576" "$testdir/file2" >> "$seqres.full"
> > +_scratch_remount
> > +
> > +echo "Set extsz and cowextsz on zero byte file"
> > +"$XFS_IO_PROG" -f -c "extsize 1048576" "$testdir/file1" | _filter_scratch
> > +"$XFS_IO_PROG" -f -c "cowextsize 1048576" "$testdir/file1" | _filter_scratch
> > +
> > +echo "Set extsz and cowextsz on 1Mbyte file"
> > +"$XFS_IO_PROG" -f -c "extsize 1048576" "$testdir/file2" | _filter_scratch
> > +"$XFS_IO_PROG" -f -c "cowextsize 1048576" "$testdir/file2" | _filter_scratch
> > +_scratch_remount
> > +
> > +fn() {
> > + "$XFS_IO_PROG" -c "$1" "$2" | sed -e 's/.\([0-9]*\).*$/\1/g'
> > +}
> > +echo "Check extsz and cowextsz settings on zero byte file"
> > +test $(fn extsize "$testdir/file1") -eq 1048576 || echo "file1 extsize not set"
> > +test $(fn cowextsize "$testdir/file1") -eq 1048576 || echo "file1 cowextsize not set"
>
> For this sort of thing, just dump the extent size value to the
> golden output. i.e.
>
> echo "Check extsz and cowextsz settings on zero byte file"
> $XFS_IO_PROG -c extsize $testdir/file1
> $XFS_IO_PROG -c cowextsize $testdir/file1
>
> is all that is needed. that way if it fails, we see what value it
> had instead of the expected 1MB. This also makes the test much less
> verbose and easier to read
Done.
> > +
> > +echo "Check extsz and cowextsz settings on 1Mbyte file"
> > +test $(fn extsize "$testdir/file2") -eq 0 || echo "file2 extsize not set"
> > +test $(fn cowextsize "$testdir/file2") -eq 1048576 || echo "file2 cowextsize not set"
> > +
> > +echo "Set cowextsize and check flag"
> > +"$XFS_IO_PROG" -f -c "cowextsize 1048576" "$testdir/file3" | _filter_scratch
> > +_scratch_remount
> > +test $("$XFS_IO_PROG" -c "stat" "$testdir/file3" | grep 'fsxattr.xflags' | awk '{print $4}' | grep -c 'C') -eq 1 || echo "file3 cowextsz flag not set"
> > +test $(fn cowextsize "$testdir/file3") -eq 1048576 || echo "file3 cowextsize not set"
> > +"$XFS_IO_PROG" -f -c "cowextsize 0" "$testdir/file3" | _filter_scratch
> > +_scratch_remount
> > +test $(fn cowextsize "$testdir/file3") -eq 0 || echo "file3 cowextsize not set"
> > +test $("$XFS_IO_PROG" -c "stat" "$testdir/file3" | grep 'fsxattr.xflags' | awk '{print $4}' | grep -c 'C') -eq 0 || echo "file3 cowextsz flag not set"
>
> Same with all these - just grep the output for the line you want,
> and the golden output matching does everything else. e.g. the flag
> check simply becomes:
>
> $XFS_IO_PROG -c "stat" $testdir/file3 | grep 'fsxattr.xflags'
>
> Again, this tells us what the wrong flags are if it fails...
Done. It'll probably break whenever we add new flags, but that can be fixed.
--D
>
> There are quite a few bits of these tests where the same thing
> applies....
>
> -Dave.
> --
> Dave Chinner
> david@fromorbit.com
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2016-02-10 1:02 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-09 1:11 [PATCH v4.1 00/23] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Darrick J. Wong
2016-02-09 1:11 ` [PATCH 01/23] generic/182: this is a dedupe test, check for dedupe Darrick J. Wong
2016-02-09 1:11 ` [PATCH 02/23] xfstests: filter whitespace in 128 and 132 Darrick J. Wong
2016-02-09 1:12 ` [PATCH 03/23] xfstests: make _scratch_mkfs_blocksized usable Darrick J. Wong
2016-02-09 1:12 ` [PATCH 04/23] reflink: remove redundant filesystem checks from the end of the tests Darrick J. Wong
2016-02-09 1:12 ` [PATCH 05/23] common/dmerror: add some more dmerror routines Darrick J. Wong
2016-02-09 1:12 ` [PATCH 06/23] dio unwritten conversion bug tests Darrick J. Wong
2016-02-09 7:37 ` Dave Chinner
2016-02-09 8:08 ` Darrick J. Wong
2016-02-09 1:12 ` [PATCH 07/23] reflink: test intersecting CoW and falloc/fpunch/fzero/fcollapse/finsert/ftrunc Darrick J. Wong
2016-02-09 1:12 ` [PATCH 08/23] reflink: test CoW behavior with IO errors Darrick J. Wong
2016-02-09 1:12 ` [PATCH 09/23] reflink: test CoW operations against the source file Darrick J. Wong
2016-02-09 1:12 ` [PATCH 10/23] xfs: more reflink tests Darrick J. Wong
2016-02-09 7:36 ` Dave Chinner
2016-02-09 8:16 ` Darrick J. Wong
2016-02-09 1:12 ` [PATCH 11/23] reflink: ensure that we can handle reflinking a lot of extents Darrick J. Wong
2016-02-09 1:13 ` [PATCH 12/23] xfs/122: support refcount/rmap data structures Darrick J. Wong
2016-02-09 7:43 ` Dave Chinner
2016-02-09 7:55 ` Darrick J. Wong
2016-02-09 8:53 ` Dave Chinner
2016-02-09 1:13 ` [PATCH 13/23] xfs: test fragmentation characteristics of copy-on-write Darrick J. Wong
2016-02-09 8:01 ` Dave Chinner
2016-02-10 1:02 ` Darrick J. Wong [this message]
2016-02-09 1:13 ` [PATCH 14/23] reflink: high offset reflink and dedupe tests Darrick J. Wong
2016-02-09 1:13 ` [PATCH 15/23] reflink: test xfs cow behavior when the filesystem crashes Darrick J. Wong
2016-02-09 1:13 ` [PATCH 16/23] reflink: test quota accounting Darrick J. Wong
2016-02-09 1:13 ` [PATCH 17/23] reflink: test CoW across a mixed range of block types with cowextsize set Darrick J. Wong
2016-02-09 8:09 ` Dave Chinner
2016-02-10 1:03 ` Darrick J. Wong
2016-02-09 1:13 ` [PATCH 18/23] xfs: test the automatic cowextsize extent garbage collector Darrick J. Wong
2016-02-09 8:15 ` Dave Chinner
2016-02-10 1:06 ` Darrick J. Wong
2016-02-09 1:13 ` [PATCH 19/23] xfs: test rmapbt functionality Darrick J. Wong
2016-02-09 8:26 ` Dave Chinner
2016-02-10 1:07 ` Darrick J. Wong
2016-02-09 1:13 ` [PATCH 20/23] reflink: test aio copy on write Darrick J. Wong
2016-02-09 1:14 ` [PATCH 21/23] xfs: aio cow tests Darrick J. Wong
2016-02-09 8:32 ` Dave Chinner
2016-02-09 21:51 ` Darrick J. Wong
2016-02-09 1:14 ` [PATCH 22/23] xfs: test xfs_getbmapx behavior with shared extents Darrick J. Wong
2016-02-09 1:14 ` [PATCH 23/23] reflink: test reflink+cow+enospc all at the same time Darrick J. Wong
2016-02-09 7:21 ` [PATCH v4.1 00/23] xfstests: test the nfs/cifs/btrfs/xfs reflink/dedupe ioctls Dave Chinner
2016-02-09 7:25 ` Darrick J. Wong
2016-02-09 7:50 ` Darrick J. Wong
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=20160210010213.GE6350@birch.djwong.org \
--to=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=xfs@oss.sgi.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