2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
7 # Test data journaling flag switch for a single file
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 status=1 # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
18 # ext3 and ext4 don't support direct IO in journalling mode
19 write_opt_list="iflag=noatime conv=notrunc conv=fsync"
21 # get standard environment, filters and checks
26 echo "Switch data journalling mode. Silence is golden."
27 chattr_opt_list="+j -j +jS -j"
30 for write_opt in $write_opt_list
33 for chattr_opt in $chattr_opt_list
36 echo "OP write_opt: $write_opt 4M, \
37 chattr_opt: $chattr_opt" >>$seqres.full
38 dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
39 bs=1M count=4 $write_opt \
40 >> $seqres.full 2>&1 || exit
41 $CHATTR_PROG $chattr_opt $SCRATCH_MNT/file.$idx >> $seqres.full \
46 # Same as previous test, but for one file,
47 # and with ENOSPC triggering
48 for write_opt in $write_opt_list
51 for chattr_opt in $chattr_opt_list
54 echo "OP write_opt: $write_opt ENOSPC, \
55 chattr_opt: $chattr_opt" >>$seqres.full
56 dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
57 bs=1M $write_opt >> $seqres.full 2>&1
58 $CHATTR_PROG $chattr_opt $SCRATCH_MNT/file.$idx \
59 >> $seqres.full || exit
62 unlink $SCRATCH_MNT/file.$idx
66 # real QA test starts here
67 _supported_fs ext3 ext4
70 _exclude_scratch_mount_option dax
73 _scratch_mkfs_sized $((64 * 1024 * 1024)) >> $seqres.full 2>&1
83 if ! _scratch_unmount; then
84 echo "failed to umount"
88 echo "Check filesystem"