4 # Test data journaling flag switch for a single file
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
9 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 echo "QA output created by $seq"
30 status=1 # failure is the default!
31 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
33 # ext3 doesn't support direct IO in journalling mode
34 write_opt_list="iflag=noatime conv=notrunc conv=fsync"
35 # For filesystems that can handle it, add also direct IO test
36 [ $FSTYP = "ext4" ] && write_opt_list="$write_opt_list oflag=direct"
38 # get standard environment, filters and checks
43 echo "Switch data journalling mode. Silence is golden."
44 chattr_opt_list="+j -j +jS -j"
47 for write_opt in $write_opt_list
50 for chattr_opt in $chattr_opt_list
53 echo "OP write_opt: $write_opt 4M, \
54 chattr_opt: $chattr_opt" >>$seq.full
55 dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
56 bs=1M count=4 $write_opt \
57 >> $seq.full 2>&1 || exit
58 chattr $chattr_opt $SCRATCH_MNT/file.$idx >> $seq.full \
63 # Same as previous test, but for one file,
64 # and with ENOSPC triggering
65 for write_opt in $write_opt_list
68 for chattr_opt in $chattr_opt_list
71 echo "OP write_opt: $write_opt ENOSPC, \
72 chattr_opt: $chattr_opt" >>$seq.full
73 dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
74 bs=1M $write_opt >> $seq.full 2>&1
75 chattr $chattr_opt $SCRATCH_MNT/file.$idx \
79 unlink $SCRATCH_MNT/file.$idx
83 # real QA test starts here
84 _supported_fs ext3 ext4
89 _scratch_mkfs_sized $((64 * 1024 * 1024)) >> $seq.full 2>&1
99 if ! _scratch_unmount; then
100 echo "failed to umount"
104 echo "Check filesystem"