2 # FS QA Test No. btrfs/049
4 # Regression test for btrfs inode caching vs tree log which was
5 # addressed by the following kernel patch.
7 # Btrfs: fix inode caching vs tree log
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2014 Fujitsu. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
34 status=1 # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
43 # get standard environment, filters and checks
48 # real QA test starts here
52 _require_dm_target flakey
56 _scratch_mkfs >> $seqres.full 2>&1
58 SAVE_MOUNT_OPTIONS="$MOUNT_OPTIONS"
59 MOUNT_OPTIONS="$MOUNT_OPTIONS -o inode_cache,commit=100"
61 # create a basic flakey device that will never error out
68 inode_id=`stat $1 | grep Inode: | $AWK_PROG '{print $4}'`
72 $XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \
73 $SCRATCH_MNT/data >& /dev/null
75 inode_id=`_get_inode_id "$SCRATCH_MNT/data"`
76 rm -f $SCRATCH_MNT/data
80 mkdir $SCRATCH_MNT/dir_$i
81 new_inode_id=`_get_inode_id $SCRATCH_MNT/dir_$i`
82 if [ $new_inode_id -eq $inode_id ]
84 $XFS_IO_PROG -f -c "pwrite 0 1M" -c "fsync" \
85 $SCRATCH_MNT/dir_$i/data1 >& /dev/null
94 # restore previous mount options
95 export MOUNT_OPTIONS="$SAVE_MOUNT_OPTIONS"
97 # ok mount so that any recovery that needs to happen is done
98 if [ $new_inode_id -eq $inode_id ];then
99 _load_flakey_table $FLAKEY_ALLOW_WRITES
104 # make sure we got a valid fs after replay
105 _check_scratch_fs $FLAKEY_DEV