summaryrefslogtreecommitdiff
path: root/tests/xfs/172
blob: 56c2583b9d60eae0c46ae73a8e58fc52c89cbc99 (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
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2007 Silicon Graphics, Inc.  All Rights Reserved.
#
# FSQA Test No. 172
#
# Check the filestreams allocator is doing its job.
# Multi-file data streams should always write into seperate AGs.
#
. ./common/preamble
_begin_fstest rw filestreams

# Import common functions.
. ./common/filter
. ./common/filestreams

# real QA test starts here
_supported_fs xfs
_require_scratch

# The first _test_streams call sets up the filestreams allocator to fail and
# then checks that it actually failed.  It does this by creating a very small
# filesystem, writing a lot of data in parallel to separate streams, and then
# flushes the dirty data, also in parallel.  To trip the allocator, the test
# relies on writeback combining adjacent dirty ranges into large allocation
# requests which eventually bleed across AGs.  This happens either because the
# big writes are slow enough that filestreams contexts expire between
# allocation requests, or because the AGs are so full at allocation time that
# the bmapi allocator decides to scan for a less full AG.  Either way, stream
# directories share AGs, which is what the test considers a success.
#
# However, this only happens if writes use the delayed allocation code paths.
# If the kernel allocates small amounts of space at the time of each write()
# call, the successive small allocations never trip the bmapi allocator's
# rescan thresholds and will keep pushing out the expiration time, with the
# result that the filestreams allocator succeeds in maintaining the streams.
# The test considers this a failure.
_require_scratch_delalloc

_check_filestreams_support || _notrun "filestreams not available"

# test reaper works by setting timeout low. Expected to fail
# for buffered, succeed for direct I/O.
_set_stream_timeout_centisecs 50

_test_streams 8 16 4 8 3 1 0 fail
_test_streams 64 16 20 10 1 0 1

status=0
exit