]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
f2fs/012: adapt lookup_mode=x mount option v2025.08.17
authorChao Yu <chao@kernel.org>
Sat, 16 Aug 2025 07:29:09 +0000 (15:29 +0800)
committerZorro Lang <zlang@kernel.org>
Sun, 17 Aug 2025 08:44:05 +0000 (16:44 +0800)
w/ below change [1], f2fs will enable lookup_mode=perf by default, it
will change f2fs dirent lookup method from linear based lookup to hash
based lookup.

So that, f2fs will ignore sb.s_encoding_flags by default, which is not
compatible w/ f2fs/012 testcase, in where it will control lookup method
by configuring this flag w/ fsck.f2fs.

To avoid failure of f2fs/012, let's check whether f2fs has supported
"lookup_mode=auto" mount option, mount w/ the option if it can,
otherwise, don't.

[1] https://lore.kernel.org/linux-f2fs-devel/20250805065228.1473089-1-chullee@google.com

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Daniel Lee <chullee@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/f2fs/012

index b3df9a8f58844f9baba2be3ca6e903eeec8a93d0..7438d9ced40ddad2cabfd1c318d71ab9e1bb85a3 100755 (executable)
@@ -22,6 +22,15 @@ _require_scratch_nocheck
 _require_command "$F2FS_IO_PROG" f2fs_io
 _require_command "$F2FS_INJECT_PROG" inject.f2fs
 
+#check whether f2fs supports "lookup_mode=x" mount option
+mntopt=""
+_scratch_mkfs -O casefold -C utf8 >> $seqres.full
+_try_scratch_mount "-o lookup_mode=auto" >> $seqres.full 2>&1
+if [ $? == 0 ]; then
+       mntopt="-o lookup_mode=auto"
+       _scratch_unmount
+fi
+
 check_lookup()
 {
        local nolinear_lookup=$1
@@ -30,7 +39,7 @@ check_lookup()
        local redheart=$dir/$'\u2764\ufe0f'
 
        _scratch_mkfs -O casefold -C utf8 >> $seqres.full
-       _scratch_mount
+       _scratch_mount $mntopt
 
        mkdir $dir
        $F2FS_IO_PROG setflags casefold $dir >> $seqres.full
@@ -52,7 +61,7 @@ check_lookup()
 
        $F2FS_INJECT_PROG --dent --mb d_hash --nid $ino --val 0x9a2ea068 $SCRATCH_DEV >> $seqres.full
 
-       _scratch_mount
+       _scratch_mount $mntopt
        if [ $nolinear_lookup == "1" ]; then
                [ -f $redheart ] && _fail "red heart file should not exist"
        else