Skip to contentSkip to conversation

generic/366: check minimum dio size correctly

PATCH Superseded Christoph Hellwig 2 participants 6 messages Jun 8 – Jun 16

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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.

---
 tests/generic/366 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tests/generic/366 +8 -2
index 271a01bc2eac..ef69bf09d6ff 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
@@ -60,6 +60,12 @@ _require_fio $fio_config
 for (( i = 0; i < $iterations; i++)); do
 	_scratch_mkfs >>$seqres.full 2>&1
 	_scratch_mount
+
+	blksz=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
+	if [[ $blksz -gt 512 ]]; then
+		_notrun "512 byte dio alignment required"
+	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
#1 lore raw
Quoted 32 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.

---
 tests/generic/366 | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
tests/generic/366 +2 -2
index 271a01bc2eac..ef69bf09d6ff 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

tests/generic/366 _require_fio $fio_config · line 67

Quoted 8 lines
tests/generic/366 +5 -0
@@ -60,6 +60,12 @@ _require_fio $fio_config
 for (( i = 0; i < $iterations; i++)); do
 	_scratch_mkfs >>$seqres.full 2>&1
 	_scratch_mount
+
+	blksz=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
+	if [[ $blksz -gt 512 ]]; then
+		_notrun "512 byte dio alignment required"
+	fi

Do we need to check this in every iteration?

Quoted 7 lines
tests/generic/366 +1 -0
+
 	# 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
#2 lore raw
Quoted 6 lines · Zorro Lang

tests/generic/366 _require_fio $fio_config · line 67

Quoted 4 lines
tests/generic/366 +4 -0
+	blksz=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
+	if [[ $blksz -gt 512 ]]; then
+		_notrun "512 byte dio alignment required"
+	fi

Do we need to check this in every iteration?

We don't, but we also don't want to do an extra mount just to check the feature.

#3 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 6 lines · Zorro Lang

tests/generic/366 _require_fio $fio_config · line 67

Quoted 4 lines
tests/generic/366 +4 -0
+	blksz=`$here/src/min_dio_alignment $SCRATCH_MNT $SCRATCH_DEV`
+	if [[ $blksz -gt 512 ]]; then
+		_notrun "512 byte dio alignment required"
+	fi

Do we need to check this in every iteration?

We don't, but we also don't want to do an extra mount just to check the feature.

Oh, if we only need to run it once, how about:

blksz=""
for (( i = 0; i < $iterations; i++)); do

    ...
    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

...

Thanks,
Zorro

Quoted 2 lines
#4 lore raw
Quoted 4 lines · Zorro Lang

Oh, if we only need to run it once, how about:

blksz=""
for (( i = 0; i < $iterations; i++)); do

Quoted 8 lines
    ...
    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

...

I can look into it. But to me this doesn't really seem worth the effort as calling min_dio_alignment is so cheap compared to the mount/unmount cycle never mind everything else we do in the loop.

#5 lore raw
Quoted 14 lines · Christoph Hellwig
Quoted 4 lines · Zorro Lang

Oh, if we only need to run it once, how about:

blksz=""
for (( i = 0; i < $iterations; i++)); do

Quoted 8 lines
    ...
    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

...

Quoted 3 lines

I can look into it. But to me this doesn't really seem worth the effort as calling min_dio_alignment is so cheap compared to the mount/unmount cycle never mind everything else we do in the loop.

Sure Christoph :) If you feel that's a bit of a time sink, we could also just add a comment explaining that re-checking the DIO alignment on every iteration isn't strictly necessary. I'm just concerned that future developers might mistake it for a hard requirement when modifying this test.

Thanks,
Zorro

Quoted 1 line