blob: bfbfbce4aa5e8a4de520d4880f1a94efa2ea06e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2022 Oracle. All Rights Reserved.
#
# FS QA Test No. 792
#
# Test scatter-gather atomic file commits. Use the startupdate command to
# create a temporary file, write sparsely to it, then commitupdate -h to
# perform the scattered update. Inject an error so that we can test that log
# recovery finishes the swap.
. ./common/preamble
_begin_fstest auto quick fiexchange swapext
# Override the default cleanup function.
_cleanup()
{
cd /
rm -r -f $tmp.* $dir
}
# Import common functions.
. ./common/filter
. ./common/inject
# real QA test starts here
_supported_fs xfs
_require_xfs_io_command swapext '-v exchrange -a'
_require_xfs_io_command startupdate '-e'
_require_xfs_scratch_atomicswap
_require_xfs_io_error_injection "bmap_finish_one"
_scratch_mkfs >> $seqres.full
_scratch_mount
# Create original file
_pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
sync
md5sum $SCRATCH_MNT/a | _filter_scratch
# Test atomic scatter-gather file commits.
echo commit | tee -a $seqres.full
$XFS_IO_PROG -x \
-c 'bmap -elpv' \
-c 'startupdate -e' \
-c 'truncate 1m' \
-c 'pwrite -S 0x59 64k 64k' \
-c 'pwrite -S 0x57 768k 64k' \
-c 'sync' \
-c 'bmap -elpv' \
-c 'inject bmap_finish_one' \
-c 'commitupdate -h -k' \
$SCRATCH_MNT/a >> $seqres.full
_scratch_cycle_mount
$XFS_IO_PROG -c 'bmap -elpv' $SCRATCH_MNT/a >> $seqres.full
md5sum $SCRATCH_MNT/a | _filter_scratch
# success, all done
status=0
exit
|