summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2019-09-09 23:57:11 -0400
committerSteve French <stfrench@microsoft.com>2019-09-16 12:43:38 -0400
commit1b63f1840e787516bf2d3e5c27c2d22fe23cfb37 (patch)
tree7e3413e58f1cf0a5bd3b577dfbee90b365a7b9cf
parent10328c44cc1506dd82fd835efcaafd519866c464 (diff)
smb3: display max smb3 requests in flight at any one time
Displayed in /proc/fs/cifs/Stats once for each socket we are connected to. This allows us to find out what the maximum number of requests that had been in flight (at any one time). Note that /proc/fs/cifs/Stats can be reset if you want to look for maximum over a small period of time. Sample output (immediately after mount): Resources in use CIFS Session: 1 Share (unique mount targets): 2 SMB Request/Response Buffer: 1 Pool size: 5 SMB Small Req/Resp Buffer: 1 Pool size: 30 Operations (MIDs): 0 0 session 0 share reconnects Total vfs operations: 5 maximum at one time: 2 Max requests in flight: 2 1) \\localhost\scratch SMBs: 18 Bytes read: 0 Bytes written: 0 ... Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
-rw-r--r--fs/cifs/cifs_debug.c2
-rw-r--r--fs/cifs/cifsglob.h1
-rw-r--r--fs/cifs/connect.c1
-rw-r--r--fs/cifs/smb2ops.c2
-rw-r--r--fs/cifs/transport.c4
5 files changed, 10 insertions, 0 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index a38d796f5ffe..0b4eee3bed66 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -452,6 +452,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,
452 list_for_each(tmp1, &cifs_tcp_ses_list) { 452 list_for_each(tmp1, &cifs_tcp_ses_list) {
453 server = list_entry(tmp1, struct TCP_Server_Info, 453 server = list_entry(tmp1, struct TCP_Server_Info,
454 tcp_ses_list); 454 tcp_ses_list);
455 server->max_in_flight = 0;
455#ifdef CONFIG_CIFS_STATS2 456#ifdef CONFIG_CIFS_STATS2
456 for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) { 457 for (i = 0; i < NUMBER_OF_SMB2_COMMANDS; i++) {
457 atomic_set(&server->num_cmds[i], 0); 458 atomic_set(&server->num_cmds[i], 0);
@@ -526,6 +527,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
526 list_for_each(tmp1, &cifs_tcp_ses_list) { 527 list_for_each(tmp1, &cifs_tcp_ses_list) {
527 server = list_entry(tmp1, struct TCP_Server_Info, 528 server = list_entry(tmp1, struct TCP_Server_Info,
528 tcp_ses_list); 529 tcp_ses_list);
530 seq_printf(m, "\nMax requests in flight: %d", server->max_in_flight);
529#ifdef CONFIG_CIFS_STATS2 531#ifdef CONFIG_CIFS_STATS2
530 seq_puts(m, "\nTotal time spent processing by command. Time "); 532 seq_puts(m, "\nTotal time spent processing by command. Time ");
531 seq_printf(m, "units are jiffies (%d per second)\n", HZ); 533 seq_printf(m, "units are jiffies (%d per second)\n", HZ);
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 6987fbc5a24a..ef2199913217 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -677,6 +677,7 @@ struct TCP_Server_Info {
677 unsigned int credits; /* send no more requests at once */ 677 unsigned int credits; /* send no more requests at once */
678 unsigned int max_credits; /* can override large 32000 default at mnt */ 678 unsigned int max_credits; /* can override large 32000 default at mnt */
679 unsigned int in_flight; /* number of requests on the wire to server */ 679 unsigned int in_flight; /* number of requests on the wire to server */
680 unsigned int max_in_flight; /* max number of requests that were on wire */
680 spinlock_t req_lock; /* protect the two values above */ 681 spinlock_t req_lock; /* protect the two values above */
681 struct mutex srv_mutex; 682 struct mutex srv_mutex;
682 struct task_struct *tsk; 683 struct task_struct *tsk;
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index e70112d67b0e..df1ccb581828 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2728,6 +2728,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
2728 tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay; 2728 tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay;
2729 tcp_ses->rdma = volume_info->rdma; 2729 tcp_ses->rdma = volume_info->rdma;
2730 tcp_ses->in_flight = 0; 2730 tcp_ses->in_flight = 0;
2731 tcp_ses->max_in_flight = 0;
2731 tcp_ses->credits = 1; 2732 tcp_ses->credits = 1;
2732 init_waitqueue_head(&tcp_ses->response_q); 2733 init_waitqueue_head(&tcp_ses->response_q);
2733 init_waitqueue_head(&tcp_ses->request_q); 2734 init_waitqueue_head(&tcp_ses->request_q);
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 72b3e39d7f4f..9b74149b471f 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -203,6 +203,8 @@ smb2_wait_mtu_credits(struct TCP_Server_Info *server, unsigned int size,
203 credits->instance = server->reconnect_instance; 203 credits->instance = server->reconnect_instance;
204 server->credits -= credits->value; 204 server->credits -= credits->value;
205 server->in_flight++; 205 server->in_flight++;
206 if (server->in_flight > server->max_in_flight)
207 server->max_in_flight = server->in_flight;
206 break; 208 break;
207 } 209 }
208 } 210 }
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 4fccb90492e9..308ad0f495e1 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -532,6 +532,8 @@ wait_for_free_credits(struct TCP_Server_Info *server, const int num_credits,
532 if ((flags & CIFS_TIMEOUT_MASK) == CIFS_NON_BLOCKING) { 532 if ((flags & CIFS_TIMEOUT_MASK) == CIFS_NON_BLOCKING) {
533 /* oplock breaks must not be held up */ 533 /* oplock breaks must not be held up */
534 server->in_flight++; 534 server->in_flight++;
535 if (server->in_flight > server->max_in_flight)
536 server->max_in_flight = server->in_flight;
535 *credits -= 1; 537 *credits -= 1;
536 *instance = server->reconnect_instance; 538 *instance = server->reconnect_instance;
537 spin_unlock(&server->req_lock); 539 spin_unlock(&server->req_lock);
@@ -608,6 +610,8 @@ wait_for_free_credits(struct TCP_Server_Info *server, const int num_credits,
608 if ((flags & CIFS_TIMEOUT_MASK) != CIFS_BLOCKING_OP) { 610 if ((flags & CIFS_TIMEOUT_MASK) != CIFS_BLOCKING_OP) {
609 *credits -= num_credits; 611 *credits -= num_credits;
610 server->in_flight += num_credits; 612 server->in_flight += num_credits;
613 if (server->in_flight > server->max_in_flight)
614 server->max_in_flight = server->in_flight;
611 *instance = server->reconnect_instance; 615 *instance = server->reconnect_instance;
612 } 616 }
613 spin_unlock(&server->req_lock); 617 spin_unlock(&server->req_lock);