# Created by dxm@sgi.com & tes@sgi.com
#
-fulldir=$RESULT_DIR/$seq.fulldir
+fulldir=$seqres.fulldir
rm -rf $fulldir
_cleanup_logfiles()
_full()
{
- echo "" >>$RESULT_DIR/$seq.full
- echo "*** $* ***" >>$RESULT_DIR/$seq.full
- echo "" >>$RESULT_DIR/$seq.full
+ echo "" >>$seqres.full
+ echo "*** $* ***" >>$seqres.full
+ echo "" >>$seqres.full
}
_echofull()
{
- echo "" | tee -a $RESULT_DIR/$seq.full
- echo "*** $* ***" | tee -a $RESULT_DIR/$seq.full
- echo "" | tee -a $RESULT_DIR/$seq.full
+ echo "" | tee -a $seqres.full
+ echo "*** $* ***" | tee -a $seqres.full
+ echo "" | tee -a $seqres.full
}
# Handle the operations which get split over Log Record
_check_log()
{
_full "clean_log : xfs_logprint"
- _scratch_xfs_logprint -t | tee -a $RESULT_DIR/$seq.full \
+ _scratch_xfs_logprint -t | tee -a $seqres.full \
| head | grep -q "<CLEAN>" || _fail "DIRTY LOG"
}
+_scratch_xfs_logstate()
+{
+ _scratch_xfs_logprint -t | tee -a $seqres.full | grep -q "<CLEAN>"
+ echo $?
+}
+
+_scratch_f2fs_logstate()
+{
+ $DUMP_F2FS_PROG $SCRATCH_DEV | tee -a $seqres.full | grep -q "unmount"
+ echo $?
+}
+
+_scratch_ext4_logstate()
+{
+ $DUMPE2FS_PROG -h $SCRATCH_DEV 2> /dev/null | tee -a $seqres.full | \
+ grep "^Filesystem features" | grep -q needs_recovery
+ test $? -ne 0
+ echo $?
+}
+
+_scratch_dump_log()
+{
+ case "$FSTYP" in
+ xfs)
+ _scratch_xfs_logprint
+ ;;
+ f2fs)
+ $DUMP_F2FS_PROG $SCRATCH_DEV
+ ;;
+ ext4)
+ $DUMPE2FS_PROG -h $SCRATCH_DEV
+ ;;
+ *)
+ ;;
+ esac
+}
+
+_test_dump_log()
+{
+ case "$FSTYP" in
+ xfs)
+ _test_xfs_logprint
+ ;;
+ f2fs)
+ $DUMP_F2FS_PROG $TEST_DEV
+ ;;
+ ext4)
+ $DUMPE2FS_PROG -h $TEST_DEV
+ ;;
+ *)
+ ;;
+ esac
+}
+
_print_logstate()
{
- _scratch_xfs_logprint -t | tee -a $RESULT_DIR/$seq.full >$tmp.logprint
- if grep -q "<DIRTY>" $tmp.logprint; then
- echo "dirty log"
- fi
- if grep -q "<CLEAN>" $tmp.logprint; then
- echo "clean log"
+ case "$FSTYP" in
+ xfs)
+ dirty=$(_scratch_xfs_logstate)
+ ;;
+ f2fs)
+ dirty=$(_scratch_f2fs_logstate)
+ ;;
+ ext4)
+ dirty=$(_scratch_ext4_logstate)
+ ;;
+ *)
+ ;;
+ esac
+
+ if [ $dirty -ne 0 ]; then
+ echo "dirty log"
+ else
+ echo "clean log"
fi
}
# and may not match with the FS mounted at a different LR size
# => xlog_do_recovery_pass() can not handle the different hdr sizes
# it assumes them all to be the same between the start..finish
-# NB: On IRIX there is no UMOUNT record and so we could start from -s 0.
_print_transaction_inode()
{
# mkfs options to append to log size otion can be specified ($*)
export MKFS_OPTIONS="-l size=2000b -l lazy-count=1 $*"
_full "mkfs"
- _scratch_mkfs_xfs >>$RESULT_DIR/$seq.full 2>&1
+ _scratch_mkfs_xfs >>$seqres.full 2>&1
if [ $? -ne 0 ] ; then
_echofull "Cannot mkfs for this test using option specified: $MKFS_OPTIONS"
return 1
{
# mount the FS
_full "mount"
- _scratch_mount >>$RESULT_DIR/$seq.full 2>&1
+ _scratch_mount >>$seqres.full 2>&1
if [ $? -ne 0 ] ; then
_echofull "mount failed: $MOUNT_OPTIONS"
return 1
# unmount the FS
_full "umount"
- umount $SCRATCH_DEV >>$RESULT_DIR/$seq.full 2>&1
+ _scratch_unmount >>$seqres.full 2>&1
if [ $? -ne 0 ] ; then
_echofull "umount failed"
return 1
{
# mount the FS
_full " mount"
- _scratch_mount >>$RESULT_DIR/$seq.full 2>&1
+ _scratch_mount >>$seqres.full 2>&1
if [ $? -ne 0 ] ; then
_echofull "mount failed: $MOUNT_OPTIONS"
return 1
# unmount the FS
_full "umount"
- umount $SCRATCH_DEV >>$RESULT_DIR/$seq.full 2>&1
+ _scratch_unmount >>$seqres.full 2>&1
if [ $? -ne 0 ] ; then
_echofull "umount failed"
return 1
{
# test out mkfs to see if it supports "-l version=2"
export MKFS_OPTIONS="-l version=2"
- if ! _scratch_mkfs_xfs >>$RESULT_DIR/$seq.full 2>&1; then
+ if ! _scratch_mkfs_xfs >>$seqres.full 2>&1; then
_notrun "mkfs does not support v2 logs"
fi
# test out mount to see if it mounts a v2 log fs
export MOUNT_OPTIONS="-o logbsize=32k"
- if ! _scratch_mount >>$RESULT_DIR/$seq.full 2>&1; then
+ if ! _scratch_mount >>$seqres.full 2>&1; then
_notrun "mount/kernel does not support v2 logs"
fi
# check after unmount to see if it is clean
# i.e. it is not a 6.5.25 buggy version checking kernel
touch $SCRATCH_MNT/file
- umount $SCRATCH_DEV >>$RESULT_DIR/$seq.full 2>&1
- if _scratch_xfs_logprint -t | tee -a $RESULT_DIR/$seq.full \
+ _scratch_unmount >>$seqres.full 2>&1
+ if _scratch_xfs_logprint -t | tee -a $seqres.full \
| head | grep -q "<DIRTY>"; then
_notrun "kernel does not support v2 logs"
fi
# otherwise presume it does support v2 logs...:)
}
+_require_logstate()
+{
+ case "$FSTYP" in
+ xfs)
+ if [ -z "$XFS_LOGPRINT_PROG" ]; then
+ _notrun "This test requires xfs_logprint utility."
+ fi
+ ;;
+ f2fs)
+ if [ -z "$DUMP_F2FS_PROG" ]; then
+ _notrun "This test requires dump.f2fs utility."
+ fi
+ ;;
+ ext4)
+ if [ -z "$DUMPE2FS_PROG" ]; then
+ _notrun "This test requires dumpe2fs utility."
+ fi
+ ;;
+ *)
+ _notrun "$FSTYP does not support log state probing."
+ ;;
+ esac
+}
+
+_xfs_log_config()
+{
+ echo "# mkfs-opt mount-opt"
+ echo "# ------------------------------"
+ echo " version=2 logbsize=32k"
+ echo " version=2,su=4096 logbsize=32k"
+ echo " version=2,su=32768 logbsize=32k"
+ echo " version=2,su=32768 logbsize=64k"
+ echo " version=2 logbsize=64k"
+ echo " version=2,su=64k logbsize=64k"
+ echo " version=2 logbsize=128k"
+ echo " version=2,su=128k logbsize=128k"
+ echo " version=2 logbsize=256k"
+ echo " version=2,su=256k logbsize=256k"
+}
+
+_f2fs_log_config()
+{
+ echo "# mkfs-opt mount-opt"
+ echo "# ------------------------------"
+ echo " test1 active_logs=6,background_gc=off"
+ echo " test2 active_logs=6,background_gc=off,inline_data"
+ echo " test3 active_logs=6,background_gc=off,inline_dentry"
+ echo " test4 active_logs=6,background_gc=off,inline_data,inline_dentry"
+ echo " test5 active_logs=6,background_gc=off,disable_roll_forward"
+ echo " test6 active_logs=6,background_gc=off,discard,inline_data,inline_dentry"
+ echo " test7 active_logs=6,background_gc=on"
+ echo " test8 active_logs=6,background_gc=on,inline_data"
+ echo " test9 active_logs=6,background_gc=on,inline_data,inline_dentry"
+ echo " test10 active_logs=6,background_gc=on,discard,inline_data,inline_dentry"
+}
+
+_ext4_log_config()
+{
+ echo "# mkfs-opt mount-opt"
+ echo "# ------------------------------"
+ echo " /dev/null data=writeback"
+ echo " /dev/null data=ordered"
+ echo " /dev/null data=journal"
+ echo " /dev/null data=ordered,data_err=abort"
+ echo " /dev/null data=writeback,nojournal_checksum"
+ echo " /dev/null data=ordered,nojournal_checksum"
+ echo " /dev/null data=journal,nojournal_checksum"
+ echo " /dev/null data=ordered,data_err=abort,nojournal_checksum"
+ echo " /dev/null data=writeback,journal_checksum"
+ echo " /dev/null data=ordered,journal_checksum"
+}
+
+_get_log_configs()
+{
+ case "$FSTYP" in
+ xfs)
+ _xfs_log_config
+ ;;
+ f2fs)
+ _f2fs_log_config
+ ;;
+ ext4)
+ _ext4_log_config
+ ;;
+ *)
+ _notrun "$FSTYP does not support log configs."
+ ;;
+ esac
+}
# make sure this script returns success
/bin/true