diff mbox series

[1/3] xfs: skip fragmentation tests when alwayscow mode is enabled

Message ID 167400102759.1914975.16224258103457998795.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series fstests: fix tests when XFS always_cow mode enabled | expand

Commit Message

Darrick J. Wong Jan. 18, 2023, 12:43 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

If the always_cow debugging flag is enabled, all file writes turn into
copy writes.  This dramatically ramps up fragmentation in the filesystem
(intentionally!) so there's no point in complaining about fragmentation.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 common/xfs    |    9 +++++++++
 tests/xfs/182 |    1 +
 tests/xfs/192 |    1 +
 tests/xfs/198 |    1 +
 tests/xfs/204 |    1 +
 tests/xfs/211 |    1 +
 6 files changed, 14 insertions(+)

Comments

Christoph Hellwig Jan. 18, 2023, 5:43 a.m. UTC | #1
On Tue, Jan 17, 2023 at 04:43:00PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> If the always_cow debugging flag is enabled, all file writes turn into
> copy writes.  This dramatically ramps up fragmentation in the filesystem
> (intentionally!) so there's no point in complaining about fragmentation.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/common/xfs b/common/xfs
index 7eee76c0ee..a00d90a4b5 100644
--- a/common/xfs
+++ b/common/xfs
@@ -1108,6 +1108,15 @@  _require_no_xfs_bug_on_assert()
 	fi
 }
 
+# Require that XFS is not configured in always_cow mode.
+_require_no_xfs_always_cow()
+{
+	if [ -f /sys/fs/xfs/debug/always_cow ]; then
+		grep -q "1" /sys/fs/xfs/debug/always_cow && \
+		   _notrun "test requires XFS always_cow to be off, turn it off to run the test"
+	fi
+}
+
 # Get a metadata field
 # The first arg is the field name
 # The rest of the arguments are xfs_db commands to find the metadata.
diff --git a/tests/xfs/182 b/tests/xfs/182
index 696b933e60..511aca6f2d 100755
--- a/tests/xfs/182
+++ b/tests/xfs/182
@@ -24,6 +24,7 @@  _require_cp_reflink
 _require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_odirect
+_require_no_xfs_always_cow	# writes have to converge to overwrites
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/xfs/192 b/tests/xfs/192
index ced18fa3c1..eb577f15fc 100755
--- a/tests/xfs/192
+++ b/tests/xfs/192
@@ -26,6 +26,7 @@  _require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 _require_odirect
+_require_no_xfs_always_cow	# writes have to converge to overwrites
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/xfs/198 b/tests/xfs/198
index c61fbab70d..e5b98609de 100755
--- a/tests/xfs/198
+++ b/tests/xfs/198
@@ -23,6 +23,7 @@  _require_cp_reflink
 _require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_odirect
+_require_no_xfs_always_cow	# writes have to converge to overwrites
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/xfs/204 b/tests/xfs/204
index ca21dfe722..7d6b79a86d 100755
--- a/tests/xfs/204
+++ b/tests/xfs/204
@@ -28,6 +28,7 @@  _require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_xfs_io_command "funshare"
 _require_odirect
+_require_no_xfs_always_cow	# writes have to converge to overwrites
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/xfs/211 b/tests/xfs/211
index 96c0b85b14..3ce6496afc 100755
--- a/tests/xfs/211
+++ b/tests/xfs/211
@@ -24,6 +24,7 @@  _require_cp_reflink
 _require_xfs_io_command "fiemap"
 _require_xfs_io_command "cowextsize"
 _require_odirect
+_require_no_xfs_always_cow	# writes have to converge to overwrites
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1