fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] generic/501: count with PAGE_SIZE instead of KB
@ 2020-07-22  6:38 Murphy Zhou
  2020-07-22 11:58 ` Zorro Lang
  0 siblings, 1 reply; 5+ messages in thread
From: Murphy Zhou @ 2020-07-22  6:38 UTC (permalink / raw)
  To: fstests, Filipe Manana

Hard coded reflink offset/length numbers are not working well on 64K page
size arch like ppc64le, reporting:
	+XFS_IOC_CLONE_RANGE: Invalid argument

Because they are not aligned with the current PAGE_SIZE.

Translate original numbers into multiples of PAGE_SIZE. Then we're writing
different testfiles with different md5sums when PAGE_SIZE is different.
So we need to link different output file based on the current PAGE_SIZE.

This testcase is covering a btrfs regression which has been fixed in
v4.18. I tried to reproduce it on 4.17 kernel but failed with and
without this patch.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
---
 .gitignore                            |  1 +
 tests/generic/501                     | 17 +++++++++++++----
 tests/generic/{501.out => 501.out.4K} |  0
 tests/generic/501.out.64K             |  5 +++++
 4 files changed, 19 insertions(+), 4 deletions(-)
 rename tests/generic/{501.out => 501.out.4K} (100%)
 create mode 100644 tests/generic/501.out.64K

diff --git a/.gitignore b/.gitignore
index 5f5c4a0f..39318615 100644
--- a/.gitignore
+++ b/.gitignore
@@ -263,6 +263,7 @@
 /tests/xfs/033.out
 /tests/xfs/071.out
 /tests/xfs/096.out
+/tests/generic/501.out
 
 # cscope files
 cscope.*
diff --git a/tests/generic/501 b/tests/generic/501
index 0d1f6ffe..4e589cda 100755
--- a/tests/generic/501
+++ b/tests/generic/501
@@ -9,6 +9,7 @@
 # the file again and then power fail, after we mount again the filesystem, no
 # file data was lost or corrupted.
 #
+seqfull=$0
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 echo "QA output created by $seq"
@@ -42,14 +43,22 @@ _require_metadata_journaling $SCRATCH_DEV
 _init_flakey
 _mount_flakey
 
-$XFS_IO_PROG -f -c "pwrite -S 0x18 9000K 6908K" $SCRATCH_MNT/foo >>$seqres.full
-$XFS_IO_PROG -f -c "pwrite -S 0x20 2572K 156K" $SCRATCH_MNT/bar >>$seqres.full
+pagesz=$(getconf PAGE_SIZE)
+
+if [ $pagesz -eq 65536 ] ; then
+	ln -sf $seqfull.out.64K $seqfull.out
+elif [ $pagesz -eq 4096 ] ; then
+	ln -sf $seqfull.out.4K $seqfull.out
+fi
+
+$XFS_IO_PROG -f -c "pwrite -S 0x18 $((2250*pagesz)) $((1727*pagesz))" $SCRATCH_MNT/foo >>$seqres.full
+$XFS_IO_PROG -f -c "pwrite -S 0x20 $((643*pagesz)) $((39*pagesz))" $SCRATCH_MNT/bar >>$seqres.full
 
 # We clone from file foo into a range of file bar that overlaps the existing
 # extent at file bar. The destination offset of the reflink operation matches
-# the eof position of file bar minus 4Kb.
+# the eof position of file bar minus 1 PAGE_SIZE.
 $XFS_IO_PROG -c "fsync" \
-	     -c "reflink ${SCRATCH_MNT}/foo 0 2724K 15908K" \
+	     -c "reflink ${SCRATCH_MNT}/foo 0 $((681*pagesz)) $((3977*pagesz))" \
 	     -c "fsync" \
 	     $SCRATCH_MNT/bar >>$seqres.full
 
diff --git a/tests/generic/501.out b/tests/generic/501.out.4K
similarity index 100%
rename from tests/generic/501.out
rename to tests/generic/501.out.4K
diff --git a/tests/generic/501.out.64K b/tests/generic/501.out.64K
new file mode 100644
index 00000000..7e1013b2
--- /dev/null
+++ b/tests/generic/501.out.64K
@@ -0,0 +1,5 @@
+QA output created by 501
+File bar digest before power failure:
+3058797b969076e91c518cb206b21163  SCRATCH_MNT/bar
+File bar digest after power failure:
+3058797b969076e91c518cb206b21163  SCRATCH_MNT/bar
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-07-22 17:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22  6:38 [PATCH] generic/501: count with PAGE_SIZE instead of KB Murphy Zhou
2020-07-22 11:58 ` Zorro Lang
2020-07-22 11:52   ` Filipe Manana
2020-07-22 12:59     ` Murphy Zhou
2020-07-22 17:56     ` Zorro Lang

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).