blob: 2689270aa3ddf50703c2f55a2abcb4ae1f3542cb (
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
71
72
73
74
75
76
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2019 Red Hat, Inc. All Rights Reserved.
#
# FS QA Test No. 551
#
# Randomly direct AIO write&verify stress test
#
. ./common/preamble
_begin_fstest auto stress aio
# Import common functions.
. ./common/filter
# real QA test starts here
_supported_fs generic
_require_scratch
_require_aiodio aio-dio-write-verify
_scratch_mkfs > $seqres.full 2>&1
_scratch_mount
localfile=$SCRATCH_MNT/testfile
diosize=`_min_dio_alignment $SCRATCH_DEV`
# The maximum write size and offset are both 32k diosize. So the maximum
# file size will be (32 * 2)k
free_size_k=`df -kP $SCRATCH_MNT | grep -v Filesystem | awk '{print $4}'`
max_io_size_b=$((32 * 1024))
if [ $max_io_size_b -gt $((free_size_k * 1024 / 2 / diosize)) ]; then
max_io_size_b=$((free_size_k * 1024 / 2 / diosize))
fi
do_test()
{
local num_oper
local oper_list=""
local size
local off
local truncsize
local total_size=0
local avail_mem=`_available_memory_bytes`
# the number of AIO write operation
num_oper=$((RANDOM % 64 + 1))
for ((i=0; i<num_oper; i++)); do
size=$(((RANDOM % max_io_size_b + 1) * diosize))
total_size=$((total_size + size*2))
if [[ $total_size -ge $avail_mem ]]; then
break
fi
off=$((RANDOM % max_io_size_b * diosize))
oper_list="$oper_list -a size=$size,off=$off"
done
truncsize=$(((RANDOM * diosize + RANDOM % diosize) % max_io_size_b))
$AIO_TEST -t $truncsize $oper_list $localfile
if [ $? -ne 0 ];then
echo "$AIO_TEST -t $truncsize $oper_list $localfile"
echo "==========^^ Fail ^^=========="
fi
}
testimes=$((LOAD_FACTOR * 100))
while [ $testimes -gt 0 ]; do
echo > $localfile
do_test
((testimes--))
done
echo "Silence is golden"
# success, all done
status=0
exit
|