2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc. All Rights Reserved.
5 # FSQA Test No. ext4/039
7 # Test data journaling flag switch for a single file
10 _begin_fstest auto enospc rw
12 # ext3 and ext4 don't support direct IO in journalling mode
13 write_opt_list="iflag=noatime conv=notrunc conv=fsync"
15 # Import common functions.
19 echo "Switch data journalling mode. Silence is golden."
20 chattr_opt_list="+j -j +jS -j"
23 for write_opt in $write_opt_list
26 for chattr_opt in $chattr_opt_list
29 echo "OP write_opt: $write_opt 4M, \
30 chattr_opt: $chattr_opt" >>$seqres.full
31 dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
32 bs=1M count=4 $write_opt \
33 >> $seqres.full 2>&1 || exit
34 $CHATTR_PROG $chattr_opt $SCRATCH_MNT/file.$idx >> $seqres.full \
39 # Same as previous test, but for one file,
40 # and with ENOSPC triggering
41 for write_opt in $write_opt_list
44 for chattr_opt in $chattr_opt_list
47 echo "OP write_opt: $write_opt ENOSPC, \
48 chattr_opt: $chattr_opt" >>$seqres.full
49 dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
50 bs=1M $write_opt >> $seqres.full 2>&1
51 $CHATTR_PROG $chattr_opt $SCRATCH_MNT/file.$idx \
52 >> $seqres.full || exit
55 unlink $SCRATCH_MNT/file.$idx
59 # real QA test starts here
60 _supported_fs ext3 ext4
62 _exclude_scratch_mount_option dax
64 _scratch_mkfs_sized $((64 * 1024 * 1024)) >> $seqres.full 2>&1
74 if ! _scratch_unmount; then
75 echo "failed to umount"
79 echo "Check filesystem"