blob: 730be879ec1579bc1719e48359c610b0ff442ce5 (
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
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2014 Wang Shilong. All Rights Reserved.
#
# FS QA Test No. btrfs/076
#
# Regression test for btrfs incorrect inode ratio detection.
#
. ./common/preamble
_begin_fstest auto quick compress
# Override the default cleanup function.
_cleanup()
{
cd /
rm -fr $tmp
}
. ./common/filter
. ./common/defrag
_supported_fs btrfs
_require_test
_require_scratch
_fixed_by_kernel_commit 4bcbb3325513 \
"Btrfs: fix incorrect compression ratio detection"
# An extent size can be up to BTRFS_MAX_UNCOMPRESSED
max_extent_size=$(( 128 * 1024 ))
if _scratch_btrfs_is_zoned; then
zone_append_max=$(cat "/sys/block/$(_short_dev $SCRATCH_DEV)/queue/zone_append_max_bytes")
if [[ $zone_append_max -gt 0 && $zone_append_max -lt $max_extent_size ]]; then
# Round down to PAGE_SIZE
max_extent_size=$(( $zone_append_max / 4096 * 4096 ))
fi
fi
file_size=$(( 10 * 1024 * 1024 ))
expect=$(( (file_size + max_extent_size - 1) / max_extent_size ))
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount "-o compress=lzo"
$XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \
$SCRATCH_MNT/data >> $seqres.full 2>&1
res=$(_extent_count $SCRATCH_MNT/data)
if [[ $res -ne $expect ]]; then
_fail "Expected $expect extents, got $res"
fi
$XFS_IO_PROG -f -c "pwrite 0 $((4096*33))" -c "fsync" \
$SCRATCH_MNT/data >> $seqres.full 2>&1
$XFS_IO_PROG -f -c "pwrite 0 10M" -c "fsync" \
$SCRATCH_MNT/data >> $seqres.full 2>&1
res=$(_extent_count $SCRATCH_MNT/data)
if [[ $res -ne $expect ]]; then
_fail "Expected $expect extents, got $res"
fi
echo "Silence is golden"
status=0
exit
|