mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
856ff26884
When using mmap() for file i/o, writing to the file should update it's c/mtime. Specifically if we first mmap-read from a page, then memap-write to the same page. This test was failing for the initial submission of DAX because pfn based mapping do not have an page_mkwrite called for them. The new Kernel patches that introduce pfn_mkwrite fixes this test. Test adapted from a script originally written by Dave Chinner. Signed-off-by: Omer Zilberberg <omzg@plexistor.com> Signed-off-by: Boaz Harrosh <boaz@plexistor.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
79 lines
2.0 KiB
Bash
Executable File
79 lines
2.0 KiB
Bash
Executable File
#! /bin/bash
|
|
# FS QA Test No. 080
|
|
#
|
|
# Verify that mtime is updated when writing to mmap-ed pages
|
|
#
|
|
#-----------------------------------------------------------------------
|
|
# This program is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU General Public License as
|
|
# published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it would be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write the Free Software Foundation,
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
#-----------------------------------------------------------------------
|
|
#
|
|
|
|
seq=`basename $0`
|
|
seqres=$RESULT_DIR/$seq
|
|
echo "QA output created by $seq"
|
|
|
|
here=`pwd`
|
|
tmp=/tmp/$$
|
|
status=0
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
|
|
|
_cleanup()
|
|
{
|
|
cd /
|
|
rm -f $tmp.*
|
|
rm -f $testfile
|
|
}
|
|
|
|
# get standard environment, filters and checks
|
|
. ./common/rc
|
|
. ./common/filter
|
|
|
|
# real QA test starts here
|
|
_supported_fs generic
|
|
_supported_os IRIX Linux
|
|
_require_test
|
|
|
|
echo "Silence is golden."
|
|
rm -f $seqres.full
|
|
|
|
# pattern the file.
|
|
testfile=$TEST_DIR/mmap_mtime_testfile
|
|
$XFS_IO_PROG -f -c "pwrite 0 4k" -c fsync $testfile >> $seqres.full
|
|
|
|
# sample timestamps.
|
|
mtime1=`stat -c %Y $testfile`
|
|
ctime1=`stat -c %Z $testfile`
|
|
echo "before mwrite: $mtime1 $ctime1" >> $seqres.full
|
|
|
|
# map read followed by map write to trigger timestamp change
|
|
sleep 2
|
|
$XFS_IO_PROG -c "mmap 0 4k" -c "mread 0 4k" -c "mwrite 0 4k" $testfile \
|
|
>> $seqres.full
|
|
|
|
# sample and verify that timestamps have changed.
|
|
mtime2=`stat -c %Y $testfile`
|
|
ctime2=`stat -c %Z $testfile`
|
|
echo "after mwrite : $mtime2 $ctime2" >> $seqres.full
|
|
|
|
if [ "$mtime1" == "$mtime2" ]; then
|
|
echo "mtime not updated"
|
|
let status=$status+1
|
|
fi
|
|
if [ "$ctime1" == "$ctime2" ]; then
|
|
echo "ctime not updated"
|
|
let status=$status+1
|
|
fi
|
|
|
|
exit
|