From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH 5/5] xfs/013: stress the free inode btree
Date: Fri, 2 May 2014 13:14:02 -0400 [thread overview]
Message-ID: <1399050842-19633-6-git-send-email-bfoster@redhat.com> (raw)
In-Reply-To: <1399050842-19633-1-git-send-email-bfoster@redhat.com>
Create a stress test for the free inode btree. Allocate a set of inodes
sequentually and run a hard link clone and random replacement algorithm
across the set. Background removal of the oldest directories creates a
sparse set of free inodes over time. Run an fsstress workload
concurrently to exercise the fs.
Signed-off-by: Brian Foster <bfoster@redhat.com>
---
tests/xfs/013 | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/013.out | 7 +++
tests/xfs/group | 1 +
3 files changed, 163 insertions(+)
create mode 100755 tests/xfs/013
create mode 100644 tests/xfs/013.out
diff --git a/tests/xfs/013 b/tests/xfs/013
new file mode 100755
index 0000000..049f0dc
--- /dev/null
+++ b/tests/xfs/013
@@ -0,0 +1,155 @@
+#!/bin/bash
+# FS QA Test No. xfs/013
+#
+# Exercise the free inode btree (finobt). XFS allocates physical inodes in
+# chunks of 64. Inode records with at least one free inode are stored in the
+# finobt to optimize free inode lookup. This test runs a workload that creates
+# and modifies a sparsely allocated set of inodes in combination with an
+# fsstress workload.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Red Hat, Inc. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+_cleanup()
+{
+ killall fsstress 2>/dev/null
+ cd /
+ umount $SCRATCH_MNT 2>/dev/null
+ rm -f $tmp.*
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_create()
+{
+ dir=$1
+ count=$2
+
+ mkdir -p $dir
+ for i in $(seq 0 $count)
+ do
+ touch $dir/$i
+ done
+}
+
+_rand_replace()
+{
+ dir=$1
+ count=$2
+
+ # replace 5% of the dataset
+ for i in $(seq 0 $((count / 20)))
+ do
+ file=$((RANDOM % count))
+ rm -f $dir/$file
+ touch $dir/$file
+ done
+}
+
+_cleaner()
+{
+ dir=$1
+ iters=$2
+ mindirs=$3
+
+ iters=$((iters - mindirs))
+
+ for i in $(seq 1 $iters)
+ do
+ need=$dir/dir$((i + mindirs))
+ while [ ! -e $need ]
+ do
+ sleep 3
+ done
+
+ rm -rf $dir/dir$i
+ done
+}
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+_require_scratch
+_require_xfs_mkfs_finobt
+_require_xfs_finobt
+
+rm -f $seqres.full
+
+_scratch_mkfs_xfs "-m crc=1,finobt=1 -d agcount=2" | \
+ _filter_mkfs 2>> $seqres.full
+_scratch_mount
+
+COUNT=20000 # number of files per directory
+LOOPS=15 # last loop iteration
+MINDIRS=2 # number of dirs for the cleaner to leave trailing behind the
+ # most recent (no less than 2 to prevent an rm from trampling a
+ # clone)
+
+# create initial directory
+_create $SCRATCH_MNT/dir1 $COUNT
+
+# start background cleaner to remove old directories as new ones are created
+_cleaner $SCRATCH_MNT $LOOPS $MINDIRS &
+
+# start a background stress workload on the fs
+$FSSTRESS_PROG -d $SCRATCH_MNT/fsstress -w -n 9999999 -p 2 -S t \
+ >> $seqres.full 2>&1 &
+
+# Each cycle clones the current directory and makes a random file replacement
+# pass on the new directory. The directory is copied to the next using hard
+# links. The replacement pass then randomly removes and replaces ~5% of the
+# content in the directory. Files replaced as such are effectively marked to be
+# freed by the background cleaner as it moves forward and removes all of the
+# previous hard links to the inode. Over several iterations, this workload
+# creates a sparsely located set of a free inodes across the set and uses the
+# finobt to allocate new inodes for replacement.
+
+for i in $(seq 1 $LOOPS)
+do
+ # hard link the content of the current directory to the next
+ cp -Rl $SCRATCH_MNT/dir$i $SCRATCH_MNT/dir$((i+1))
+
+ # do a random replacement of files in the new directory
+ _rand_replace $SCRATCH_MNT/dir$((i+1)) $COUNT
+done
+
+killall fsstress
+wait
+
+# clean out the competing fsstress allocations, then everything else
+rm -rf $SCRATCH_MNT/fsstress
+rm -rf $SCRATCH_MNT/dir*
+
+umount $SCRATCH_MNT
+_check_scratch_fs
+
+status=0
+exit
diff --git a/tests/xfs/013.out b/tests/xfs/013.out
new file mode 100644
index 0000000..ae653ff
--- /dev/null
+++ b/tests/xfs/013.out
@@ -0,0 +1,7 @@
+QA output created by 013
+meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
+data = bsize=XXX blocks=XXX, imaxpct=PCT
+ = sunit=XXX swidth=XXX, unwritten=X
+naming =VERN bsize=XXX
+log =LDEV bsize=XXX blocks=XXX
+realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
diff --git a/tests/xfs/group b/tests/xfs/group
index c228a63..0fa6674 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -9,6 +9,7 @@
009 rw ioctl auto prealloc quick
010 auto quick repair
012 rw auto quick
+013 stress
016 rw auto quick
017 mount auto quick stress
018 deprecated # log logprint v2log
--
1.8.3.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-05-02 17:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-02 17:13 [PATCH 0/5] xfstests: fixes for the free inode btree Brian Foster
2014-05-02 17:13 ` [PATCH 1/5] xfs/030: filter out extra repair noise for finobt enabled fs' Brian Foster
2014-05-02 17:13 ` [PATCH 2/5] xfstests: add _require_xfs_[mkfs_]finobt() checks for finobt tests Brian Foster
2014-05-02 17:14 ` [PATCH 3/5] xfstests: filter agno/ino repair output for finobt Brian Foster
2014-05-02 17:14 ` [PATCH 4/5] xfs/010: test repair for finobt corruption Brian Foster
2014-05-02 17:14 ` Brian Foster [this message]
2014-05-02 23:48 ` [PATCH 0/5] xfstests: fixes for the free inode btree Dave Chinner
2014-05-05 11:34 ` Brian Foster
2014-05-21 0:20 ` Dave Chinner
2014-05-21 11:31 ` Brian Foster
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=1399050842-19633-6-git-send-email-bfoster@redhat.com \
--to=bfoster@redhat.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;
as well as URLs for NNTP newsgroup(s).