From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Subject: [PATCH 3/3] xfs/294: performance is unreasonably slow
Date: Wed, 11 Jan 2023 09:49:06 +1100 [thread overview]
Message-ID: <20230110224906.1171483-4-david@fromorbit.com> (raw)
In-Reply-To: <20230110224906.1171483-1-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
This creates a bunch of files in a dir, then deletes 97% of them
attempting to leave 1 allocated inode per inode chunk so that they
aren't freed. Performance is badly limited by task creation and
destruction for each inode created. Fix this by using "echo -n >
file" rather than touch so that the shell creates the empty files
without needing to fork/exec a separate task for each creation.
This reduces runtime from 45s down to 15s.
Also add more debug with inode counts and internal superblock
counter information for determining why this test may ENOSPC on the
final creation loop.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
tests/xfs/294 | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/tests/xfs/294 b/tests/xfs/294
index d381e2c85..1ce0d1cc5 100755
--- a/tests/xfs/294
+++ b/tests/xfs/294
@@ -28,6 +28,13 @@ _require_test_program "punch-alternating"
_require_xfs_io_command "falloc"
_require_xfs_io_command "fpunch"
+dump_freespace()
+{
+ df $SCRATCH_MNT
+ df -i $SCRATCH_MNT
+ $XFS_IO_PROG -rc "statfs -c" $SCRATCH_MNT
+}
+
# We want to mkfs with a very specific geometry
MKFS_OPTIONS=""
_scratch_mkfs "-d size=512m -n size=8192 -i size=1024" >> $seqres.full 2>&1 \
@@ -37,7 +44,7 @@ _scratch_mount
# Make a ton of mostly-empty inode clusters so we can always
# make more inodes
mkdir $SCRATCH_MNT/tmp
-for I in `seq 1 10000`; do touch $SCRATCH_MNT/tmp/$I; done
+for I in `seq 1 10000`; do echo -n > $SCRATCH_MNT/tmp/$I; done
# These mostly-empty clusters will live here:
mkdir $SCRATCH_MNT/clusters
@@ -50,7 +57,7 @@ rm -rf $SCRATCH_MNT/tmp
mkdir $SCRATCH_MNT/testdir
# roughly 20 chars per file
for I in `seq 1 100`; do
- touch $SCRATCH_MNT/testdir/12345678901234567890$I;
+ echo -n > $SCRATCH_MNT/testdir/12345678901234567890$I;
done
# File to fragment:
@@ -63,7 +70,7 @@ space=$(stat -f -c '%f * %S * 95 / 100' $SCRATCH_MNT | $BC_PROG)
$XFS_IO_PROG -f -c "falloc 0 $space" $SCRATCH_MNT/fillfile ||
_fail "Could not allocate space"
-df -h $SCRATCH_MNT >> $seqres.full 2>&1
+dump_freespace >> $seqres.full 2>&1
# Fill remaining space; let this run to failure
dd if=/dev/zero of=$SCRATCH_MNT/spacefile1 oflag=direct >> $seqres.full 2>&1
@@ -75,12 +82,16 @@ $here/src/punch-alternating $SCRATCH_MNT/fragfile >> $seqres.full 2>&1
# (and then some for good measure)
dd conv=fsync if=/dev/zero of=$SCRATCH_MNT/spacefile2 bs=1M count=64 >> $seqres.full 2>&1
+dump_freespace >> $seqres.full 2>&1
+
# Now populate the directory so that it must allocate these
# fragmented blocks
for I in `seq 1 1400`; do
- touch $SCRATCH_MNT/testdir/12345678901234567890$I;
+ echo -n > $SCRATCH_MNT/testdir/12345678901234567890$I;
done
+dump_freespace >> $seqres.full 2>&1
+
# Now traverse that ugly thing!
find $SCRATCH_MNT/testdir | sort | _filter_scratch | md5sum
--
2.38.1
next prev parent reply other threads:[~2023-01-10 22:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-10 22:49 [PATCH 0/3] fstests: filesystem population fixes Dave Chinner
2023-01-10 22:49 ` [PATCH 1/3] populate: fix horrible performance due to excessive forking Dave Chinner
2023-01-11 6:02 ` Darrick J. Wong
2023-01-12 1:58 ` Darrick J. Wong
2023-01-12 10:24 ` [PATCH 1/3] more python dependence. was: " David Disseldorp
2023-01-12 17:07 ` Darrick J. Wong
2023-01-12 20:23 ` David Disseldorp
2023-01-12 20:42 ` Zorro Lang
2023-01-15 18:33 ` Darrick J. Wong
2023-01-10 22:49 ` [PATCH 2/3] populate: ensure btree directories are created reliably Dave Chinner
2023-01-11 5:47 ` Darrick J. Wong
2023-01-12 5:42 ` Gao Xiang
2023-01-10 22:49 ` Dave Chinner [this message]
2023-01-11 20:29 ` [PATCH 3/3] xfs/294: performance is unreasonably slow David Disseldorp
2023-01-12 8:39 ` 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=20230110224906.1171483-4-david@fromorbit.com \
--to=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.