-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcases-common.sh
347 lines (286 loc) · 10.4 KB
/
cases-common.sh
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
#!/bin/bash
load_kexec() {
[[ $(cat /sys/kernel/kexec_loaded) = 0 ]] && {
kexec -l /boot/vmlinuz-$1 --append="$(</proc/cmdline)"
}
}
reboot_kexec() {
[[ $(cat /sys/kernel/kexec_loaded) = 1 ]] && {
reboot
exit
}
[[ ! $kver && $test_case_executed ]] && {
reboot
exit
}
}
make_dir() {
config=$1
job=$2
osrelease=$kver
[[ $osrelease ]] || osrelease=$(</proc/sys/kernel/osrelease)
dir=$(hostname)/$config/$fs-$job-$loop-$osrelease
[[ $kopt ]] && dir+=:$kopt
[ -d $dir ] && return 1
[[ $osrelease != $(</proc/sys/kernel/osrelease) ]] && {
load_kexec $osrelease
return 1
}
[[ $kver && $test_case_executed ]] && {
load_kexec $osrelease
reboot_kexec
exit
}
test_case_executed=1
mkdir -p $dir
cd $dir
}
fio_job() {
job=$1
make_dir fio $job || return
run_test fio
}
check_partition_size() {
for dev do
part=$(basename $dev)
size=$(grep $part /proc/partitions | awk '{ print $3 }')
[[ $size ]] || return 1
if [[ $prev_size ]]; then
[[ $size != $prev_size ]] || return 1
else
prev_size=size
fi
done
}
jbod_12hdd() {
devices="
/dev/sdb1 /dev/sdb2
/dev/sdc1 /dev/sdc2
/dev/sdd1 /dev/sdd2
/dev/sde1 /dev/sde2
/dev/sdf1 /dev/sdf2
/dev/sdg1 /dev/sdg2
/dev/sdh1 /dev/sdh2
/dev/sdi1 /dev/sdi2
/dev/sdj1 /dev/sdj2
/dev/sdk1 /dev/sdk2
/dev/sdl1 /dev/sdl2
/dev/sdm1 /dev/sdm2
"
local rw=$1
local ioengine=$2
local fallocate=$3
local blocksize=$4
check_partition_size $devices || return
job=fio_jbod_12hdd_${rw}_${ioengine}_${fallocate}_${blocksize}
make_dir jbod_12hdd $job || return
cat > $job <<EOF
[global]
runtime=$RUNTIME
rw=$rw
direct=0
ioengine=$ioengine
size=8G
blocksize=$blocksize
numjobs=1
fallocate=$fallocate
overwrite=0
create_sparse=1
invalidate=0
directory=$MNT
file_service_type=random:36
$(<$BASE_DIR/fio_jbod_12hdd_template)
EOF
run_test fio
}
jbod_12hdd_randrw_4k() { jbod_12hdd randrw sync 0 4k; }
jbod_12hdd_randrw_64k() { jbod_12hdd randrw sync 0 64k; }
jbod_12hdd_randwrite_4k() { jbod_12hdd randwrite sync 0 4k; }
jbod_12hdd_randwrite_64k() { jbod_12hdd randwrite sync 0 64k; }
jbod_12hdd_mmap_randrw_4k() { jbod_12hdd randrw mmap 0 4k; }
jbod_12hdd_mmap_randrw_64k() { jbod_12hdd randrw mmap 0 64k; }
jbod_12hdd_mmap_randwrite_4k() { jbod_12hdd randwrite mmap 0 4k; }
jbod_12hdd_mmap_randwrite_64k() { jbod_12hdd randwrite mmap 0 64k; }
jbod_12hdd_fallocate_randrw_4k() { jbod_12hdd randrw sync 1 4k; }
jbod_12hdd_fallocate_randrw_64k() { jbod_12hdd randrw sync 1 64k; }
jbod_12hdd_fallocate_randwrite_4k() { jbod_12hdd randwrite sync 1 4k; }
jbod_12hdd_fallocate_randwrite_64k() { jbod_12hdd randwrite sync 1 64k; }
jbod_12hdd_fallocate_mmap_randrw_4k() { jbod_12hdd randrw mmap 1 4k; }
jbod_12hdd_fallocate_mmap_randrw_64k() { jbod_12hdd randrw mmap 1 64k; }
jbod_12hdd_fallocate_mmap_randwrite_4k() { jbod_12hdd randwrite mmap 1 4k; }
jbod_12hdd_fallocate_mmap_randwrite_64k() { jbod_12hdd randwrite mmap 1 64k; }
dd_job() {
job=${nr_dd}dd
[[ $dd_opt ]] && job+=":$dd_opt"
echo $job
}
thresh() {
local dirty_thresh=$1
local unit=$2
local ndisk=${3:-1}
local array=${4:-JBOD}
local bits output_dir bg_dirty_thresh bg_name storage_prefix
[[ $dirty_thresh =~ : ]] && {
bg_dirty_thresh=${dirty_thresh##*:}
dirty_thresh=${dirty_thresh%%:*}
bg_name=":${bg_dirty_thresh}${unit}"
}
# not meaningful to run too many dd's for NFS and low memory system
[[ $nr_dd -gt 10 && $fstype = nfs ]] && return
[[ $nr_dd -gt 10 && $dirty_thresh -lt 100 && $unit = M ]] && return
# in case the test box has more devices than necessary for current case
devices=$(echo $devices | cut -f-$ndisk -d' ')
ndisk=$(echo $devices | wc -w)
if (( $ndisk == 1 )); then
[[ $storage != HDD ]] && storage_prefix=$storage-
output_dir="${storage_prefix}thresh=${dirty_thresh}${unit}${bg_name}"
else
output_dir="$array-${ndisk}${storage}-thresh=${dirty_thresh}${unit}${bg_name}"
fi
check_partition_size $devices || return
make_dir $output_dir $(dd_job) || return
(( $ndisk > 1 )) && RAID_LEVEL=${array,,*}
[[ $unit = M || $unit = m ]] && bits=20
[[ $unit = G || $unit = g ]] && bits=30
[[ $bg_dirty_thresh ]] && {
echo $((bg_dirty_thresh<<bits)) > /proc/sys/vm/dirty_background_bytes
}
echo $((dirty_thresh<<bits)) > /proc/sys/vm/dirty_bytes
[[ $fstype = nfs ]] && {
echo $((dirty_thresh<<(bits - 13))) > /proc/sys/fs/nfs/nfs_congestion_kb
}
run_test dd
}
thresh_0() { thresh 0; }
thresh_1m() { thresh 1 M; }
thresh_10m() { thresh 10 M; }
thresh_100m() { thresh 100 M; }
thresh_1000m() { thresh 1000 M; }
thresh_2g() { thresh 2 G; }
thresh_4g() { thresh 4 G; }
thresh_8g() { thresh 8 G; }
thresh_1g() { thresh 1 G; }
thresh_10g() { thresh 10 G; }
thresh_100g() { thresh 100 G; }
thresh_1000g() { thresh 1000 G; }
thresh_1000m_999m() { thresh 1000:999 M; }
thresh_1000m_990m() { thresh 1000:990 M; }
jbod_2hdd_thresh_1m() { thresh 1 M 2; }
jbod_2hdd_thresh_10m() { thresh 10 M 2; }
jbod_2hdd_thresh_100m() { thresh 100 M 2; }
jbod_2hdd_thresh_1000m() { thresh 1000 M 2; }
jbod_4hdd_thresh_1m() { thresh 1 M 4; }
jbod_4hdd_thresh_10m() { thresh 10 M 4; }
jbod_4hdd_thresh_100m() { thresh 100 M 4; }
jbod_4hdd_thresh_1000m() { thresh 1000 M 4; }
jbod_4hdd_thresh_1g() { thresh 1 G 4; }
jbod_4hdd_thresh_2g() { thresh 2 G 4; }
jbod_4hdd_thresh_4g() { thresh 4 G 4; }
jbod_4hdd_thresh_8g() { thresh 8 G 4; }
jbod_4hdd_thresh_10g() { thresh 10 G 4; }
jbod_4hdd_thresh_100g() { thresh 100 G 4; }
jbod_4hdd_thresh_1000g() { thresh 1000 G 4; }
jbod_10hdd_thresh_1m() { thresh 1 M 10; }
jbod_10hdd_thresh_10m() { thresh 10 M 10; }
jbod_10hdd_thresh_100m() { thresh 100 M 10; }
jbod_10hdd_thresh_1000m() { thresh 1000 M 10; }
jbod_10hdd_thresh_1g() { thresh 1 G 10; }
jbod_10hdd_thresh_2g() { thresh 2 G 10; }
jbod_10hdd_thresh_4g() { thresh 4 G 10; }
jbod_10hdd_thresh_8g() { thresh 8 G 10; }
jbod_10hdd_thresh_10g() { thresh 10 G 10; }
jbod_10hdd_thresh_100g() { thresh 100 G 10; }
jbod_10hdd_thresh_1000g() { thresh 1000 G 10; }
jbod_12hdd_thresh_1m() { thresh 1 M 12; }
jbod_12hdd_thresh_10m() { thresh 10 M 12; }
jbod_12hdd_thresh_100m() { thresh 100 M 12; }
jbod_12hdd_thresh_1000m() { thresh 1000 M 12; }
jbod_12hdd_thresh_1g() { thresh 1 G 12; }
jbod_12hdd_thresh_2g() { thresh 2 G 12; }
jbod_12hdd_thresh_4g() { thresh 4 G 12; }
jbod_12hdd_thresh_8g() { thresh 8 G 12; }
jbod_12hdd_thresh_10g() { thresh 10 G 12; }
jbod_12hdd_thresh_100g() { thresh 100 G 12; }
jbod_12hdd_thresh_1000g() { thresh 1000 G 12; }
raid0_2hdd_thresh_1m() { thresh 1 M 2 RAID0; }
raid0_2hdd_thresh_10m() { thresh 10 M 2 RAID0; }
raid0_2hdd_thresh_100m() { thresh 100 M 2 RAID0; }
raid0_2hdd_thresh_1000m() { thresh 1000 M 2 RAID0; }
raid0_4hdd_thresh_1m() { thresh 1 M 4 RAID0; }
raid0_4hdd_thresh_10m() { thresh 10 M 4 RAID0; }
raid0_4hdd_thresh_100m() { thresh 100 M 4 RAID0; }
raid0_4hdd_thresh_1000m() { thresh 1000 M 4 RAID0; }
raid0_4hdd_thresh_1g() { thresh 1 G 4 RAID0; }
raid0_4hdd_thresh_2g() { thresh 2 G 4 RAID0; }
raid0_4hdd_thresh_4g() { thresh 4 G 4 RAID0; }
raid0_4hdd_thresh_8g() { thresh 8 G 4 RAID0; }
raid0_4hdd_thresh_10g() { thresh 10 G 4 RAID0; }
raid0_4hdd_thresh_100g() { thresh 100 G 4 RAID0; }
raid0_4hdd_thresh_1000g() { thresh 1000 G 4 RAID0; }
raid0_10hdd_thresh_1m() { thresh 1 M 10 RAID0; }
raid0_10hdd_thresh_10m() { thresh 10 M 10 RAID0; }
raid0_10hdd_thresh_100m() { thresh 100 M 10 RAID0; }
raid0_10hdd_thresh_1000m() { thresh 1000 M 10 RAID0; }
raid0_10hdd_thresh_1g() { thresh 1 G 10 RAID0; }
raid0_10hdd_thresh_2g() { thresh 2 G 10 RAID0; }
raid0_10hdd_thresh_4g() { thresh 4 G 10 RAID0; }
raid0_10hdd_thresh_8g() { thresh 8 G 10 RAID0; }
raid0_10hdd_thresh_10g() { thresh 10 G 10 RAID0; }
raid0_10hdd_thresh_100g() { thresh 100 G 10 RAID0; }
raid0_10hdd_thresh_1000g() { thresh 1000 G 10 RAID0; }
raid0_12hdd_thresh_1m() { thresh 1 M 12 RAID0; }
raid0_12hdd_thresh_10m() { thresh 10 M 12 RAID0; }
raid0_12hdd_thresh_100m() { thresh 100 M 12 RAID0; }
raid0_12hdd_thresh_1000m() { thresh 1000 M 12 RAID0; }
raid0_12hdd_thresh_1g() { thresh 1 G 12 RAID0; }
raid0_12hdd_thresh_2g() { thresh 2 G 12 RAID0; }
raid0_12hdd_thresh_4g() { thresh 4 G 12 RAID0; }
raid0_12hdd_thresh_8g() { thresh 8 G 12 RAID0; }
raid0_12hdd_thresh_10g() { thresh 10 G 12 RAID0; }
raid0_12hdd_thresh_100g() { thresh 100 G 12 RAID0; }
raid0_12hdd_thresh_1000g() { thresh 1000 G 12 RAID0; }
raid1_2hdd_thresh_1m() { thresh 1 M 2 RAID1; }
raid1_2hdd_thresh_10m() { thresh 10 M 2 RAID1; }
raid1_2hdd_thresh_100m() { thresh 100 M 2 RAID1; }
raid1_2hdd_thresh_1000m() { thresh 1000 M 2 RAID1; }
raid5_4hdd_thresh_1m() { thresh 1 M 4 RAID5; }
raid5_4hdd_thresh_10m() { thresh 10 M 4 RAID5; }
raid5_4hdd_thresh_100m() { thresh 100 M 4 RAID5; }
raid5_4hdd_thresh_1000m() { thresh 1000 M 4 RAID5; }
raid5_4hdd_thresh_1g() { thresh 1 G 4 RAID5; }
raid5_4hdd_thresh_2g() { thresh 2 G 4 RAID5; }
raid5_4hdd_thresh_4g() { thresh 4 G 4 RAID5; }
raid5_4hdd_thresh_8g() { thresh 8 G 4 RAID5; }
raid5_4hdd_thresh_10g() { thresh 10 G 4 RAID5; }
raid5_4hdd_thresh_100g() { thresh 100 G 4 RAID5; }
raid5_4hdd_thresh_1000g() { thresh 1000 G 4 RAID5; }
raid5_10hdd_thresh_1m() { thresh 1 M 10 RAID5; }
raid5_10hdd_thresh_10m() { thresh 10 M 10 RAID5; }
raid5_10hdd_thresh_100m() { thresh 100 M 10 RAID5; }
raid5_10hdd_thresh_1000m() { thresh 1000 M 10 RAID5; }
raid5_10hdd_thresh_1g() { thresh 1 G 10 RAID5; }
raid5_10hdd_thresh_2g() { thresh 2 G 10 RAID5; }
raid5_10hdd_thresh_4g() { thresh 4 G 10 RAID5; }
raid5_10hdd_thresh_8g() { thresh 8 G 10 RAID5; }
raid5_10hdd_thresh_10g() { thresh 10 G 10 RAID5; }
raid5_10hdd_thresh_100g() { thresh 100 G 10 RAID5; }
raid5_10hdd_thresh_1000g() { thresh 1000 G 10 RAID5; }
raid5_12hdd_thresh_1m() { thresh 1 M 12 RAID5; }
raid5_12hdd_thresh_10m() { thresh 10 M 12 RAID5; }
raid5_12hdd_thresh_100m() { thresh 100 M 12 RAID5; }
raid5_12hdd_thresh_1000m() { thresh 1000 M 12 RAID5; }
raid5_12hdd_thresh_1g() { thresh 1 G 12 RAID5; }
raid5_12hdd_thresh_2g() { thresh 2 G 12 RAID5; }
raid5_12hdd_thresh_4g() { thresh 4 G 12 RAID5; }
raid5_12hdd_thresh_8g() { thresh 8 G 12 RAID5; }
raid5_12hdd_thresh_10g() { thresh 10 G 12 RAID5; }
raid5_12hdd_thresh_100g() { thresh 100 G 12 RAID5; }
raid5_12hdd_thresh_1000g() { thresh 1000 G 12 RAID5; }
mem() {
for i in $(</proc/cmdline)
do
[[ $i =~ "mem=" ]] && mem=$i
done
make_dir $mem $(dd_job) || return
run_test dd
}