common/config: source common/f2fs in _source_specific_fs()
PATCH 1/3 common/config: source common/f2fs in _source_specific_fs()
Let's source common/f2fs in _source_specific_fs() instead of in each testcase.
--- common/config | 1 + tests/f2fs/002 | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)
common/config +1 -0
@@ -509,6 +509,7 @@ _source_specific_fs() ;; f2fs) [ "$MKFS_F2FS_PROG" = "" ] && _fatal "mkfs.f2fs not found" + . ./common/f2fs ;; nfs) . ./common/nfs
tests/f2fs/002 +0 -1
@@ -43,7 +43,6 @@ _begin_fstest auto quick rw encrypt compress fiemap . ./common/filter -. ./common/f2fs . ./common/encrypt # Prerequisites to create a file that is both encrypted and LZ4-compressed
Signature · 1 line
2.40.1
PATCH 2/3 common/rc: move _check_f2fs_filesystem() to common/f2fs
_check_f2fs_filesystem() is f2fs specific, it's better to move it to common/f2fs.
--- common/f2fs | 44 ++++++++++++++++++++++++++++++++++++++++++++ common/rc | 44 -------------------------------------------- 2 files changed, 44 insertions(+), 44 deletions(-)
common/f2fs +44 -0
@@ -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 +}
common/rc +0 -44
50 lines not on this page · raw message
Signature · 1 line
2.40.1
PATCH 3/3 common/f2fs: introduce _require_inject_f2fs_command()
In reply to Chao YuIntroduce _require_inject_f2fs_command() to check whether inject.f2fs supports specific metaarea and member parameters.
Meanwhile, let's check inject.f2fs requirement inside _require_inject_f2fs_command() for cleanup.
--- common/f2fs | 27 +++++++++++++++++++++++++++ tests/f2fs/009 | 2 +- tests/f2fs/012 | 2 +- tests/f2fs/019 | 2 +- tests/f2fs/020 | 2 +- tests/f2fs/022 | 2 +- 6 files changed, 32 insertions(+), 5 deletions(-)
common/f2fs +27 -0
@@ -69,3 +69,30 @@ _check_f2fs_filesystem() return 0 } + +# check that inject.f2fs supports to inject specific field in specific meta area +_require_inject_f2fs_command() +{ + _require_command "$F2FS_INJECT_PROG" inject.f2fs + + if [ $# -ne 2 ]; then + echo "Usage: _require_inject_f2fs_command metaarea member" 1>&2 + _exit 1 + fi + metaarea=$1 + member=$2 + + case $metaarea in + sb|cp|nat|sit) + val=0 + ;; + ssa|node|dent) + ;; + *) + _notrun "unsupport metaarea: $metaarea" + ;; + esac + + $F2FS_INJECT_PROG "--$metaarea" "$val" "-h" | grep "$member:" > /dev/null || \ + _notrun "--$metaarea --mb $member support is missing" +}
tests/f2fs/009 +1 -1
@@ -12,7 +12,7 @@ _begin_fstest auto quick _require_scratch -_require_command "$F2FS_INJECT_PROG" inject.f2fs +_require_inject_f2fs_command node i_links _require_command "$(type -P socket)" socket _fixed_by_git_commit f2fs-tools 958cd6e \
tests/f2fs/012 +1 -1
@@ -20,7 +20,7 @@ _fixed_by_kernel_commit 91b587ba79e1 \ export LC_ALL=C.UTF-8 _require_scratch_nocheck _require_command "$F2FS_IO_PROG" f2fs_io -_require_command "$F2FS_INJECT_PROG" inject.f2fs +_require_inject_f2fs_command dent d_hash #check whether f2fs supports "lookup_mode=x" mount option mntopt=""
tests/f2fs/019 +1 -1
@@ -18,7 +18,7 @@ _fixed_by_kernel_commit 77de19b6867f \ "f2fs: fix to avoid out-of-boundary access in dnode page" _require_scratch_nocheck -_require_command "$F2FS_INJECT_PROG" inject.f2fs +_require_inject_f2fs_command node addr # remove all mkfs options to avoid layout change of on-disk inode export MKFS_OPTIONS=""
tests/f2fs/020 +1 -1
@@ -20,7 +20,7 @@ _fixed_by_kernel_commit 061cf3a84bde \ "f2fs: fix to do sanity check on ino and xnid" _require_scratch_nocheck -_require_command "$F2FS_INJECT_PROG" inject.f2fs +_require_inject_f2fs_command node i_xattr_nid _require_attrs user # remove all mkfs options to avoid layout change of on-disk inode
tests/f2fs/022 +1 -1
@@ -19,7 +19,7 @@ _fixed_by_kernel_commit xxxxxxxxxxxx \ "f2fs: fix to do sanity check on node footer for non inode dnode" _require_scratch_nocheck -_require_command "$F2FS_INJECT_PROG" inject.f2fs +_require_inject_f2fs_command node i_nid # remove all mkfs options to avoid layout change of on-disk inode export MKFS_OPTIONS=""
Signature · 1 line
2.40.1
Quoted 6 lines · Chao Yu
Let's source common/f2fs in
_source_specific_fs()instead of in each testcase.Cc Jaegeuk Kim <[email protected]>Signed-off-by Chao Yu <[email protected]>---
Make sense to me, thanks for fixing it.
Quoted 31 lines
common/config | 1 + tests/f2fs/002 | 1 - 2 files changed, 1 insertion(+), 1 deletion(-)common/config +1
-0@@ -509,6 +509,7 @@ _source_specific_fs() ;; f2fs) [ "$MKFS_F2FS_PROG" = "" ] && _fatal "mkfs.f2fs not found" + . ./common/f2fs ;; nfs) . ./common/nfstests/f2fs/002 +0
-1@@ -43,7 +43,6 @@ _begin_fstest auto quick rw encrypt compress fiemap . ./common/filter -. ./common/f2fs . ./common/encrypt # Prerequisites to create a file that is both encrypted and LZ4-compressedSignature · 1 line
2.40.1
Re: [PATCH 2/3] common/rc: move _check_f2fs_filesystem() to common/f2fs
In reply to Chao YuQuoted 6 lines · Chao Yu
_check_f2fs_filesystem()is f2fs specific, it's better to move it to common/f2fs.Cc Jaegeuk Kim <[email protected]>Signed-off-by Chao Yu <[email protected]>---
Looks good to me. With the patch 1/3, this change should work for f2fs too.
Quoted 114 lines
common/f2fs | 44 ++++++++++++++++++++++++++++++++++++++++++++ common/rc | 44 -------------------------------------------- 2 files changed, 44 insertions(+), 44 deletions(-)common/f2fs +44
-0@@ -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 +}common/rc +0
-44@@ -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() {Signature · 1 line
2.40.1
Re: [PATCH 3/3] common/f2fs: introduce _require_inject_f2fs_command()
In reply to Chao YuQuoted 9 lines · Chao Yu
Introduce
_require_inject_f2fs_command()to check whether inject.f2fs supports specific metaarea and member parameters.Meanwhile, let's check inject.f2fs requirement inside
_require_inject_f2fs_command()for cleanup.Cc Jaegeuk Kim <[email protected]>Signed-off-by Chao Yu <[email protected]>---
Thanks, this version is good to me,
Quoted 111 lines
common/f2fs | 27 +++++++++++++++++++++++++++ tests/f2fs/009 | 2 +- tests/f2fs/012 | 2 +- tests/f2fs/019 | 2 +- tests/f2fs/020 | 2 +- tests/f2fs/022 | 2 +- 6 files changed, 32 insertions(+), 5 deletions(-)common/f2fs +27
-0@@ -69,3 +69,30 @@ _check_f2fs_filesystem() return 0 } + +# check that inject.f2fs supports to inject specific field in specific meta area +_require_inject_f2fs_command() +{ + _require_command "$F2FS_INJECT_PROG" inject.f2fs + + if [ $# -ne 2 ]; then + echo "Usage: _require_inject_f2fs_command metaarea member" 1>&2 + _exit 1 + fi + metaarea=$1 + member=$2 + + case $metaarea in + sb|cp|nat|sit) + val=0 + ;; + ssa|node|dent) + ;; + *) + _notrun "unsupport metaarea: $metaarea" + ;; + esac + + $F2FS_INJECT_PROG "--$metaarea" "$val" "-h" | grep "$member:" > /dev/null || \ + _notrun "--$metaarea --mb $member support is missing" +}tests/f2fs/009 +1
-1@@ -12,7 +12,7 @@ _begin_fstest auto quick _require_scratch -_require_command "$F2FS_INJECT_PROG" inject.f2fs +_require_inject_f2fs_command node i_links _require_command "$(type -P socket)" socket _fixed_by_git_commit f2fs-tools 958cd6e \tests/f2fs/012 +1
-1@@ -20,7 +20,7 @@ _fixed_by_kernel_commit 91b587ba79e1 \ export LC_ALL=C.UTF-8 _require_scratch_nocheck _require_command "$F2FS_IO_PROG" f2fs_io -_require_command "$F2FS_INJECT_PROG" inject.f2fs +_require_inject_f2fs_command dent d_hash #check whether f2fs supports "lookup_mode=x" mount option mntopt=""tests/f2fs/019 +1
-1@@ -18,7 +18,7 @@ _fixed_by_kernel_commit 77de19b6867f \ "f2fs: fix to avoid out-of-boundary access in dnode page" _require_scratch_nocheck -_require_command "$F2FS_INJECT_PROG" inject.f2fs +_require_inject_f2fs_command node addr # remove all mkfs options to avoid layout change of on-disk inode export MKFS_OPTIONS=""tests/f2fs/020 +1
-1@@ -20,7 +20,7 @@ _fixed_by_kernel_commit 061cf3a84bde \ "f2fs: fix to do sanity check on ino and xnid" _require_scratch_nocheck -_require_command "$F2FS_INJECT_PROG" inject.f2fs +_require_inject_f2fs_command node i_xattr_nid _require_attrs user # remove all mkfs options to avoid layout change of on-disk inodetests/f2fs/022 +1
-1@@ -19,7 +19,7 @@ _fixed_by_kernel_commit xxxxxxxxxxxx \ "f2fs: fix to do sanity check on node footer for non inode dnode" _require_scratch_nocheck -_require_command "$F2FS_INJECT_PROG" inject.f2fs +_require_inject_f2fs_command node i_nid # remove all mkfs options to avoid layout change of on-disk inode export MKFS_OPTIONS=""Signature · 1 line
2.40.1