2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Huawei. All Rights Reserved.
7 # This testcase is trying to test recovery flow of generic filesystem, it needs
8 # creation time support on specified filesystem.
9 # With below steps, once the file is created, creation time attribute should be
10 # valid on the file, after we fsync that file, it expects creation time can be
11 # recovered after sudden power-cuts.
14 # 2. xfs_io -f testfile -c "fsync";
18 # 6. check creation time
21 seqres=$RESULT_DIR/$seq
22 echo "QA output created by $seq"
26 status=1 # failure is the default!
27 trap "_cleanup; exit \$status" 0 1 2 3 15
35 # get standard environment, filters and checks
39 # remove previous $seqres.full before test
42 # real QA test starts here
48 _require_xfs_io_command "statx" "-v"
51 _require_scratch_shutdown
52 _require_scratch_btime
54 _scratch_mkfs >/dev/null 2>&1
55 _require_metadata_journaling $SCRATCH_DEV
57 testfile=$SCRATCH_MNT/testfile
65 if [ "$1" == "sync" ]; then
69 before=`$XFS_IO_PROG -f $testfile -c "statx -v" | grep btime`
71 $XFS_IO_PROG -f $testfile -c "fsync" | _filter_xfs_io
73 _scratch_shutdown | tee -a $seqres.full
76 after=`$XFS_IO_PROG -f $testfile -c "statx -v" | grep btime`
78 # check inode's creation time
79 if [ "$before" != "$after" ]; then
80 echo "Before: $before"
83 echo "Before: $before" >> $seqres.full
84 echo "After : $after" >> $seqres.full
90 echo "Silence is golden"