aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2ops.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2012-05-28 07:19:39 -0400
committerPavel Shilovsky <pshilovsky@samba.org>2012-07-24 13:55:20 -0400
commitd60622eb5a23904facf4a4efac60f5bfa810d7d4 (patch)
tree9906729a6aa59d6191a715942a447837c79aa758 /fs/cifs/smb2ops.c
parent44c581866e2ae4bbc3c8eea5a3e3c7a0f639e12d (diff)
CIFS: Allow SMB2 statistics to be tracked
Since there are only 19 command codes, it also is easier to track by exact command code than it was for cifs. Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb2ops.c')
-rw-r--r--fs/cifs/smb2ops.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 483bd0ba2ecb..1018c5c6b5be 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -213,6 +213,85 @@ smb2_can_echo(struct TCP_Server_Info *server)
213 return server->echoes; 213 return server->echoes;
214} 214}
215 215
216static void
217smb2_clear_stats(struct cifs_tcon *tcon)
218{
219#ifdef CONFIG_CIFS_STATS
220 int i;
221 for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
222 atomic_set(&tcon->stats.smb2_stats.smb2_com_sent[i], 0);
223 atomic_set(&tcon->stats.smb2_stats.smb2_com_failed[i], 0);
224 }
225#endif
226}
227
228static void
229smb2_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
230{
231#ifdef CONFIG_CIFS_STATS
232 atomic_t *sent = tcon->stats.smb2_stats.smb2_com_sent;
233 atomic_t *failed = tcon->stats.smb2_stats.smb2_com_failed;
234 seq_printf(m, "\nNegotiates: %d sent %d failed",
235 atomic_read(&sent[SMB2_NEGOTIATE_HE]),
236 atomic_read(&failed[SMB2_NEGOTIATE_HE]));
237 seq_printf(m, "\nSessionSetups: %d sent %d failed",
238 atomic_read(&sent[SMB2_SESSION_SETUP_HE]),
239 atomic_read(&failed[SMB2_SESSION_SETUP_HE]));
240#define SMB2LOGOFF 0x0002 /* trivial request/resp */
241 seq_printf(m, "\nLogoffs: %d sent %d failed",
242 atomic_read(&sent[SMB2_LOGOFF_HE]),
243 atomic_read(&failed[SMB2_LOGOFF_HE]));
244 seq_printf(m, "\nTreeConnects: %d sent %d failed",
245 atomic_read(&sent[SMB2_TREE_CONNECT_HE]),
246 atomic_read(&failed[SMB2_TREE_CONNECT_HE]));
247 seq_printf(m, "\nTreeDisconnects: %d sent %d failed",
248 atomic_read(&sent[SMB2_TREE_DISCONNECT_HE]),
249 atomic_read(&failed[SMB2_TREE_DISCONNECT_HE]));
250 seq_printf(m, "\nCreates: %d sent %d failed",
251 atomic_read(&sent[SMB2_CREATE_HE]),
252 atomic_read(&failed[SMB2_CREATE_HE]));
253 seq_printf(m, "\nCloses: %d sent %d failed",
254 atomic_read(&sent[SMB2_CLOSE_HE]),
255 atomic_read(&failed[SMB2_CLOSE_HE]));
256 seq_printf(m, "\nFlushes: %d sent %d failed",
257 atomic_read(&sent[SMB2_FLUSH_HE]),
258 atomic_read(&failed[SMB2_FLUSH_HE]));
259 seq_printf(m, "\nReads: %d sent %d failed",
260 atomic_read(&sent[SMB2_READ_HE]),
261 atomic_read(&failed[SMB2_READ_HE]));
262 seq_printf(m, "\nWrites: %d sent %d failed",
263 atomic_read(&sent[SMB2_WRITE_HE]),
264 atomic_read(&failed[SMB2_WRITE_HE]));
265 seq_printf(m, "\nLocks: %d sent %d failed",
266 atomic_read(&sent[SMB2_LOCK_HE]),
267 atomic_read(&failed[SMB2_LOCK_HE]));
268 seq_printf(m, "\nIOCTLs: %d sent %d failed",
269 atomic_read(&sent[SMB2_IOCTL_HE]),
270 atomic_read(&failed[SMB2_IOCTL_HE]));
271 seq_printf(m, "\nCancels: %d sent %d failed",
272 atomic_read(&sent[SMB2_CANCEL_HE]),
273 atomic_read(&failed[SMB2_CANCEL_HE]));
274 seq_printf(m, "\nEchos: %d sent %d failed",
275 atomic_read(&sent[SMB2_ECHO_HE]),
276 atomic_read(&failed[SMB2_ECHO_HE]));
277 seq_printf(m, "\nQueryDirectories: %d sent %d failed",
278 atomic_read(&sent[SMB2_QUERY_DIRECTORY_HE]),
279 atomic_read(&failed[SMB2_QUERY_DIRECTORY_HE]));
280 seq_printf(m, "\nChangeNotifies: %d sent %d failed",
281 atomic_read(&sent[SMB2_CHANGE_NOTIFY_HE]),
282 atomic_read(&failed[SMB2_CHANGE_NOTIFY_HE]));
283 seq_printf(m, "\nQueryInfos: %d sent %d failed",
284 atomic_read(&sent[SMB2_QUERY_INFO_HE]),
285 atomic_read(&failed[SMB2_QUERY_INFO_HE]));
286 seq_printf(m, "\nSetInfos: %d sent %d failed",
287 atomic_read(&sent[SMB2_SET_INFO_HE]),
288 atomic_read(&failed[SMB2_SET_INFO_HE]));
289 seq_printf(m, "\nOplockBreaks: %d sent %d failed",
290 atomic_read(&sent[SMB2_OPLOCK_BREAK_HE]),
291 atomic_read(&failed[SMB2_OPLOCK_BREAK_HE]));
292#endif
293}
294
216struct smb_version_operations smb21_operations = { 295struct smb_version_operations smb21_operations = {
217 .setup_request = smb2_setup_request, 296 .setup_request = smb2_setup_request,
218 .setup_async_request = smb2_setup_async_request, 297 .setup_async_request = smb2_setup_async_request,
@@ -225,6 +304,8 @@ struct smb_version_operations smb21_operations = {
225 .find_mid = smb2_find_mid, 304 .find_mid = smb2_find_mid,
226 .check_message = smb2_check_message, 305 .check_message = smb2_check_message,
227 .dump_detail = smb2_dump_detail, 306 .dump_detail = smb2_dump_detail,
307 .clear_stats = smb2_clear_stats,
308 .print_stats = smb2_print_stats,
228 .need_neg = smb2_need_neg, 309 .need_neg = smb2_need_neg,
229 .negotiate = smb2_negotiate, 310 .negotiate = smb2_negotiate,
230 .sess_setup = SMB2_sess_setup, 311 .sess_setup = SMB2_sess_setup,