blob: 12324fb1561654c25de0013e483668aa98a119f2 (
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
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2022 Oracle. All Rights Reserved.
#
# FS QA Test No. 724
#
# Test scatter-gather atomic file writes. We create a temporary file, write
# sparsely to it, then use XFS_EXCH_RANGE_FILE1_WRITTEN flag to swap
# atomicallly only the ranges that we wrote.
. ./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
# real QA test starts here
_require_xfs_io_command swapext '-v exchrange -a'
_require_scratch
_scratch_mkfs >> $seqres.full
_scratch_mount
_require_congruent_file_oplen $SCRATCH_MNT 65536
# Create original file
_pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
# Create the donor file
$XFS_IO_PROG -f -c 'truncate 1m' $SCRATCH_MNT/b
_pwrite_byte 0x59 64k 64k $SCRATCH_MNT/b >> $seqres.full
_pwrite_byte 0x57 768k 64k $SCRATCH_MNT/b >> $seqres.full
md5sum $SCRATCH_MNT/a | _filter_scratch
md5sum $SCRATCH_MNT/b | _filter_scratch
# Test swapext. -h means skip holes in /b, and -e means operate to EOF
echo swap | tee -a $seqres.full
$XFS_IO_PROG -c "swapext -v exchrange -f -u -h -e -a $SCRATCH_MNT/b" $SCRATCH_MNT/a
_scratch_cycle_mount
md5sum $SCRATCH_MNT/a | _filter_scratch
md5sum $SCRATCH_MNT/b | _filter_scratch
# success, all done
status=0
exit
|