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 _begin_fstest shutdown auto quick metadata
23 # Import common functions.
26 # real QA test starts here
31 _require_xfs_io_command "statx" "-v"
34 _require_scratch_shutdown
35 _require_scratch_btime
37 _scratch_mkfs >/dev/null 2>&1
38 _require_metadata_journaling $SCRATCH_DEV
40 testfile=$SCRATCH_MNT/testfile
48 if [ "$1" == "sync" ]; then
52 before=`$XFS_IO_PROG -f $testfile -c "statx -v" | grep btime`
54 $XFS_IO_PROG -f $testfile -c "fsync" | _filter_xfs_io
56 _scratch_shutdown | tee -a $seqres.full
59 after=`$XFS_IO_PROG -f $testfile -c "statx -v" | grep btime`
61 # check inode's creation time
62 if [ "$before" != "$after" ]; then
63 echo "Before: $before"
66 echo "Before: $before" >> $seqres.full
67 echo "After : $after" >> $seqres.full
73 echo "Silence is golden"