Skip to contentSkip to conversation

test-appliance: support f2fs-tools v1.9 and later

PATCH Superseded Eric Biggers 2 participants 3 messages Apr 5, 2018 – Apr 9, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test-appliance: support f2fs-tools v1.9 and later

Pass the -f option to mkfs.f2fs when it appears to support it. This is required by f2fs-tools v1.9 and later in order to format the filesystem even when an existing filesystem is detected. But earlier versions did not accept this option.

---
 kvm-xfstests/test-appliance/files/root/fs/f2fs/config | 4 ++++
 1 file changed, 4 insertions(+)
kvm-xfstests/test-appliance/files/root/fs/f2fs/config +4 -0
index 45fb2dd..0efcb76 100644
@@ -20,6 +20,10 @@ function format_filesystem()
     local dev="$1"
     local opts="$2"
 
+    if grep -q 'force overwrite' /sbin/mkfs.f2fs; then
+	# f2fs-tools v1.9+
+	opts+=" -f"
+    fi
     /sbin/mkfs.f2fs -q $opts "$dev"
     return $?
 }
Signature · 1 line
2.17.0.484.g0c8726318c-goog
#1 lore raw
Quoted 6 lines · Eric Biggers

Pass the -f option to mkfs.f2fs when it appears to support it. This is required by f2fs-tools v1.9 and later in order to format the filesystem even when an existing filesystem is detected. But earlier versions did not accept this option.

Applied for now, but ugh. Grepping strings out of binaries is not something I really like to depend upon. Can we convince the f2fs folks to provide a "/sbin/mkfs.f2fs -V" which prints a version string, or some such?

- Ted

#2 lore raw
Quoted 6 lines · Theodore Y. Ts'o
Quoted 5 lines · Eric Biggers

Pass the -f option to mkfs.f2fs when it appears to support it. This is required by f2fs-tools v1.9 and later in order to format the filesystem even when an existing filesystem is detected. But earlier versions did not accept this option.

Quoted 7 lines
Quoted 1 line

Applied for now, but ugh. Grepping strings out of binaries is not something I really like to depend upon. Can we convince the f2fs folks to provide a "/sbin/mkfs.f2fs -V" which prints a version string, or some such?

Yes, it's ugly. As something maybe a bit better, I've proposed

	mkfs.f2fs --help |& grep -q "[[:space:]]-f[[:space:]|]"

in v2 of the xfstests patch to common/config. So if that gets accepted into xfstests I'll change this to use the same method.

Thanks,

Eric