@@ -4296,21 +4296,6 @@ _scale_fsstress_args()
printf '%s\n' "$args"
}
-#
-# Return the logical block size if running on a block device,
-# else substitute the page size.
-#
-_min_dio_alignment()
-{
- local dev=$1
-
- if [ -b "$dev" ]; then
- blockdev --getss $dev
- else
- $here/src/feature -s
- fi
-}
-
run_check()
{
echo "# $@" >> $seqres.full 2>&1
@@ -16,7 +16,7 @@ _require_test
_require_odirect
psize=`$here/src/feature -s`
-bsize=`_min_dio_alignment $TEST_DEV`
+bsize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
# fsx usage:
#
@@ -16,12 +16,15 @@ _require_scratch
_require_odirect
_require_aio
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+
iodepth=$((16 * LOAD_FACTOR))
iodepth_batch=$((8 * LOAD_FACTOR))
numjobs=$((5 * LOAD_FACTOR))
fio_config=$tmp.fio
fio_out=$tmp.fio.out
-blksz=$(_min_dio_alignment $SCRATCH_DEV)
+blksz=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
cat >$fio_config <<EOF
[global]
bs=8k
@@ -82,8 +85,6 @@ EOF
echo 'bs=$pagesize' >> $fio_config
_require_fio $fio_config
-_scratch_mkfs >>$seqres.full 2>&1
-_scratch_mount
# There's a known EIO failure to report collisions between directio and buffered
# writes to userspace, refer to upstream linux 5a9d929d6e13. So ignore EIO error
@@ -25,7 +25,7 @@ _require_sparse_files
_require_aiodio aio-dio-eof-race
# Test does 512 byte DIO, so make sure that'll work
-logical_block_size=`_min_dio_alignment $TEST_DEV`
+logical_block_size=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
if [ "$logical_block_size" -gt "512" ]; then
_notrun "device block size: $logical_block_size greater than 512"
@@ -29,7 +29,7 @@ echo "Silence is golden."
rm -f $TEST_DIR/aiodio_sparse
-logical_block_size=`_min_dio_alignment $TEST_DEV`
+logical_block_size=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
fs_block_size=`_get_block_size $TEST_DIR`
file_size=$((8 * $fs_block_size))
@@ -49,7 +49,7 @@ nr=640
bufnr=128
filesize=$((blksz * nr))
bufsize=$((blksz * bufnr))
-alignment=`_min_dio_alignment $TEST_DEV`
+alignment=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 5 / 4))
@@ -16,7 +16,7 @@ _require_test
_require_odirect
psize=`$here/src/feature -s`
-bsize=`_min_dio_alignment $TEST_DEV`
+bsize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
run_fsx -N 10000 -o 8192 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z
run_fsx -N 10000 -o 128000 -l 500000 -r PSIZE -t BSIZE -w BSIZE -Z
@@ -40,7 +40,7 @@ nr=640
bufnr=128
filesize=$((blksz * nr))
bufsize=$((blksz * bufnr))
-alignment=`_min_dio_alignment $TEST_DEV`
+alignment=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
@@ -36,7 +36,7 @@ nr=640
bufnr=128
filesize=$((blksz * nr))
bufsize=$((blksz * bufnr))
-alignment=`_min_dio_alignment $TEST_DEV`
+alignment=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
@@ -31,7 +31,7 @@ _require_test
_require_odirect
tfile=$TEST_DIR/testfile_${seq}
-ssize=`_min_dio_alignment $TEST_DEV`
+ssize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
bsize=`_get_block_size $TEST_DIR`
# let's focus on the specific bug that only happens when $ssize <= $bsize
@@ -26,7 +26,7 @@ _require_aiodio aio-dio-append-write-read-race
_require_test_program "feature"
testfile=$TEST_DIR/$seq.$$
-min_dio_align=`_min_dio_alignment $TEST_DEV`
+min_dio_align=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
page_size=`$here/src/feature -s`
echo "non-aio dio test"
@@ -28,7 +28,7 @@ _require_test
_require_aiodio aio-dio-write-verify
localfile=$TEST_DIR/${seq}-aio-dio-write-verify-testfile
-diosize=`_min_dio_alignment $TEST_DEV`
+diosize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
blocksize=`_get_block_size $TEST_DIR`
bufsize=$((blocksize * 2))
truncsize=$((bufsize+diosize))
@@ -19,7 +19,7 @@ _scratch_mkfs > $seqres.full 2>&1
_scratch_mount
localfile=$SCRATCH_MNT/testfile
-diosize=`_min_dio_alignment $SCRATCH_DEV`
+diosize=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
# The maximum write size and offset are both 32k diosize. So the maximum
# file size will be (32 * 2)k
@@ -22,7 +22,7 @@ _require_test
_require_odirect
_require_test_program "splice-test"
-diosize=`_min_dio_alignment $TEST_DEV`
+diosize=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
$here/src/splice-test -s $diosize -r $TEST_DIR/a
$here/src/splice-test -rd $TEST_DIR/a
@@ -43,11 +43,6 @@ _scratch_mkfs_xfs >/dev/null 2>&1
# For this test we use block size = 1/8 page size
pgsize=`$here/src/feature -s`
blksize=`expr $pgsize / 8`
-secsize=`_min_dio_alignment $SCRATCH_DEV`
-
-if [ $secsize -gt $blksize ];then
- _notrun "sector size($secsize) too large for platform page size($pgsize)"
-fi
# Filter out file mountpoint and physical location info
# Input:
@@ -84,6 +79,12 @@ unset XFS_MKFS_OPTIONS
# we need 512 byte block size, so crc's are turned off
_scratch_mkfs_xfs -m crc=0 -b size=$blksize >/dev/null 2>&1
_scratch_mount
+
+secsize=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
+if [ $secsize -gt $blksize ];then
+ _notrun "sector size($secsize) too large for platform page size($pgsize)"
+fi
+
test "$(_get_block_size $SCRATCH_MNT)" = $blksize || \
_notrun "Could not get $blksize-byte blocks"
@@ -24,10 +24,9 @@ _cleanup()
file=$SCRATCH_MNT/f
-min_align=`_min_dio_alignment $SCRATCH_DEV`
-
do_pwrite()
{
+ min_align=$3
offset=`expr $1 \* $min_align`
end=`expr $2 \* $min_align`
length=`expr $end - $offset`
@@ -40,28 +39,30 @@ _require_scratch
_scratch_mkfs_xfs >/dev/null 2>&1
_scratch_mount
+min_align=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
+
# Create a fragmented file
-do_pwrite 30792 31039
-do_pwrite 30320 30791
-do_pwrite 29688 30319
-do_pwrite 29536 29687
-do_pwrite 27216 29535
-do_pwrite 24368 27215
-do_pwrite 21616 24367
-do_pwrite 20608 21615
-do_pwrite 19680 20607
-do_pwrite 19232 19679
-do_pwrite 17840 19231
-do_pwrite 16928 17839
-do_pwrite 15168 16927
-do_pwrite 14048 15167
-do_pwrite 12152 14047
-do_pwrite 11344 12151
-do_pwrite 8792 11343
-do_pwrite 6456 8791
-do_pwrite 5000 6455
-do_pwrite 1728 4999
-do_pwrite 0 1727
+do_pwrite 30792 31039 $min_align
+do_pwrite 30320 30791 $min_align
+do_pwrite 29688 30319 $min_align
+do_pwrite 29536 29687 $min_align
+do_pwrite 27216 29535 $min_align
+do_pwrite 24368 27215 $min_align
+do_pwrite 21616 24367 $min_align
+do_pwrite 20608 21615 $min_align
+do_pwrite 19680 20607 $min_align
+do_pwrite 19232 19679 $min_align
+do_pwrite 17840 19231 $min_align
+do_pwrite 16928 17839 $min_align
+do_pwrite 15168 16927 $min_align
+do_pwrite 14048 15167 $min_align
+do_pwrite 12152 14047 $min_align
+do_pwrite 11344 12151 $min_align
+do_pwrite 8792 11343 $min_align
+do_pwrite 6456 8791 $min_align
+do_pwrite 5000 6455 $min_align
+do_pwrite 1728 4999 $min_align
+do_pwrite 0 1727 $min_align
sync
sync
@@ -41,7 +41,7 @@ nr=640
bufnr=128
filesize=$((blksz * nr))
bufsize=$((blksz * bufnr))
-alignment=`_min_dio_alignment $TEST_DEV`
+alignment=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
_require_congruent_file_oplen $SCRATCH_MNT $blksz
@@ -40,7 +40,7 @@ filesize=$((blksz * nr))
bufsize=$((blksz * bufnr))
filesize=$filesize
bufsize=$bufsize
-alignment=`_min_dio_alignment $TEST_DEV`
+alignment=`$here/src/min_dio_alignment $TEST_DIR $TEST_DEV`
_require_fs_space $SCRATCH_MNT $((filesize / 1024 * 3 * 5 / 4))
@@ -82,7 +82,7 @@ ENDL
# All sector numbers that we feed to the kernel must be in units of 512b, but
# they also must be aligned to the device's logical block size.
-logical_block_size=$(_min_dio_alignment $SCRATCH_DEV)
+logical_block_size=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
kernel_sectors_per_device_lba=$((logical_block_size / 512))
# Mark as bad one of the device LBAs in the middle of the extent. Target the