mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
Check O_DIRECT support before testing direct I/O
Some filesystems do not support O_DIRECT. Check whether TEST_DIR supports it by running xfs_io with -d flag. Signed-off-by: Junho Ryu <jayr@google.com> Signed-off-by: Dushan Tcholich <dusanc@gmail.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
@@ -1402,6 +1402,7 @@ _require_aiodio()
|
||||
AIO_TEST=src/aio-dio-regress/$1
|
||||
[ -x $AIO_TEST ] || _notrun "$AIO_TEST not built"
|
||||
fi
|
||||
_require_odirect
|
||||
}
|
||||
|
||||
# run an aio-dio program
|
||||
@@ -1530,6 +1531,17 @@ _require_xfs_io_command()
|
||||
_notrun "xfs_io $command failed (old kernel/wrong fs?)"
|
||||
}
|
||||
|
||||
# check that kernel and filesystem support direct I/O
|
||||
_require_odirect()
|
||||
{
|
||||
testfile=$TEST_DIR/$$.direct
|
||||
$XFS_IO_PROG -F -f -d -c "pwrite 0 20k" $testfile > /dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
_notrun "O_DIRECT is not supported"
|
||||
fi
|
||||
rm -f $testfile 2>&1 > /dev/null
|
||||
}
|
||||
|
||||
# Check that a fs has enough free space (in 1024b blocks)
|
||||
#
|
||||
_require_fs_space()
|
||||
|
||||
Reference in New Issue
Block a user