blob: 9a4a45641afefb42b0b569301d8a37845fdf355e (
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
62
63
64
65
66
67
68
69
70
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2009 Christoph Hellwig.
#
# FS QA Test No. 203
#
# Test out reallocation of the extent array in xfs_io.
# Based on a testcase from Tomasz Majkowski <moosh009@gmail.com>.
#
. ./common/preamble
_begin_fstest ioctl auto
_write_holes()
{
file=$1
holes=$2
let writes=$holes+1
let fsize=$(($writes * 0x100000))
# prevent EOF preallocation from affecting results
$XFS_IO_PROG -f $file -c "truncate $fsize"
offset=0
for i in `seq 0 $writes`; do
$XFS_IO_PROG -f $file -c "pwrite -b 64k -q $offset 64k"
let offset=$offset+0x100000
done
}
# 0: [0..7]: 104..111
# 1: [8..2047]: hole
_filter_bmap()
{
_filter_scratch |
awk '$3 ~ /hole/ { print $1, $2, $3; next }
{print $1, $2; next}'
}
# Override the default cleanup function.
_cleanup()
{
rm -f $SCRATCH_MNT/r??
}
# Import common functions.
. ./common/filter
# real QA test starts here
_supported_fs xfs
_require_scratch
_scratch_mkfs > /dev/null 2>&1
_scratch_mount > /dev/null 2>&1
# The xfs_bmap results in the golden output requires file allocations to align
# to 64k boundaries.
_require_congruent_file_oplen $SCRATCH_MNT 65536
for i in 10 14 15 16 17 28 29 30 31; do
rm -f $SCRATCH_MNT/hole_file
_write_holes $SCRATCH_MNT/hole_file${i} ${i}
done
for i in 10 14 15 16 17 28 29 30 31; do
xfs_bmap $SCRATCH_MNT/hole_file${i} | _filter_bmap
echo
done
# success, all done
echo "*** done"
status=0
|