]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
common/rc: move _check_f2fs_filesystem() to common/f2fs
authorChao Yu <chao@kernel.org>
Thu, 9 Oct 2025 08:50:42 +0000 (16:50 +0800)
committerZorro Lang <zlang@kernel.org>
Fri, 17 Oct 2025 16:53:53 +0000 (00:53 +0800)
_check_f2fs_filesystem() is f2fs specific, it's better to move it to
common/f2fs.

Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Chao Yu <chao@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/f2fs
common/rc

index 1b39d8cebfc09bbbd80e196a3d941d0ebba3d8c8..4d0d688b0d7f9a0b7467665006cc3558cfca2e40 100644 (file)
@@ -25,3 +25,47 @@ _require_scratch_f2fs_compression()
                _scratch_unmount
        fi
 }
+
+_check_f2fs_filesystem()
+{
+    local device=$1
+
+    # If type is set, we're mounted
+    local type=`_fs_type $device`
+    local ok=1
+
+    if [ "$type" = "f2fs" ]
+    then
+        # mounted ...
+        local mountpoint=`_umount_or_remount_ro $device`
+    fi
+
+    $F2FS_FSCK_PROG --dry-run $device >$tmp.fsck.f2fs 2>&1
+    if [ $? -ne 0 ];then
+        _log_err "_check_f2fs_filesystem: filesystem on $device is inconsistent"
+        echo "*** fsck.f2fs output ***" >>$seqres.full
+        cat $tmp.fsck.f2fs              >>$seqres.full
+        echo "*** end fsck.f2fs output" >>$seqres.full
+
+    ok=0
+    fi
+    rm -f $tmp.fsck.f2fs
+
+    if [ $ok -eq 0 ]
+    then
+        echo "*** mount output ***"            >>$seqres.full
+        _mount                                 >>$seqres.full
+        echo "*** end mount output"            >>$seqres.full
+    elif [ "$type" = "f2fs" ]
+    then
+       # was mounted ...
+       _mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint
+       ok=$?
+    fi
+
+    if [ $ok -eq 0 ]; then
+       return 1
+    fi
+
+    return 0
+}
index 1ec84263c917c08c23752f1a88f0cd42106abf24..4d121a1bda196e4e59aefb7953b11dd1ac8cee84 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -3566,50 +3566,6 @@ _check_generic_filesystem()
     return 0
 }
 
-_check_f2fs_filesystem()
-{
-    local device=$1
-
-    # If type is set, we're mounted
-    local type=`_fs_type $device`
-    local ok=1
-
-    if [ "$type" = "f2fs" ]
-    then
-        # mounted ...
-        local mountpoint=`_umount_or_remount_ro $device`
-    fi
-
-    $F2FS_FSCK_PROG --dry-run $device >$tmp.fsck.f2fs 2>&1
-    if [ $? -ne 0 ];then
-        _log_err "_check_f2fs_filesystem: filesystem on $device is inconsistent"
-        echo "*** fsck.f2fs output ***" >>$seqres.full
-        cat $tmp.fsck.f2fs              >>$seqres.full
-        echo "*** end fsck.f2fs output" >>$seqres.full
-
-    ok=0
-    fi
-    rm -f $tmp.fsck.f2fs
-
-    if [ $ok -eq 0 ]
-    then
-        echo "*** mount output ***"            >>$seqres.full
-        _mount                                 >>$seqres.full
-        echo "*** end mount output"            >>$seqres.full
-    elif [ "$type" = "f2fs" ]
-    then
-       # was mounted ...
-       _mount_or_remount_rw "$MOUNT_OPTIONS" $device $mountpoint
-       ok=$?
-    fi
-
-    if [ $ok -eq 0 ]; then
-       return 1
-    fi
-
-    return 0
-}
-
 # Filter the knowen errors the UDF Verifier reports.
 _udf_test_known_error_filter()
 {