[PATCH] generic/031: Modify fcollapse arguments to work on non-4k block sized fs instances

Anju T Sudhakar
2020-11-24T08:37:44Z

This write vs fcollapse test does a sequence of operations to create a
page which has non-contiguous mix of dirty and clean blocks. But when
running the test with 64k block size, fallocate returns with EINVAL
error, as the offset and length parameters for fcollapse are not
multiples of fs blocksize.

Modify the offset and length arguments for fcollapse in the test, to run
the test with non-4k block sized fs instances also.

Without the patch:
-------------------
# ./check generic/031
SECTION -- ext4_test
FSTYP -- ext4
PLATFORM -- Linux/ppc64le localhost_ubuntu 4.15.0-15-generic
MKFS_OPTIONS -- -b 65536 /dev/loop5
MOUNT_OPTIONS -- -o acl,user_xattr /dev/loop5 /mnt2/scratch

QA output created by 031
+fallocate: Invalid argument
+fallocate: Invalid argument
wrote 55756/55756 bytes at offset 185332
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 63394/63394 bytes at offset 133228
...

(Note: Same failure observed for xfs also)

With the patch:
-----------------
v# ./check generic/031
SECTION -- ext4_test
FSTYP -- ext4
PLATFORM -- Linux/ppc64le localhost_ubuntu 4.15.0-15-generic #
MKFS_OPTIONS -- -b 65536 /dev/loop5
MOUNT_OPTIONS -- -o acl,user_xattr /dev/loop5 /mnt2/scratch

generic/031 2s ... 2s
Ran: generic/031
Passed all 1 tests

SECTION -- ext4_test
=========================
Ran: generic/031
Passed all 1 tests

Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
---
tests/generic/031 | 6 +++---
tests/generic/031.out | 14 +++++++-------
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tests/generic/031 b/tests/generic/031
index db84031b..2b253c3c 100755
--- a/tests/generic/031
+++ b/tests/generic/031
@@ -41,9 +41,9 @@ _scratch_mount

$XFS_IO_PROG -f \
-c "pwrite 185332 55756" \
- -c "fcollapse 28672 40960" \
- -c "pwrite 133228 63394" \
- -c "fcollapse 0 4096" \
+ -c "fcollapse 65536 65536" \
+ -c "pwrite 67692 63394" \
+ -c "fcollapse 0 65536" \
$testfile | _filter_xfs_io

echo "==== Pre-Remount ==="
diff --git a/tests/generic/031.out b/tests/generic/031.out
index 194bfa45..b096694f 100644
--- a/tests/generic/031.out
+++ b/tests/generic/031.out
@@ -1,19 +1,19 @@
QA output created by 031
wrote 55756/55756 bytes at offset 185332
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-wrote 63394/63394 bytes at offset 133228
+wrote 63394/63394 bytes at offset 67692
XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
==== Pre-Remount ===
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
-0001f860 00 00 00 00 00 00 00 00 00 00 00 00 cd cd cd cd |................|
-0001f870 cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd |................|
+00000860 00 00 00 00 00 00 00 00 00 00 00 00 cd cd cd cd |................|
+00000870 cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd |................|
*
-0002fdc0
+0001adc0
==== Post-Remount ==
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
-0001f860 00 00 00 00 00 00 00 00 00 00 00 00 cd cd cd cd |................|
-0001f870 cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd |................|
+00000860 00 00 00 00 00 00 00 00 00 00 00 00 cd cd cd cd |................|
+00000870 cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd |................|
*
-0002fdc0
+0001adc0
--
2.15.1