On Mon, Jun 14, 2021 at 11:58:09AM +0530, Ritesh Harjani wrote: > This test fails with blocksize 64k since the test assumes 4k blocksize > in fcollapse param. This patch fixes that and also tests for 64k > blocksize. > > Signed-off-by: Ritesh Harjani <riteshh@xxxxxxxxxxxxx> > --- > tests/generic/031 | 37 ++++++++++++++++++---- > tests/generic/031.out.64k | 19 +++++++++++ > tests/generic/{031.out => 031.out.default} | 0 > 3 files changed, 49 insertions(+), 7 deletions(-) > create mode 100644 tests/generic/031.out.64k > rename tests/generic/{031.out => 031.out.default} (100%) > > diff --git a/tests/generic/031 b/tests/generic/031 > index db84031b..40cb23af 100755 > --- a/tests/generic/031 > +++ b/tests/generic/031 > @@ -8,6 +8,7 @@ > # correctly written and aren't left behind causing invalidation or data > # corruption issues. > # > +seqfull=$0 > seq=`basename $0` > seqres=$RESULT_DIR/$seq > echo "QA output created by $seq" > @@ -39,12 +40,35 @@ testfile=$SCRATCH_MNT/testfile > _scratch_mkfs > /dev/null 2>&1 > _scratch_mount > > -$XFS_IO_PROG -f \ > - -c "pwrite 185332 55756" \ > - -c "fcollapse 28672 40960" \ > - -c "pwrite 133228 63394" \ > - -c "fcollapse 0 4096" \ > -$testfile | _filter_xfs_io > +# fcollapse need offset and len to be multiple of blocksize for filesystems > +# hence make this test work with 64k blocksize as well. > +blksz=$(_get_block_size $SCRATCH_MNT) > + > +rm -f $seqfull.out > +if [ "$blksz" -eq 65536 ]; then > + ln -s $seq.out.64k $seqfull.out > +else > + ln -s $seq.out.default $seqfull.out > +fi > + > +if [[ $blksz -le 4096 ]]; then > + $XFS_IO_PROG -f \ > + -c "pwrite 185332 55756" \ > + -c "fcollapse 28672 40960" \ > + -c "pwrite 133228 63394" \ > + -c "fcollapse 0 4096" \ > + $testfile | _filter_xfs_io > +elif [[ $blksz -eq 65536 ]]; then > + fact=$blksz/4096 What if the blocksize is 32k? --D > + $XFS_IO_PROG -f \ > + -c "pwrite $((185332*fact + 12)) $((55756*fact + 12))" \ > + -c "fcollapse $((28672 * fact)) $((40960 * fact))" \ > + -c "pwrite $((133228 * fact + 12)) $((63394 * fact + 12))" \ > + -c "fcollapse 0 $((4096 * fact))" \ > + $testfile | _filter_xfs_io > +else > + _notrun "blocksize not supported" > +fi > > echo "==== Pre-Remount ===" > hexdump -C $testfile > @@ -54,4 +78,3 @@ hexdump -C $testfile > > status=0 > exit > - > diff --git a/tests/generic/031.out.64k b/tests/generic/031.out.64k > new file mode 100644 > index 00000000..7dfcfe41 > --- /dev/null > +++ b/tests/generic/031.out.64k > @@ -0,0 +1,19 @@ > +QA output created by 031 > +wrote 892108/892108 bytes at offset 2965324 > +XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) > +wrote 1014316/1014316 bytes at offset 2131660 > +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 |................| > +* > +001f86c0 00 00 00 00 00 00 00 00 00 00 00 00 cd cd cd cd |................| > +001f86d0 cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd |................| > +* > +002fdc18 > +==== Post-Remount == > +00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| > +* > +001f86c0 00 00 00 00 00 00 00 00 00 00 00 00 cd cd cd cd |................| > +001f86d0 cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd |................| > +* > +002fdc18 > diff --git a/tests/generic/031.out b/tests/generic/031.out.default > similarity index 100% > rename from tests/generic/031.out > rename to tests/generic/031.out.default > -- > 2.31.1 >