mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
84 lines
2.2 KiB
Bash
84 lines
2.2 KiB
Bash
|
|
#! /bin/bash
|
||
|
|
# FS QA Test No. 470
|
||
|
|
#
|
||
|
|
# Use dm-log-writes to verify that MAP_SYNC actually syncs metadata during
|
||
|
|
# page faults.
|
||
|
|
#
|
||
|
|
#-----------------------------------------------------------------------
|
||
|
|
# Copyright (c) 2017 Intel Corporation. All Rights Reserved.
|
||
|
|
#
|
||
|
|
# 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"
|
||
|
|
|
||
|
|
tmp=/tmp/$$
|
||
|
|
here=`pwd`
|
||
|
|
status=1 # failure is the default!
|
||
|
|
trap "_cleanup; exit \$status" 0 1 2 3 15
|
||
|
|
|
||
|
|
_cleanup()
|
||
|
|
{
|
||
|
|
cd /
|
||
|
|
_log_writes_cleanup
|
||
|
|
rm -f $tmp.*
|
||
|
|
}
|
||
|
|
|
||
|
|
# get standard environment, filters and checks
|
||
|
|
. ./common/rc
|
||
|
|
. ./common/filter
|
||
|
|
. ./common/dmlogwrites
|
||
|
|
|
||
|
|
# remove previous $seqres.full before test
|
||
|
|
rm -f $seqres.full
|
||
|
|
|
||
|
|
# real QA test starts here
|
||
|
|
_supported_fs generic
|
||
|
|
_supported_os Linux
|
||
|
|
_require_scratch
|
||
|
|
_require_log_writes_dax
|
||
|
|
_require_xfs_io_command "mmap" "-S"
|
||
|
|
_require_xfs_io_command "log_writes"
|
||
|
|
|
||
|
|
_log_writes_init
|
||
|
|
_log_writes_mkfs >> $seqres.full 2>&1
|
||
|
|
_log_writes_mount -o dax
|
||
|
|
|
||
|
|
LEN=$((1024 * 1024)) # 1 MiB
|
||
|
|
|
||
|
|
$XFS_IO_PROG -t -c "truncate $LEN" -c "mmap -S 0 $LEN" -c "mwrite 0 $LEN" \
|
||
|
|
-c "log_writes -d $LOGWRITES_NAME -m preunmap" \
|
||
|
|
-f $SCRATCH_MNT/test
|
||
|
|
|
||
|
|
# Unmount the scratch dir and tear down the log writes target
|
||
|
|
_log_writes_unmount
|
||
|
|
_log_writes_remove
|
||
|
|
_check_scratch_fs
|
||
|
|
|
||
|
|
# destroy previous filesystem so we can be sure our rebuild works
|
||
|
|
_scratch_mkfs >> $seqres.full 2>&1
|
||
|
|
|
||
|
|
# check pre-unmap state
|
||
|
|
_log_writes_replay_log preunmap
|
||
|
|
_scratch_mount
|
||
|
|
|
||
|
|
# We should see $SCRATCH_MNT/test as having 1 MiB in block allocations
|
||
|
|
du -sh $SCRATCH_MNT/test | _filter_scratch | _filter_spaces
|
||
|
|
|
||
|
|
status=0
|
||
|
|
exit
|