blob: 73511d997120e78e29f0da5ac98880ac09abb319 (
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
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2018 Oracle. All Rights Reserved.
#
# FS QA Test 204
#
# Test if the unaligned (by size and offset) punch hole is successful when FS
# is at ENOSPC.
#
. ./common/preamble
_begin_fstest auto quick punch
. ./common/filter
_supported_fs btrfs
_require_scratch
_require_xfs_io_command "fpunch"
_scratch_mkfs_sized $((256 * 1024 *1024)) >> $seqres.full
# max_inline ensures data is not inlined within metadata extents
_scratch_mount "-o max_inline=0,nodatacow"
cat /proc/self/mounts | grep $SCRATCH_DEV >> $seqres.full
$BTRFS_UTIL_PROG filesystem df $SCRATCH_MNT >> $seqres.full
extent_size=$(_scratch_btrfs_sectorsize)
unalign_by=512
echo extent_size=$extent_size unalign_by=$unalign_by >> $seqres.full
$XFS_IO_PROG -f -c "pwrite -S 0xab 0 $((extent_size * 10))" \
$SCRATCH_MNT/testfile >> $seqres.full
echo "Fill all space available for data and all unallocated space." >> $seqres.full
dd status=none if=/dev/zero of=$SCRATCH_MNT/filler bs=512 >> $seqres.full 2>&1
hole_offset=0
hole_len=$unalign_by
$XFS_IO_PROG -c "fpunch $hole_offset $hole_len" $SCRATCH_MNT/testfile
hole_offset=$(($extent_size + $unalign_by))
hole_len=$(($extent_size - $unalign_by))
$XFS_IO_PROG -c "fpunch $hole_offset $hole_len" $SCRATCH_MNT/testfile
hole_offset=$(($extent_size * 2 + $unalign_by))
hole_len=$(($extent_size * 5))
$XFS_IO_PROG -c "fpunch $hole_offset $hole_len" $SCRATCH_MNT/testfile
# success, all done
echo "Silence is golden"
status=0
exit
|