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
35 echo "Silence is golden."
39 sourcefile=$TEST_DIR/clone_mtime_sourcefile
40 $XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $sourcefile >> $seqres.full
42 destfile=$TEST_DIR/clone_mtime_destfile
43 touch $destfile >> $seqres.full
46 mtime1=`stat -c %Y $destfile`
47 ctime1=`stat -c %Z $destfile`
48 echo "before clone: $mtime1 $ctime1" >> $seqres.full
50 # clone to trigger timestamp change
52 $XFS_IO_PROG -c "reflink $sourcefile " $destfile >> $seqres.full
54 # sample and verify that timestamps have changed.
55 mtime2=`stat -c %Y $destfile`
56 ctime2=`stat -c %Z $destfile`
57 echo "after clone : $mtime2 $ctime2" >> $seqres.full
59 if [ "$mtime1" == "$mtime2" ]; then
60 echo "mtime not updated"
63 if [ "$ctime1" == "$ctime2" ]; then
64 echo "ctime not updated"