2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Christoph Hellwig. All Rights Reserved.
7 # Verify that mtime is updated when cloning files
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
15 trap "_cleanup; exit \$status" 0 1 2 3 15
24 # get standard environment, filters and checks
29 # real QA test starts here
36 echo "Silence is golden."
40 sourcefile=$TEST_DIR/clone_mtime_sourcefile
41 $XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $sourcefile >> $seqres.full
43 destfile=$TEST_DIR/clone_mtime_destfile
44 touch $destfile >> $seqres.full
47 mtime1=`stat -c %Y $destfile`
48 ctime1=`stat -c %Z $destfile`
49 echo "before clone: $mtime1 $ctime1" >> $seqres.full
51 # clone to trigger timestamp change
53 $XFS_IO_PROG -c "reflink $sourcefile " $destfile >> $seqres.full
55 # sample and verify that timestamps have changed.
56 mtime2=`stat -c %Y $destfile`
57 ctime2=`stat -c %Z $destfile`
58 echo "after clone : $mtime2 $ctime2" >> $seqres.full
60 if [ "$mtime1" == "$mtime2" ]; then
61 echo "mtime not updated"
64 if [ "$ctime1" == "$ctime2" ]; then
65 echo "ctime not updated"