Skip to contentSkip to conversation

ext4/045: skip test if the block size is 1k

PATCH In review Theodore Ts'o 2 participants 6 messages Jun 11, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ext4/045: skip test if the block size is 1k

If the file system is 1k, this test will fail because with dir_index enabled, the directory tree will get too deep, and the kernel will return ENOSPC and log the EXT4-fs warning "Directory (ino: NNN) index full, reach max htree level: 2". So if the blocksize is less than 2k, _notrun this test.

---
 tests/ext4/045 | 4 ++++
 1 file changed, 4 insertions(+)
tests/ext4/045 +4 -0
index 4f0ad4aa7..5ae7a45b5 100755
@@ -44,6 +44,10 @@ workout()
 
        _scratch_mkfs "-O extent,dir_nlink,dir_index -I 256" >> $seqres.full 2>&1
        _scratch_mount
+       blocksize=$(_get_block_size $SCRATCH_MNT)
+       if [ "$blocksize" -lt 2048 ]; then
+	   _notrun "blocksize $blocksize, too small"
+       fi
 
        # create directories
        mkdir -p $3 2> /dev/null
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 generic/455: skip the test if the file system doesn't support journaling

This test uses dm-log-writes to test power fail scenarios, so it won't work if the file system doesn't support metadata journaling.

---
 tests/generic/455 | 7 +++++++
 1 file changed, 7 insertions(+)
tests/generic/455 +7 -0
index da803de08..75437b90d 100755
@@ -65,6 +65,13 @@ _log_writes_init $DMTHIN_VOL_DEV
 
 _log_writes_mkfs >> $seqres.full 2>&1
 
+# This test requires metadata journaling since it simulates a power failure
+msg=$(_has_metadata_journaling "$LOGWRITES_DMDEV")
+if [ -n "$msg" ]; then
+    _log_writes_remove
+    _notrun "$msg"
+fi
+
 # Log writes emulates discard support, turn it on for maximum crying.
 _log_writes_mount -o discard
 
Signature · 1 line
2.43.0
#2 lore raw

Re: [PATCH 2/2] generic/455: skip the test if the file system doesn't support journaling

Quoted 13 lines · Theodore Ts'o

This test uses dm-log-writes to test power fail scenarios, so it won't work if the file system doesn't support metadata journaling.

---
 tests/generic/455 | 7 +++++++
 1 file changed, 7 insertions(+)
tests/generic/455 +0 -0
index da803de08..75437b90d 100755

tests/generic/455 _log_writes_init $DMTHIN_VOL_DEV · line 73

Quoted 9 lines
tests/generic/455 +6 -0
@@ -65,6 +65,13 @@ _log_writes_init $DMTHIN_VOL_DEV
 
 _log_writes_mkfs >> $seqres.full 2>&1
 
+# This test requires metadata journaling since it simulates a power failure
+msg=$(_has_metadata_journaling "$LOGWRITES_DMDEV")
+if [ -n "$msg" ]; then
+    _log_writes_remove
+    _notrun "$msg"
+fi

_require_metadata_journaling $LOGWRITES_DMDEV ?

afaict the _cleanup() function will call _log_writes_cleanup -> _log_writes_remove for you.

--D

Quoted 8 lines
tests/generic/455 +1 -0
+
 # Log writes emulates discard support, turn it on for maximum crying.
 _log_writes_mount -o discard
 
Signature · 1 line
2.43.0
#3 lore raw

Re: [PATCH 2/2] generic/455: skip the test if the file system doesn't support journaling

Quoted 5 lines · Darrick J. Wong

_require_metadata_journaling $LOGWRITES_DMDEV ?

afaict the _cleanup() function will call _log_writes_cleanup -> _log_writes_remove for you.

Good point, I had forgotten that rely on the _cleanup handling. I'll fix that in the next version of these patches.

- Ted

#4 lore raw
In reply to Theodore Ts'o
Quoted 5 lines · Theodore Ts'o

If the file system is 1k, this test will fail because with dir_index enabled, the directory tree will get too deep, and the kernel will return ENOSPC and log the EXT4-fs warning "Directory (ino: NNN) index full, reach max htree level: 2". So if the blocksize is less than 2k, _notrun this test.

Didn't ext4 recently gain support for 3-level htrees?

--D

Quoted 24 lines
---
 tests/ext4/045 | 4 ++++
 1 file changed, 4 insertions(+)
tests/ext4/045 +4 -0
index 4f0ad4aa7..5ae7a45b5 100755
@@ -44,6 +44,10 @@ workout()
 
        _scratch_mkfs "-O extent,dir_nlink,dir_index -I 256" >> $seqres.full 2>&1
        _scratch_mount
+       blocksize=$(_get_block_size $SCRATCH_MNT)
+       if [ "$blocksize" -lt 2048 ]; then
+	   _notrun "blocksize $blocksize, too small"
+       fi
 
        # create directories
        mkdir -p $3 2> /dev/null
Signature · 1 line
2.43.0
#5 lore raw
Quoted 8 lines · Darrick J. Wong
Quoted 5 lines · Theodore Ts'o

If the file system is 1k, this test will fail because with dir_index enabled, the directory tree will get too deep, and the kernel will return ENOSPC and log the EXT4-fs warning "Directory (ino: NNN) index full, reach max htree level: 2". So if the blocksize is less than 2k, _notrun this test.

Didn't ext4 recently gain support for 3-level htrees?

Ext4 has support for a while, but it's an optional feature which is not enabled by default. I suppose we could try to set the feature, and skip the test if the kernel doesn't support it. (Or decide that no one cares about RHEL7, and just YOLO, since who else still cares about kernels older than 4.13? :-)

I'm just not sure whether it's worth the extra complexity to do it, but for those people who care about code coverage statistics, it would help a tiny amount....

- Ted