-
Notifications
You must be signed in to change notification settings - Fork 2
/
cifsd-fio-test.sh
executable file
·146 lines (112 loc) · 2.6 KB
/
cifsd-fio-test.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
#!/bin/bash
# Sergey Senozhatsky. [email protected]
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# Example:
#
# LOG_SUFFIX=NEW FIO_LOOPS=1 ./cifsd-fio-test.sh
#
LOG=/tmp/test-fio-cifsd
EXT_LOG=0
PERF="perf"
FIO="fio"
function reset_cifsd
{
sudo umount "$MOUNT_POINT"
sudo killall lt-cifsd
killall cifsd
sleep 1s
sudo rmmod cifsd
}
function create_cifsd
{
local NET_SHARE="//${HOST}/${SHARE_NAME}"
local ret
ret=$(sudo modprobe cifsd)
if [ "z$ret" != "z" ]; then
echo "ERROR: CANNOT MODPROBE CIFSD"
exit 1
fi
ret=$(cifsd)
if [ "z$ret" != "z" ]; then
echo "ERROR: CANNOT START USER-SPACE DAEMON"
exit 1
fi
sleep 1s
ret=$(sudo mount -o username=$USER_NAME,password=$USER_PASSWORD,uid=$USER_UID,gid=$USER_GID -t cifs $NET_SHARE $MOUNT_POINT)
if [ "z$ret" != "z" ]; then
echo "ERROR: CANNOT MOUNT NETSHARE"
exit 1
fi
return 0
}
function main
{
local i
source ./conf/cifsd.conf
if [ "z$LOG_SUFFIX" == "z" ]; then
LOG_SUFFIX="UNSET"
fi
LOG="$LOG"-"$LOG_SUFFIX"
if [ "z$MAX_ITER" == "z" ]; then
MAX_ITER=10
fi
if [ "z$MIN_ITER" == "z" ]; then
MIN_ITER=1
fi
if [ "z$FIO_LOOPS" == "z" ]; then
FIO_LOOPS=1
fi
if [ "z$FILE_SIZE" == "z" ]; then
FILE_SIZE="128M"
fi
NOTRACING=""
if [ "z$NO_TRACING" != "z" ]; then
NOTRACING="yes"
fi
FIO_TEMPLATE=./conf/fio-template-static-buffer
echo "Using $FIO_TEMPLATE fio template"
for i in $(seq "$MIN_ITER" "$MAX_ITER"); do
echo $i
reset_cifsd
create_cifsd
sleep 2s
if [ "z$NOTRACING" == "z" ]; then
$(sudo ./tracing-on-off.sh on)
fi
if [ $? != 0 ]; then
echo "Unable to init cifsd"
exit 1
fi
echo "#jobs$i fio"
echo "#jobs$i fio" >> $LOG
_NRFILES=1024
echo "#files $_NRFILES"
MNT_POINT="$MOUNT_POINT" \
SIZE="$FILE_SIZE" \
NUMJOBS="$i" \
FIO_LOOPS="$FIO_LOOPS" \
"$PERF" stat -o "$LOG"-perf-stat \
"$FIO" ./"$FIO_TEMPLATE" >> "$LOG"
if [ "z$NOTRACING" == "z" ]; then
TRACE_NAME="jobs$i-$LOG_SUFFIX"
$(sudo ./tracing-on-off.sh off $TRACE_NAME)
fi
echo -n "perfstat jobs$i" >> "$LOG"
cat "$LOG"-perf-stat >> "$LOG"
done
rm "$LOG"-perf-stat
echo -n "Log files created: $LOG "
echo
reset_cifsd
}
main