Skip to contentSkip to conversation

common/config: support f2fs-tools v1.9 and later

PATCH In review Eric Biggers 3 participants 3 messages Apr 5, 2018 – Apr 9, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/config: 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.

---
 common/config | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
common/config +6 -5
index 20f0e5f3..7c046a78 100644
@@ -94,10 +94,11 @@ set_prog_path()
 	type -P $1
 }
 
-# Handle mkfs.btrfs which does (or does not) require -f to overwrite
-set_btrfs_mkfs_prog_path_with_opts()
+# Handle mkfs.$fstyp which does (or does not) require -f to overwrite
+set_mkfs_prog_path_with_opts()
 {
-	p=`set_prog_path mkfs.btrfs`
+	local fstyp=$1
+	local p=`set_prog_path mkfs.$fstyp`
 	if [ "$p" != "" ] && grep -q 'force overwrite' $p; then
 		echo "$p -f"
 	else
@@ -223,8 +224,8 @@ case "$HOSTOS" in
         export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
         export MKFS_EXT4_PROG="`set_prog_path mkfs.ext4`"
         export MKFS_UDF_PROG="`set_prog_path mkudffs`"
-        export MKFS_BTRFS_PROG="`set_btrfs_mkfs_prog_path_with_opts`"
-        export MKFS_F2FS_PROG="`set_prog_path mkfs.f2fs`"
+        export MKFS_BTRFS_PROG="`set_mkfs_prog_path_with_opts btrfs`"
+        export MKFS_F2FS_PROG="`set_mkfs_prog_path_with_opts f2fs`"
         export DUMP_F2FS_PROG="`set_prog_path dump.f2fs`"
         export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
         export BTRFS_SHOW_SUPER_PROG="`set_prog_path btrfs-show-super`"
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.

Looks fine to me, but I'd like an ACK from f2fs developers.

Quoted 11 lines
---
 common/config | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
common/config +0 -0
index 20f0e5f3..7c046a78 100644
@@ -94,10 +94,11 @@ set_prog_path()
 	type -P $1
 }

common/config set_prog_path() · line 102

Quoted 10 lines
common/config +4 -3
 
-# Handle mkfs.btrfs which does (or does not) require -f to overwrite
-set_btrfs_mkfs_prog_path_with_opts()
+# Handle mkfs.$fstyp which does (or does not) require -f to overwrite
+set_mkfs_prog_path_with_opts()
 {
-	p=`set_prog_path mkfs.btrfs`
+	local fstyp=$1
+	local p=`set_prog_path mkfs.$fstyp`
 	if [ "$p" != "" ] && grep -q 'force overwrite' $p; then

Also grep the "$p -h" output instead of the binary file?

Thanks,
Eryu

Quoted 20 lines
common/config +2 -2
 		echo "$p -f"
 	else
@@ -223,8 +224,8 @@ case "$HOSTOS" in
         export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
         export MKFS_EXT4_PROG="`set_prog_path mkfs.ext4`"
         export MKFS_UDF_PROG="`set_prog_path mkudffs`"
-        export MKFS_BTRFS_PROG="`set_btrfs_mkfs_prog_path_with_opts`"
-        export MKFS_F2FS_PROG="`set_prog_path mkfs.f2fs`"
+        export MKFS_BTRFS_PROG="`set_mkfs_prog_path_with_opts btrfs`"
+        export MKFS_F2FS_PROG="`set_mkfs_prog_path_with_opts f2fs`"
         export DUMP_F2FS_PROG="`set_prog_path dump.f2fs`"
         export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
         export BTRFS_SHOW_SUPER_PROG="`set_prog_path btrfs-show-super`"
Signature · 6 lines
2.17.0.484.g0c8726318c-goog

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Acked-by
#2 lore raw
Quoted 9 lines · Eryu Guan
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.

Looks fine to me, but I'd like an ACK from f2fs developers.

Thanks,

Quoted 54 lines
Quoted 12 lines
---
 common/config | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
common/config +0 -0
index 20f0e5f3..7c046a78 100644
@@ -94,10 +94,11 @@ set_prog_path()
 	type -P $1
 }

common/config set_prog_path() · line 102

Quoted 10 lines
common/config +4 -3
 
-# Handle mkfs.btrfs which does (or does not) require -f to overwrite
-set_btrfs_mkfs_prog_path_with_opts()
+# Handle mkfs.$fstyp which does (or does not) require -f to overwrite
+set_mkfs_prog_path_with_opts()
 {
-	p=`set_prog_path mkfs.btrfs`
+	local fstyp=$1
+	local p=`set_prog_path mkfs.$fstyp`
 	if [ "$p" != "" ] && grep -q 'force overwrite' $p; then

Also grep the "$p -h" output instead of the binary file?

Thanks,
Eryu

Quoted 20 lines
common/config +2 -2
 		echo "$p -f"
 	else
@@ -223,8 +224,8 @@ case "$HOSTOS" in
         export MKFS_XFS_PROG="`set_prog_path mkfs.xfs`"
         export MKFS_EXT4_PROG="`set_prog_path mkfs.ext4`"
         export MKFS_UDF_PROG="`set_prog_path mkudffs`"
-        export MKFS_BTRFS_PROG="`set_btrfs_mkfs_prog_path_with_opts`"
-        export MKFS_F2FS_PROG="`set_prog_path mkfs.f2fs`"
+        export MKFS_BTRFS_PROG="`set_mkfs_prog_path_with_opts btrfs`"
+        export MKFS_F2FS_PROG="`set_mkfs_prog_path_with_opts f2fs`"
         export DUMP_F2FS_PROG="`set_prog_path dump.f2fs`"
         export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
         export BTRFS_SHOW_SUPER_PROG="`set_prog_path btrfs-show-super`"
Signature · 6 lines
2.17.0.484.g0c8726318c-goog

--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html