Skip to contentSkip to conversation

ext4/045: use the large_dir feature to fix test failures with a 1k block size

PATCH In review Theodore Ts'o 2 participants 4 messages Jun 11, 2024 – Jun 17, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ext4/045: use the large_dir feature to fix test failures with a 1k block size

If the file system has a 1k blocksize, this test will fail without the large_dir file system, because the depth of the dir_index tree needs to be greater than 2. So enable the large_dir unconditionally, which also gives us better test coverage of the large_dir code paths.

As a result of requiring large_dir, this test will get skipped if the kernel is older than 4.13 --- which was released in 2017; and that seems to be reasonable at this point.

---
 tests/ext4/045 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/ext4/045 +2 -1
index 4f0ad4aa7..a90ae1ba3 100755
@@ -20,6 +20,7 @@ LONG_DIR=2
 _supported_fs ext4
 
 _require_scratch
+_require_scratch_ext4_feature large_dir
 _require_test_program "t_create_short_dirs"
 _require_test_program "t_create_long_dirs"
 _require_dumpe2fs
@@ -42,7 +43,7 @@ workout()
        echo "Num of dirs to create: $1, Dir name len: $dir_name_len, " \
                "Parent dir: $3" >> $seqres.full
 
-       _scratch_mkfs "-O extent,dir_nlink,dir_index -I 256" >> $seqres.full 2>&1
+       _scratch_mkfs "-O extent,dir_nlink,dir_index,large_dir -I 256" >> $seqres.full 2>&1
        _scratch_mount
 
        # create directories
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 | 3 +++
 1 file changed, 3 insertions(+)
tests/generic/455 +3 -0
index da803de08..6dce8a659 100755
@@ -65,6 +65,9 @@ _log_writes_init $DMTHIN_VOL_DEV
 
 _log_writes_mkfs >> $seqres.full 2>&1
 
+# This test requires metadata journaling since it simulates a power failure
+_require_metadata_journaling "$LOGWRITES_DMDEV"
+
 # Log writes emulates discard support, turn it on for maximum crying.
 _log_writes_mount -o discard
 
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH -v2 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 | 3 +++
 1 file changed, 3 insertions(+)
tests/generic/455 +0 -0
index da803de08..6dce8a659 100755

tests/generic/455 _log_writes_init $DMTHIN_VOL_DEV · line 69

Quoted 5 lines
tests/generic/455 +2 -0
@@ -65,6 +65,9 @@ _log_writes_init $DMTHIN_VOL_DEV
 
 _log_writes_mkfs >> $seqres.full 2>&1
 
+# This test requires metadata journaling since it simulates a power failure
+_require_metadata_journaling "$LOGWRITES_DMDEV"

Good to me, Thanks!

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
Reviewed-by on v1 1/2
#3 lore raw
In reply to Theodore Ts'o
Quoted 8 lines · Theodore Ts'o

If the file system has a 1k blocksize, this test will fail without the large_dir file system, because the depth of the dir_index tree needs to be greater than 2. So enable the large_dir unconditionally, which also gives us better test coverage of the large_dir code paths.

As a result of requiring large_dir, this test will get skipped if the kernel is older than 4.13 --- which was released in 2017; and that seems to be reasonable at this point.

Makes sense to me,

Quoted 35 lines
---
 tests/ext4/045 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/ext4/045 +2 -1
index 4f0ad4aa7..a90ae1ba3 100755
@@ -20,6 +20,7 @@ LONG_DIR=2
 _supported_fs ext4
 
 _require_scratch
+_require_scratch_ext4_feature large_dir
 _require_test_program "t_create_short_dirs"
 _require_test_program "t_create_long_dirs"
 _require_dumpe2fs
@@ -42,7 +43,7 @@ workout()
        echo "Num of dirs to create: $1, Dir name len: $dir_name_len, " \
                "Parent dir: $3" >> $seqres.full
 
-       _scratch_mkfs "-O extent,dir_nlink,dir_index -I 256" >> $seqres.full 2>&1
+       _scratch_mkfs "-O extent,dir_nlink,dir_index,large_dir -I 256" >> $seqres.full 2>&1
 
 
 

_scratch_mount

# create directories

Signature · 1 line
2.43.0