generic/496: ext4 and xfs supports swapon on fallocated file
authorRitesh Harjani <riteshh@linux.ibm.com>
Tue, 5 Jan 2021 14:31:43 +0000 (20:01 +0530)
committerEryu Guan <guaneryu@gmail.com>
Sun, 10 Jan 2021 09:07:26 +0000 (17:07 +0800)
ext4, xfs should not fail swapon on fallocated file. Currently if this
fails the fstst was not returning a failure. Fix those for given
filesystems (for now added ext4/xfs).
There were some regressions which went unnoticed due to this in ext4
tree, which later got fixed as part of this patch [1]

[1]: https://patchwork.ozlabs.org/patch/1357275

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/496
tests/generic/group

index 805c6ac1c0ea054e4d88e486685447012ae4d2a5..1bfd16411b8a3aa9661fc73008476f6eff470fcc 100755 (executable)
@@ -5,7 +5,7 @@
 # FS QA Test No. 496
 #
 # Test various swapfile activation oddities on filesystems that support
 # FS QA Test No. 496
 #
 # Test various swapfile activation oddities on filesystems that support
-# fallocated swapfiles.
+# fallocated swapfiles (for given fs ext4/xfs)
 #
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
 #
 seq=`basename $0`
 seqres=$RESULT_DIR/$seq
@@ -61,8 +61,18 @@ touch $swapfile
 $CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full
 "$here/src/mkswap" $swapfile
 $CHATTR_PROG +C $swapfile >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full
 "$here/src/mkswap" $swapfile
-"$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \
-       _notrun "fallocated swap not supported here"
+
+# ext4/xfs should not fail for swapon on fallocated files
+case $FSTYP in
+ext4|xfs)
+       "$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \
+               _fail "swapon failed on fallocated file"
+       ;;
+*)
+       "$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \
+               _notrun "fallocated swap not supported here"
+       ;;
+esac
 swapoff $swapfile
 
 # Create a fallocated swap file and touch every other $PAGE_SIZE to create
 swapoff $swapfile
 
 # Create a fallocated swap file and touch every other $PAGE_SIZE to create
index fec35d8e7b126df61784fd6e3018ae0a05cdafda..30a73605610d1cb7c66e75d75df5650997cd331d 100644 (file)
 493 auto quick swap dedupe
 494 auto quick swap punch
 495 auto quick swap
 493 auto quick swap dedupe
 494 auto quick swap punch
 495 auto quick swap
-496 auto quick swap
+496 auto quick swap prealloc
 497 auto quick swap collapse
 498 auto quick log
 499 auto quick rw collapse zero
 497 auto quick swap collapse
 498 auto quick log
 499 auto quick rw collapse zero