grep -w atomic_write_unit_max | grep -o '[0-9]\+'
}
+_get_atomic_write_unit_max_opt()
+{
+ $XFS_IO_PROG -c "statx -r -m $STATX_WRITE_ATOMIC" $1 | \
+ grep -w atomic_write_unit_max_opt | grep -o '[0-9]\+'
+}
+
_get_atomic_write_segments_max()
{
$XFS_IO_PROG -c "statx -r -m $STATX_WRITE_ATOMIC" $1 | \
sector_size=$(blockdev --getss $SCRATCH_DEV)
min_awu=$(_get_atomic_write_unit_min $testfile)
max_awu=$(_get_atomic_write_unit_max $testfile)
+opt_awu=$(_get_atomic_write_unit_max_opt $testfile)
-$XFS_IO_PROG -f -c "falloc 0 $((max_awu * 2))" -c fsync $testfile
+echo "min:$min_awu max:$max_awu opt:$opt_awu" >> $seqres.full
+
+# We want to test hardware support, so use that if detected
+if [ -n "$opt_awu" ] && [ "$opt_awu" != "0" ]; then
+ write_size="$opt_awu"
+else
+ write_size="$max_awu"
+fi
+
+$XFS_IO_PROG -f -c "falloc 0 $((write_size * 2))" -c fsync $testfile
# try outside the advertised sizes
echo "two EINVAL for unsupported sizes"
# try all of the advertised sizes
echo "all should work"
-for ((i = min_awu; i <= max_awu; i *= 2)); do
- $XFS_IO_PROG -f -c "falloc 0 $((max_awu * 2))" -c fsync $testfile
+for ((i = min_awu; i <= write_size; i *= 2)); do
+ $XFS_IO_PROG -f -c "falloc 0 $((write_size * 2))" -c fsync $testfile
_test_atomic_file_writes $i $testfile
done