2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Intel Corporation. All Rights Reserved.
7 # Use dm-log-writes to verify that MAP_SYNC actually syncs metadata during
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
29 . ./common/dmlogwrites
31 # remove previous $seqres.full before test
34 # real QA test starts here
38 _require_log_writes_dax_mountopt "dax"
39 _require_xfs_io_command "mmap" "-S"
40 _require_xfs_io_command "log_writes"
42 _log_writes_init $SCRATCH_DEV
43 _log_writes_mkfs >> $seqres.full 2>&1
44 _log_writes_mount -o dax
46 LEN=$((1024 * 1024)) # 1 MiB
48 $XFS_IO_PROG -t -c "truncate $LEN" -c "mmap -S 0 $LEN" -c "mwrite 0 $LEN" \
49 -c "log_writes -d $LOGWRITES_NAME -m preunmap" \
52 # Unmount the scratch dir and tear down the log writes target
57 # destroy previous filesystem so we can be sure our rebuild works
58 _scratch_mkfs >> $seqres.full 2>&1
60 # check pre-unmap state
61 _log_writes_replay_log preunmap $SCRATCH_DEV
64 # We should see $SCRATCH_MNT/test as having 1 MiB in block allocations
65 du -sh $SCRATCH_MNT/test | _filter_scratch | _filter_spaces