Skip to contentSkip to conversation

generic/366: check minimum dio size correctly

PATCH In review Christoph Hellwig 2 participants 2 messages Jun 17

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 generic/366: check minimum dio size correctly

min_dio_alignment requires the file system to be checked to be mounted, so move the call into the main loop. Drop the pointless blocksize argument to _require_odirect, which is only tested on the test device.

---

Changes since v1:
- only calculate the block size once, based on a code snipplet from Zorro Lang

 tests/generic/366 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
tests/generic/366 +12 -2
index 271a01bc2eac..cb183c1bfe21 100755
@@ -20,7 +20,7 @@ _begin_fstest auto quick rw
 . ./common/filter
 
 _require_scratch
-_require_odirect 512	# see fio job1 config below
+_require_odirect
 _require_aio
 
 _fixed_by_fs_commit btrfs xxxxxxxxxxxx \
@@ -30,7 +30,7 @@ iterations=$((32 * LOAD_FACTOR))
 
 fio_config=$tmp.fio
 fio_out=$tmp.fio.out
-blksz=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
+
 cat >$fio_config <<EOF
 [global]
 bs=8k
@@ -57,9 +57,19 @@ filename=file1
 EOF
 _require_fio $fio_config
 
+blksz=""
+
 for (( i = 0; i < $iterations; i++)); do
 	_scratch_mkfs >>$seqres.full 2>&1
 	_scratch_mount
+
+	if [ -z "$blksz" ]; then
+		blksz=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
+		if [[ $blksz -gt 512 ]]; then
+			_notrun "512 byte dio alignment required"
+		fi
+	fi
+
 	# 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
 	# at here.
Signature · 1 line
2.53.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Christoph Hellwig

min_dio_alignment requires the file system to be checked to be mounted, so move the call into the main loop. Drop the pointless blocksize argument to _require_odirect, which is only tested on the test device.

---

Changes since v1:
- only calculate the block size once, based on a code snipplet from Zorro Lang

Thanks Christoph, this version is good to me

Quoted 49 lines
 tests/generic/366 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
tests/generic/366 +12 -2
index 271a01bc2eac..cb183c1bfe21 100755
@@ -20,7 +20,7 @@ _begin_fstest auto quick rw
 . ./common/filter
 
 _require_scratch
-_require_odirect 512	# see fio job1 config below
+_require_odirect
 _require_aio
 
 _fixed_by_fs_commit btrfs xxxxxxxxxxxx \
@@ -30,7 +30,7 @@ iterations=$((32 * LOAD_FACTOR))
 
 fio_config=$tmp.fio
 fio_out=$tmp.fio.out
-blksz=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
+
 cat >$fio_config <<EOF
 [global]
 bs=8k
@@ -57,9 +57,19 @@ filename=file1
 EOF
 _require_fio $fio_config
 
+blksz=""
+
 for (( i = 0; i < $iterations; i++)); do
 	_scratch_mkfs >>$seqres.full 2>&1
 	_scratch_mount
+
+	if [ -z "$blksz" ]; then
+		blksz=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
+		if [[ $blksz -gt 512 ]]; then
+			_notrun "512 byte dio alignment required"
+		fi
+	fi
+
 	# 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
 	# at here.
Signature · 1 line
2.53.0