From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, zlang@redhat.com
Cc: guan@eryu.me, linux-xfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH 4/5] xfs: test COWing entire rt extents
Date: Sun, 31 Dec 2023 17:05:02 +9900 [thread overview]
Message-ID: <170405032789.1827706.9480080283762068776.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <170405032733.1827706.12312180709769839153.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
For XFS filesystems with a realtime volume, an extent size larger than
1FSB, and reflink enabled, we use a "COW around" strategy that detects
file writes that are not aligned to the rt extent size and enlarges
those writes to dirty enough page cache so that the entire rt extent can
be COWed all at once. This is a functional test to make sure that all
works properly.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/xfs/1926 | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/1926.out | 2 +
2 files changed, 179 insertions(+)
create mode 100755 tests/xfs/1926
create mode 100644 tests/xfs/1926.out
diff --git a/tests/xfs/1926 b/tests/xfs/1926
new file mode 100755
index 0000000000..91b611f59d
--- /dev/null
+++ b/tests/xfs/1926
@@ -0,0 +1,177 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023-2024 Oracle. All Rights Reserved.
+#
+# FS QA Test No. 1926
+#
+# Functional testing for COWing around realtime extents.
+#
+. ./common/preamble
+_begin_fstest auto clone realtime rw
+
+_cleanup()
+{
+ cd /
+ rm -r -f $tmp.* $testdir
+}
+
+. ./common/reflink
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs generic
+_require_test
+_require_test_reflink
+_require_cp_reflink
+
+alloc_unit=$(_get_file_block_size $TEST_DIR)
+blksz=$(_get_block_size $TEST_DIR)
+
+testdir="$TEST_DIR/test-$seq"
+mkdir "$testdir"
+
+filesize="$(( (alloc_unit * 5 / 2) + 512))"
+origfile="$testdir/a"
+testfile0="$testdir/a0"
+testfile1="$testdir/a1"
+testfile2="$testdir/a2"
+testfile3="$testdir/a3"
+testfile4="$testdir/a4"
+testfile5="$testdir/a5"
+testfile6="$testdir/a6"
+testfile7="$testdir/a7"
+testfile8="$testdir/a8"
+testfile9="$testdir/a9"
+testfileA="$testdir/aA"
+testfileB="$testdir/aB"
+
+goldfile0="$testdir/g0"
+goldfile1="$testdir/g1"
+goldfile2="$testdir/g2"
+goldfile3="$testdir/g3"
+goldfile4="$testdir/g4"
+goldfile5="$testdir/g5"
+
+orig_cmd="pwrite -S 0x58 -b 1m 0 $filesize"
+$XFS_IO_PROG -f -c "$orig_cmd" -c fsync "$origfile" >> $seqres.full
+
+_cp_reflink "$origfile" "$testfile0"
+_cp_reflink "$origfile" "$testfile1"
+_cp_reflink "$origfile" "$testfile2"
+_cp_reflink "$origfile" "$testfile3"
+_cp_reflink "$origfile" "$testfile4"
+_cp_reflink "$origfile" "$testfile5"
+_cp_reflink "$origfile" "$testfile6"
+_cp_reflink "$origfile" "$testfile7"
+_cp_reflink "$origfile" "$testfile8"
+_cp_reflink "$origfile" "$testfile9"
+_cp_reflink "$origfile" "$testfileA"
+_cp_reflink "$origfile" "$testfileB"
+
+# First we try a partial ovewrite below EOF
+cmd="pwrite -S 0x59 -b 1m -W 512 512"
+_kernlog "********** buffered write below eof goldfile0"
+$XFS_IO_PROG -c "$cmd" "$testfile0" >> $seqres.full
+_kernlog "********** direct write below eof goldfile0"
+$XFS_IO_PROG -d -c "$cmd" "$testfile1" >> $seqres.full
+_kernlog "********** goldfile0"
+$XFS_IO_PROG -f -c "$orig_cmd" -c "$cmd" -c fsync "$goldfile0" >> $seqres.full
+
+# Next we try an appending write at EOF
+_kernlog "********** appending buffered write goldfile1"
+cmd="pwrite -S 0x5a -b 1m -W $filesize 512"
+$XFS_IO_PROG -c "$cmd" "$testfile2" >> $seqres.full
+_kernlog "********** appending direct write goldfile1"
+$XFS_IO_PROG -d -c "$cmd" "$testfile3" >> $seqres.full
+_kernlog "********** goldfile1"
+$XFS_IO_PROG -f -c "$orig_cmd" -c "$cmd" -c fsync "$goldfile1" >> $seqres.full
+
+# Third we try a pure overwrite of the second block
+_kernlog "********** buffered overwrite second block goldfile2"
+cmd="pwrite -S 0x5b -b 1m -W $alloc_unit $alloc_unit"
+$XFS_IO_PROG -c "$cmd" "$testfile4" >> $seqres.full
+_kernlog "********** direct overwrite second block goldfile2"
+$XFS_IO_PROG -d -c "$cmd" "$testfile5" >> $seqres.full
+_kernlog "********** goldfile2"
+$XFS_IO_PROG -f -c "$orig_cmd" -c "$cmd" -c fsync "$goldfile2" >> $seqres.full
+
+# Fourth we try a small write well beyond EOF
+_kernlog "********** buffered write beyond eof block goldfile3"
+cmd="pwrite -S 0x5c -b 1m -W $(( (filesize * 2) + 512)) 512"
+$XFS_IO_PROG -c "$cmd" "$testfile6" >> $seqres.full
+_kernlog "********** direct write beyond eof block goldfile3"
+$XFS_IO_PROG -d -c "$cmd" "$testfile7" >> $seqres.full
+_kernlog "********** goldfile3"
+$XFS_IO_PROG -f -c "$orig_cmd" -c "$cmd" -c fsync "$goldfile3" >> $seqres.full
+
+# Fifth we try a large write well beyond EOF
+_kernlog "********** buffered write beyond eof block goldfile4"
+cmd="pwrite -S 0x5d -b 1m -W $(( ((filesize * 2) + 512) & ~(alloc_unit - 1) )) $alloc_unit"
+$XFS_IO_PROG -c "$cmd" "$testfile8" >> $seqres.full
+_kernlog "********** direct write beyond eof block goldfile4"
+$XFS_IO_PROG -d -c "$cmd" "$testfile9" >> $seqres.full
+_kernlog "********** goldfile3"
+$XFS_IO_PROG -f -c "$orig_cmd" -c "$cmd" -c fsync "$goldfile4" >> $seqres.full
+
+# Sixth we try a pure overwrite of the second fsblock
+_kernlog "********** buffered overwrite second fsblock goldfile5"
+cmd="pwrite -S 0x5b -b 1m -W $blksz $alloc_unit"
+$XFS_IO_PROG -c "$cmd" "$testfileA" >> $seqres.full
+_kernlog "********** direct overwrite second fsblock goldfile5"
+$XFS_IO_PROG -d -c "$cmd" "$testfileB" >> $seqres.full
+_kernlog "********** goldfile5"
+$XFS_IO_PROG -f -c "$orig_cmd" -c "$cmd" -c fsync "$goldfile5" >> $seqres.full
+
+_kernlog "********** done"
+
+corruption_noted=
+
+note_corruption() {
+ local fname="$1"
+
+ echo "$fname is bad"
+
+ if [ -z "$corruption_noted" ]; then
+ corruption_noted=1
+ echo "origfile" >> $seqres.full
+ od -tx1 -Ad -c "$origfile" >> $seqres.full
+ fi
+
+ echo "$fname" >> $seqres.full
+ od -tx1 -Ad -c "$testfile1" >> $seqres.full
+}
+
+echo "before remount" >> $seqres.full
+cmp -s "$goldfile0" "$testfile0" || note_corruption "$testfile0"
+cmp -s "$goldfile0" "$testfile1" || note_corruption "$testfile1"
+cmp -s "$goldfile1" "$testfile2" || note_corruption "$testfile2"
+cmp -s "$goldfile1" "$testfile3" || note_corruption "$testfile3"
+cmp -s "$goldfile2" "$testfile4" || note_corruption "$testfile4"
+cmp -s "$goldfile2" "$testfile5" || note_corruption "$testfile5"
+cmp -s "$goldfile3" "$testfile6" || note_corruption "$testfile6"
+cmp -s "$goldfile3" "$testfile7" || note_corruption "$testfile7"
+cmp -s "$goldfile4" "$testfile8" || note_corruption "$testfile8"
+cmp -s "$goldfile4" "$testfile9" || note_corruption "$testfile9"
+cmp -s "$goldfile5" "$testfileA" || note_corruption "$testfileA"
+cmp -s "$goldfile5" "$testfileB" || note_corruption "$testfileB"
+
+_test_cycle_mount
+
+echo "after remount" >> $seqres.full
+cmp -s "$goldfile0" "$testfile0" || note_corruption "$testfile0"
+cmp -s "$goldfile0" "$testfile1" || note_corruption "$testfile1"
+cmp -s "$goldfile1" "$testfile2" || note_corruption "$testfile2"
+cmp -s "$goldfile1" "$testfile3" || note_corruption "$testfile3"
+cmp -s "$goldfile2" "$testfile4" || note_corruption "$testfile4"
+cmp -s "$goldfile2" "$testfile5" || note_corruption "$testfile5"
+cmp -s "$goldfile3" "$testfile6" || note_corruption "$testfile6"
+cmp -s "$goldfile3" "$testfile7" || note_corruption "$testfile7"
+cmp -s "$goldfile4" "$testfile8" || note_corruption "$testfile8"
+cmp -s "$goldfile4" "$testfile9" || note_corruption "$testfile9"
+cmp -s "$goldfile5" "$testfileA" || note_corruption "$testfileA"
+cmp -s "$goldfile5" "$testfileB" || note_corruption "$testfileB"
+
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/1926.out b/tests/xfs/1926.out
new file mode 100644
index 0000000000..a56601b969
--- /dev/null
+++ b/tests/xfs/1926.out
@@ -0,0 +1,2 @@
+QA output created by 1926
+Silence is golden
next prev parent reply other threads:[~2024-01-01 1:05 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-31 18:23 [NYE PATCHRIVER 3/4] xfs: modernize the realtime volume Darrick J. Wong
2023-12-31 20:00 ` [PATCHSET v2.0 1/9] fstests: test XFS metadata directories Darrick J. Wong
2023-12-27 13:50 ` [PATCH 01/11] xfs/122: fix metadirino Darrick J. Wong
2023-12-27 13:50 ` [PATCH 02/11] various: fix finding metadata inode numbers when metadir is enabled Darrick J. Wong
2023-12-27 13:50 ` [PATCH 03/11] xfs/{030,033,178}: forcibly disable metadata directory trees Darrick J. Wong
2023-12-27 13:50 ` [PATCH 04/11] common/repair: patch up repair sb inode value complaints Darrick J. Wong
2023-12-27 13:51 ` [PATCH 05/11] xfs/206: update for metadata directory support Darrick J. Wong
2023-12-27 13:51 ` [PATCH 06/11] xfs/{050,144,153,299,330}: update quota reports to handle metadir trees Darrick J. Wong
2023-12-27 13:51 ` [PATCH 07/11] xfs/856: add metadir upgrade to test matrix Darrick J. Wong
2023-12-27 13:51 ` [PATCH 08/11] xfs/509: adjust inumbers accounting for metadata directories Darrick J. Wong
2023-12-27 13:52 ` [PATCH 09/11] xfs: create fuzz tests " Darrick J. Wong
2023-12-27 13:52 ` [PATCH 10/11] xfs: baseline golden output for metadata directory fuzz tests Darrick J. Wong
2023-12-27 13:52 ` [PATCH 11/11] xfs: test metapath repairs Darrick J. Wong
2023-12-31 20:00 ` [PATCHSET v2.0 2/9] xfsprogs: shard the realtime section Darrick J. Wong
2023-12-27 13:53 ` [PATCH 01/17] common/populate: refactor caching of metadumps to a helper Darrick J. Wong
2023-12-27 13:53 ` [PATCH 02/17] common/xfs: wipe external logs during mdrestore operations Darrick J. Wong
2023-12-27 13:53 ` [PATCH 03/17] common/ext4: reformat " Darrick J. Wong
2023-12-27 13:53 ` [PATCH 04/17] xfs: use metadump v2 format by default Darrick J. Wong
2023-12-27 13:54 ` [PATCH 05/17] common/xfs: capture external logs during metadump/mdrestore Darrick J. Wong
2023-12-27 13:54 ` [PATCH 06/17] xfs/122: update for rtgroups Darrick J. Wong
2023-12-27 13:54 ` [PATCH 07/17] punch-alternating: detect xfs realtime files with large allocation units Darrick J. Wong
2023-12-27 13:54 ` [PATCH 08/17] xfs/206: update mkfs filtering for rt groups feature Darrick J. Wong
2023-12-27 13:55 ` [PATCH 09/17] common: pass the realtime device to xfs_db when possible Darrick J. Wong
2023-12-27 13:55 ` [PATCH 10/17] common: filter rtgroups when we're disabling metadir Darrick J. Wong
2023-12-27 13:55 ` [PATCH 11/17] xfs/185: update for rtgroups Darrick J. Wong
2023-12-27 13:55 ` [PATCH 12/17] xfs/449: update test to know about xfs_db -R Darrick J. Wong
2023-12-27 13:56 ` [PATCH 13/17] xfs/122: update for rtbitmap headers Darrick J. Wong
2023-12-27 13:56 ` [PATCH 14/17] xfs/122: udpate test to pick up rtword/suminfo ondisk unions Darrick J. Wong
2023-12-27 13:56 ` [PATCH 15/17] xfs/27[46],xfs/556: fix tests to deal with rtgroups output in bmap/fsmap commands Darrick J. Wong
2023-12-27 13:56 ` [PATCH 16/17] common/xfs: capture realtime devices during metadump/mdrestore Darrick J. Wong
2023-12-27 13:57 ` [PATCH 17/17] common/fuzzy: adapt the scrub stress tests to support rtgroups Darrick J. Wong
2023-12-31 20:00 ` [PATCHSET v2.0 3/9] fstests: enable FITRIM for the realtime section Darrick J. Wong
2023-12-27 13:57 ` [PATCH 1/2] xfs: refactor statfs field extraction Darrick J. Wong
2023-12-27 13:57 ` [PATCH 2/2] common/xfs: FITRIM now supports realtime volumes Darrick J. Wong
2023-12-31 20:00 ` [PATCHSET v2.0 4/9] fstests: fixes for realtime rmap Darrick J. Wong
2023-12-27 13:57 ` [PATCH 01/13] xfs: fix tests that try to access the realtime rmap inode Darrick J. Wong
2023-12-27 13:58 ` [PATCH 02/13] fuzz: for fuzzing the rtrmapbt, find the path to the rt rmap btree file Darrick J. Wong
2023-12-27 13:58 ` [PATCH 03/13] xfs: race fsstress with realtime rmap btree scrub and repair Darrick J. Wong
2023-12-27 13:58 ` [PATCH 04/13] xfs/856: add rtrmapbt upgrade to test matrix Darrick J. Wong
2023-12-27 13:59 ` [PATCH 05/13] xfs/122: update for rtgroups-based realtime rmap btrees Darrick J. Wong
2023-12-27 13:59 ` [PATCH 06/13] xfs: fix various problems with fsmap detecting the data device Darrick J. Wong
2023-12-27 13:59 ` [PATCH 07/13] xfs/341: update test for rtgroup-based rmap Darrick J. Wong
2023-12-27 13:59 ` [PATCH 08/13] xfs/3{43,32}: adapt tests for rt extent size greater than 1 Darrick J. Wong
2023-12-27 14:00 ` [PATCH 09/13] xfs: skip tests if formatting small filesystem fails Darrick J. Wong
2023-12-27 14:00 ` [PATCH 10/13] xfs/443: use file allocation unit, not dbsize Darrick J. Wong
2023-12-27 14:00 ` [PATCH 11/13] populate: adjust rtrmap calculations for rtgroups Darrick J. Wong
2023-12-27 14:00 ` [PATCH 12/13] populate: check that we created a realtime rmap btree of the given height Darrick J. Wong
2023-12-27 14:01 ` [PATCH 13/13] fuzzy: create missing fuzz tests for rt rmap btrees Darrick J. Wong
2023-12-31 20:01 ` [PATCHSET v2.0 5/9] fstests: establish baseline for realtime rmap fuzz tests Darrick J. Wong
2023-12-27 14:01 ` [PATCH 1/1] fuzzy: create known output for rt rmap btree " Darrick J. Wong
2023-12-31 20:01 ` [PATCHSET v2.0 6/9] fstests: reflink on the realtime device Darrick J. Wong
2023-12-27 14:01 ` [PATCH 1/9] xfs/122: update fields for realtime reflink Darrick J. Wong
2023-12-27 14:01 ` [PATCH 2/9] common/populate: create realtime refcount btree Darrick J. Wong
2023-12-27 14:02 ` [PATCH 3/9] xfs: create fuzz tests for the " Darrick J. Wong
2023-12-27 14:02 ` [PATCH 4/9] xfs/27[24]: adapt for checking files on the realtime volume Darrick J. Wong
2023-12-27 14:02 ` [PATCH 5/9] xfs: race fsstress with realtime refcount btree scrub and repair Darrick J. Wong
2023-12-27 14:02 ` [PATCH 6/9] xfs: remove xfs/131 now that we allow reflink on realtime volumes Darrick J. Wong
2023-12-27 14:03 ` [PATCH 7/9] xfs/856: add rtreflink upgrade to test matrix Darrick J. Wong
2023-12-27 14:03 ` [PATCH 8/9] generic/331,xfs/240: support files that skip delayed allocation Darrick J. Wong
2023-12-27 14:03 ` [PATCH 9/9] common/xfs: fix _xfs_get_file_block_size when rtinherit is set and no rt section Darrick J. Wong
2023-12-31 20:01 ` [PATCHSET v2.0 7/9] fstests: establish baseline for realtime reflink fuzz tests Darrick J. Wong
2023-12-27 14:03 ` [PATCH 1/1] xfs: baseline golden output for rt refcount btree " Darrick J. Wong
2023-12-31 20:01 ` [PATCHSET v2.0 8/9] fstests: reflink with large realtime extents Darrick J. Wong
2023-12-27 14:04 ` [PATCH 1/5] xfs: make sure that CoW will write around when rextsize > 1 Darrick J. Wong
2023-12-27 14:04 ` [PATCH 2/5] xfs: skip cowextsize hint fragmentation tests on realtime volumes Darrick J. Wong
2023-12-27 14:04 ` [PATCH 3/5] misc: add more congruent oplen testing Darrick J. Wong
2023-12-27 14:05 ` Darrick J. Wong [this message]
2023-12-27 14:05 ` [PATCH 5/5] generic/303: avoid test failures on weird rt extent sizes Darrick J. Wong
2023-12-31 20:02 ` [PATCHSET v2.0 9/9] fstests: functional tests for rt quota Darrick J. Wong
2023-12-27 14:05 ` [PATCH 1/3] common: enable testing of realtime quota when supported Darrick J. Wong
2023-12-27 14:05 ` [PATCH 2/3] xfs: fix quota tests to adapt to realtime quota Darrick J. Wong
2023-12-27 14:06 ` [PATCH 3/3] xfs: regression testing of quota on the realtime device 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=170405032789.1827706.9480080283762068776.stgit@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=guan@eryu.me \
--cc=linux-xfs@vger.kernel.org \
--cc=zlang@redhat.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