From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Subject: [PATCH 05/13] xfstests: use preallocation for ag-wiper
Date: Fri, 15 Mar 2013 22:53:23 +1100 [thread overview]
Message-ID: <1363348411-21867-6-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1363348411-21867-1-git-send-email-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
To enable sane testing of large scale filesystems, the --large-fs
test option uses xfs_db magic to mark AGs full without doing any IO.
This leaves only a small amount of free space left in the filesystem
to stress the high AGs of the filesystem rather than the low AGs.
This method requires us to have special filesystem check options to
avoid free space checking in xfs_check, and we cannot current run
xfs_repair on such a filesystem at all. As it is, free space
checking on xfs_check does not scale, so we still need to avoid this
checking regardless of how we fill the filesystem.
We can acheive exactly the same fill behaviour by preallocating a
single large file in the filesystem immediately after creating it.
This is a filesystem independent manner of filling the filesystem,
and allows us to do large filesystem testing on more than just XFS.
Further, this preallocation method effectively adds a new "very
large file" test. It also enables us to run an unmodified xfs_repair
or filesystem specific fsck program to check the filesystem for
sanity, so we can now do full sanity checking of such large
filesystems.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
common.rc | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 53 insertions(+), 5 deletions(-)
diff --git a/common.rc b/common.rc
index 42d2ddc..d221be1 100644
--- a/common.rc
+++ b/common.rc
@@ -276,6 +276,47 @@ _scratch_mkfs_options()
echo $SCRATCH_OPTIONS $MKFS_OPTIONS $* $SCRATCH_DEV
}
+
+_setup_large_xfs_fs()
+{
+ fs_size=$1
+ local tmp_dir=/tmp/
+
+ [ "$LARGE_SCRATCH_DEV" != yes ] && return 0
+ [ -z "$SCRATCH_DEV_EMPTY_SPACE" ] && SCRATCH_DEV_EMPTY_SPACE=0
+ [ $SCRATCH_DEV_EMPTY_SPACE -ge $fs_size ] && return 0
+
+ # calculate the size of the file we need to allocate.
+ # Default free space in the FS is 50GB, but you can specify more via
+ # SCRATCH_DEV_EMPTY_SPACE
+ file_size=$(($fs_size - 50*1024*1024*1024))
+ file_size=$(($file_size - $SCRATCH_DEV_EMPTY_SPACE))
+
+ # mount the filesystem, create the file, unmount it
+ _scratch_mount 2>&1 >$tmp_dir/mnt.err
+ local status=$?
+ if [ $status -ne 0 ]; then
+ echo "mount failed"
+ cat $tmp_dir/mnt.err >&2
+ rm -f $tmp_dir/mnt.err
+ return $status
+ fi
+ rm -f $tmp_dir/mnt.err
+
+ xfs_io -F -f \
+ -c "truncate $file_size" \
+ -c "falloc -k 0 $file_size" \
+ $SCRATCH_MNT/.use_space 2>&1 > /dev/null
+ status=$?
+ umount $SCRATCH_MNT
+ if [ $status -ne 0 ]; then
+ echo "large file prealloc failed"
+ cat $tmp_dir/mnt.err >&2
+ return $status
+ fi
+ return 0
+}
+
_scratch_mkfs_xfs()
{
# extra mkfs options can be added by tests
@@ -305,16 +346,23 @@ _scratch_mkfs_xfs()
mkfs_status=$?
fi
+ if [ $mkfs_status -eq 0 -a "$LARGE_SCRATCH_DEV" = yes ]; then
+ # manually parse the mkfs output to get the fs size in bytes
+ local fs_size
+ fs_size=`cat $tmp_dir.mkfsstd | perl -ne '
+ if (/^data\s+=\s+bsize=(\d+)\s+blocks=(\d+)/) {
+ my $size = $1 * $2;
+ print STDOUT "$size\n";
+ }'`
+ _setup_large_xfs_fs $fs_size
+ mkfs_status=$?
+ fi
+
# output stored mkfs output
cat $tmp_dir.mkfserr >&2
cat $tmp_dir.mkfsstd
rm -f $tmp_dir.mkfserr $tmp_dir.mkfsstd
- if [ "$LARGE_SCRATCH_DEV" = yes ]; then
- [ -z "$SCRATCH_DEV_EMPTY_SPACE" ] && SCRATCH_DEV_EMPTY_SPACE=0
- ./tools/ag-wipe -q -r $SCRATCH_DEV_EMPTY_SPACE $SCRATCH_DEV
- fi
-
return $mkfs_status
}
--
1.7.10.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-03-15 11:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-15 11:53 [PATCH 00/13] xfstests: generic --large-fs support Dave Chinner
2013-03-15 11:53 ` [PATCH 01/13] xfstests: filter new repair/mkfs output for CRCs Dave Chinner
2013-03-19 19:44 ` Rich Johnston
2013-03-19 20:58 ` Ben Myers
2013-03-19 22:52 ` Dave Chinner
2013-03-15 11:53 ` [PATCH 02/13] xfstests: add --largefs check option Dave Chinner
2013-03-15 11:53 ` [PATCH 03/13] xfstests: rename USE_BIG_LOOPFS to be more generic Dave Chinner
2013-03-19 19:46 ` Rich Johnston
2013-03-15 11:53 ` [PATCH 04/13] xfstests: rename RETAIN_AG_BYTES Dave Chinner
2013-03-15 11:53 ` Dave Chinner [this message]
2013-03-19 19:47 ` [PATCH 05/13] xfstests: use preallocation for ag-wiper Rich Johnston
2013-03-15 11:53 ` [PATCH 06/13] xfstests: use command line option for setting extra space Dave Chinner
2013-03-15 11:53 ` [PATCH 07/13] xfstest: enable xfs_repair for large filesystem testing Dave Chinner
2013-03-15 11:53 ` [PATCH 08/13] xfstests: always use test option when checking large scratch device Dave Chinner
2013-03-15 11:53 ` [PATCH 09/13] xfstests: enable large fs testing on ext4 Dave Chinner
2013-03-15 11:53 ` [PATCH 10/13] xfstests: disable tests that typically fail on large filesystems Dave Chinner
2013-03-15 11:53 ` [PATCH 11/13] xfstests: exclude largefs fill files from dump tests Dave Chinner
2013-03-19 19:49 ` Rich Johnston
2013-03-15 11:53 ` [PATCH 12/13] xfstests: filter files in 019 for --large-fs Dave Chinner
2013-03-19 19:52 ` Rich Johnston
2013-03-15 11:53 ` [PATCH 13/13] xfstests: correct quota file count " Dave Chinner
2013-03-19 19:52 ` Rich Johnston
2013-03-19 20:20 ` [PATCH 00/13] xfstests: generic --large-fs support Rich Johnston
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=1363348411-21867-6-git-send-email-david@fromorbit.com \
--to=david@fromorbit.com \
--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