]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
generic/139: require 512 bytes to be the minimum dio size
authorZorro Lang <zlang@kernel.org>
Thu, 2 Jun 2022 05:17:16 +0000 (13:17 +0800)
committerZorro Lang <zlang@kernel.org>
Fri, 3 Jun 2022 05:04:22 +0000 (13:04 +0800)
Due to generic/139 tests base on 512 bytes aligned, so skip this test
if the minimum dio write size >512. This patch also change the
common/rc::_require_dio helper, supports a minimum aligned size
argument.

Signed-off-by: Zorro Lang <zlang@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
common/rc
tests/generic/139

index 08e3645258e28f4a161bd75db81f75325b389603..29781a2636114fb0c75b46257288f79132e32bba 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -2721,9 +2721,13 @@ _require_xfs_io_command()
        fi
 }
 
-# check that kernel and filesystem support direct I/O
+# check that kernel and filesystem support direct I/O, and check if "$1" size
+# aligned (optional) is supported
 _require_odirect()
 {
+       local blocksize=$1
+       local align_args=${1:+"-b $1"}
+
        if [ $FSTYP = "ext4" ] || [ $FSTYP = "f2fs" ] ; then
                if echo "$MOUNT_OPTIONS" | grep -q "test_dummy_encryption"; then
                        _notrun "$FSTYP encryption doesn't support O_DIRECT"
@@ -2735,9 +2739,13 @@ _require_odirect()
                fi
        fi
        local testfile=$TEST_DIR/$$.direct
-       $XFS_IO_PROG -F -f -d -c "pwrite 0 20k" $testfile > /dev/null 2>&1
+       $XFS_IO_PROG -F -f -d -c "pwrite ${align_args} 0 20k" $testfile > /dev/null 2>&1
        if [ $? -ne 0 ]; then
-               _notrun "O_DIRECT is not supported"
+               if [ -n "$blocksize" ]; then
+                       _notrun "O_DIRECT aligned to $blocksize bytes is not supported"
+               else
+                       _notrun "O_DIRECT is not supported"
+               fi
        fi
        rm -f $testfile 2>&1 > /dev/null
 }
index 0bbc222ca3d5b06cb3fb5bdc6f829a74617b2284..3eb1519d8718012b556c40a599af4bc2db42c0b2 100755 (executable)
@@ -26,7 +26,7 @@ _cleanup()
 # real QA test starts here
 _require_test_reflink
 _require_cp_reflink
-_require_odirect
+_require_odirect 512
 
 testdir=$TEST_DIR/test-$seq
 rm -rf $testdir