generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / xfs / 082
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 082
6 #
7 # Test out the v2 stripe logs with logprint
8 #
9 seqfull=$0
10 . ./common/preamble
11 _begin_fstest deprecated # log logprint v2log
12
13 # Import common functions.
14 . ./common/filter
15 . ./common/log
16
17 # Override the default cleanup function.
18 _cleanup()
19 {
20     cd /
21     _cleanup_logfiles
22     rm -f $tmp.*
23     _scratch_unmount 2>/dev/null
24 }
25
26 # real QA test starts here
27 _supported_fs xfs
28
29 # prelim
30 _require_scratch
31 _require_v2log 
32
33 echo "*** init FS"
34 _scratch_unmount >/dev/null 2>&1
35
36 cat >$tmp.seq.params <<EOF
37 # mkfs-opt             mount-opt            start-blk
38   version=2            logbsize=32k       2
39   version=2,su=4096    logbsize=32k       8
40   version=2,su=32768   logbsize=32k       64
41 #
42 # expect following line to fail
43 #
44   version=2,su=36864   logbsize=32k       72
45 #
46 # following is not a power of 2 BBs 
47 #
48   version=2,su=5120    logbsize=32k       10
49 EOF
50
51 # Do the work for various log params which
52 # should not effect the data content of the log
53 # Try with and without sync'ing - sync'ing will mean that
54 # the log will be written out unfilled and thus the log 
55 # stripe can have an effect.
56 #
57 for s in sync nosync ; do
58     cat $tmp.seq.params \
59     | while read mkfs mnt start restofline
60     do
61         if [ "$mkfs" = "#" ]; then 
62             continue
63         fi
64         echo "--- mkfs=$mkfs, mnt=$mnt, sync=$s ---"
65         export MOUNT_OPTIONS="-o $mnt"
66         if ! _mkfs_log "-l $mkfs"; then
67             continue
68         fi      
69         if [ $s = "sync" ]; then
70             _create_log_sync
71         else
72             _create_log
73         fi
74         if [ $? -ne 0 ]; then
75             continue
76         fi
77         _check_log
78
79         sync_suffix=".$s"
80
81         if [ $s = "sync" ]; then
82             # if sync then we have chance of DATA FORK EXTENTS items
83             # not hanging around very long due to inode syncing to disk
84             # (see comment in xfs_iflush_int())
85             # and this is to hard to reconcile in the op output
86             :
87         else
88             _print_operation
89             _cmp_op_output $seqfull.op $filtered
90         fi
91
92         _print_transaction_inode $start
93         _cmp_output $seqfull.trans_inode $filtered
94
95         _print_transaction_buf $start
96         _cmp_output $seqfull.trans_buf $filtered
97     done
98 done
99
100 status=0
101 exit