2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
7 # To test log replay with version 2 logs
8 # Initially keep this simple with just creates.
9 # In another qa test we can do more e.g. use fsstress.
12 _begin_fstest shutdown log v2log auto
14 # Import common functions.
18 # real QA test starts here
22 _require_scratch_shutdown
26 _scratch_unmount >/dev/null 2>&1
28 _scratch_mkfs >/dev/null 2>&1
29 _require_metadata_journaling $SCRATCH_DEV
31 _get_log_configs > $tmp.seq.params
33 # Do the work for various log params which
34 # should not effect the data content of the log
35 # Try with and without sync'ing - sync'ing will mean that
36 # the log will be written out unfilled and thus the log
37 # stripe can have an effect.
39 for s in sync nosync ; do
41 | while read mkfs mnt restofline
43 if [ "$mkfs" = "#" ]; then
47 echo "--- mkfs=$mkfs, mnt=$mnt, sync=$s ---" >>$seqres.full
48 export MKFS_OPTIONS="-l $mkfs"
49 export MOUNT_OPTIONS="-o $mnt"
53 _scratch_mkfs >>$seqres.full 2>&1
54 if [ $? -ne 0 ] ; then
55 _echofull "mkfs failed: $MKFS_OPTIONS"
61 if ! _try_scratch_mount >>$seqres.full 2>&1; then
62 _echofull "mount failed: $MOUNT_OPTIONS"
67 if [ $s = "sync" ]; then
68 # generate some log traffic - but not too much
69 # add some syncs to get the log flushed to disk
70 for file in $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}; do
75 # generate some log traffic - but not too much - life gets a little
76 # more complicated if the log wraps around. This traffic is
77 # pretty much arbitary, but could probably be made better than this.
78 touch $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
81 # check before on what FS should look like
82 _echofull "ls SCRATCH_MNT"
83 ls $SCRATCH_MNT | _filter_lostfound
86 _scratch_shutdown -v -f >> $seqres.full
89 _scratch_unmount >>$seqres.full 2>&1 \
90 || _fail "umount failed"
92 _echofull "logprint after going down..."
95 _echofull "mount with replay"
96 _try_scratch_mount >>$seqres.full 2>&1 \
97 || _fail "mount failed: $MOUNT_OPTIONS"
99 # check on what FS looks like after log recovery
100 _echofull "ls SCRATCH_MNT"
101 ls $SCRATCH_MNT | _filter_lostfound
106 _echofull "logprint after mount and replay..."
109 if _check_scratch_fs; then
110 _echofull "filesystem is checked ok"
112 _echofull "filesystem is NOT ok"