aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/cifsglob.h9
-rw-r--r--fs/cifs/smb2ops.c81
-rw-r--r--fs/cifs/smb2pdu.c4
3 files changed, 91 insertions, 3 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 0896328418aa..12b1176b87b0 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -28,6 +28,9 @@
28#include "cifsacl.h" 28#include "cifsacl.h"
29#include <crypto/internal/hash.h> 29#include <crypto/internal/hash.h>
30#include <linux/scatterlist.h> 30#include <linux/scatterlist.h>
31#ifdef CONFIG_CIFS_SMB2
32#include "smb2pdu.h"
33#endif
31 34
32/* 35/*
33 * The sizes of various internal tables and strings 36 * The sizes of various internal tables and strings
@@ -592,6 +595,12 @@ struct cifs_tcon {
592 atomic_t num_acl_get; 595 atomic_t num_acl_get;
593 atomic_t num_acl_set; 596 atomic_t num_acl_set;
594 } cifs_stats; 597 } cifs_stats;
598#ifdef CONFIG_CIFS_SMB2
599 struct {
600 atomic_t smb2_com_sent[NUMBER_OF_SMB2_COMMANDS];
601 atomic_t smb2_com_failed[NUMBER_OF_SMB2_COMMANDS];
602 } smb2_stats;
603#endif /* CONFIG_CIFS_SMB2 */
595 } stats; 604 } stats;
596#ifdef CONFIG_CIFS_STATS2 605#ifdef CONFIG_CIFS_STATS2
597 unsigned long long time_writes; 606 unsigned long long time_writes;
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,
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 373b6945161f..e4eb1d3fb7d9 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -282,10 +282,8 @@ small_smb2_init(__le16 smb2_command, struct cifs_tcon *tcon,
282 282
283 if (tcon != NULL) { 283 if (tcon != NULL) {
284#ifdef CONFIG_CIFS_STATS2 284#ifdef CONFIG_CIFS_STATS2
285 /*
286 uint16_t com_code = le16_to_cpu(smb2_command); 285 uint16_t com_code = le16_to_cpu(smb2_command);
287 cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_sent[com_code]); 286 cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_sent[com_code]);
288 */
289#endif 287#endif
290 cifs_stats_inc(&tcon->num_smbs_sent); 288 cifs_stats_inc(&tcon->num_smbs_sent);
291 } 289 }
@@ -677,7 +675,7 @@ SMB2_logoff(const unsigned int xid, struct cifs_ses *ses)
677 675
678static inline void cifs_stats_fail_inc(struct cifs_tcon *tcon, uint16_t code) 676static inline void cifs_stats_fail_inc(struct cifs_tcon *tcon, uint16_t code)
679{ 677{
680 /* cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[code]); */ 678 cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_failed[code]);
681} 679}
682 680
683#define MAX_SHARENAME_LENGTH (255 /* server */ + 80 /* share */ + 1 /* NULL */) 681#define MAX_SHARENAME_LENGTH (255 /* server */ + 80 /* share */ + 1 /* NULL */)