diff options
author | Steve French <sfrench@us.ibm.com> | 2005-10-07 12:51:05 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-10-07 12:51:05 -0400 |
commit | 131afd0b748e382c3a00355d3fa245801f929298 (patch) | |
tree | 1581222aa48c6610877b3cc3bd5a4d275a6a68cd | |
parent | dd99cd803d460576cf84f012786ff39814b73f7f (diff) |
[CIFS] /proc/fs/cifs debug code cleanup and new stats2
These changes to debug code and new stats are helpful in
debugging potential tcp performance/configuration problems under cifs.
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | fs/cifs/cifs_debug.c | 16 | ||||
-rw-r--r-- | fs/cifs/cifsglob.h | 6 | ||||
-rw-r--r-- | fs/cifs/transport.c | 24 |
3 files changed, 41 insertions, 5 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index f4c6544468ab..785239618d89 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c | |||
@@ -81,6 +81,8 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, | |||
81 | buf += length; | 81 | buf += length; |
82 | length = sprintf(buf,"CIFS Version %s\n",CIFS_VERSION); | 82 | length = sprintf(buf,"CIFS Version %s\n",CIFS_VERSION); |
83 | buf += length; | 83 | buf += length; |
84 | length = sprintf(buf,"Active VFS Requests: %d\n", GlobalTotalActiveXid); | ||
85 | buf += length; | ||
84 | length = sprintf(buf, "Servers:"); | 86 | length = sprintf(buf, "Servers:"); |
85 | buf += length; | 87 | buf += length; |
86 | 88 | ||
@@ -97,7 +99,7 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, | |||
97 | } else { | 99 | } else { |
98 | length = | 100 | length = |
99 | sprintf(buf, | 101 | sprintf(buf, |
100 | "\n%d) Name: %s Domain: %s Mounts: %d ServerOS: %s \n\tServerNOS: %s\tCapabilities: 0x%x\n\tSMB session status: %d\t", | 102 | "\n%d) Name: %s Domain: %s Mounts: %d OS: %s \n\tNOS: %s\tCapability: 0x%x\n\tSMB session status: %d\t", |
101 | i, ses->serverName, ses->serverDomain, | 103 | i, ses->serverName, ses->serverDomain, |
102 | atomic_read(&ses->inUse), | 104 | atomic_read(&ses->inUse), |
103 | ses->serverOS, ses->serverNOS, | 105 | ses->serverOS, ses->serverNOS, |
@@ -105,12 +107,18 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, | |||
105 | buf += length; | 107 | buf += length; |
106 | } | 108 | } |
107 | if(ses->server) { | 109 | if(ses->server) { |
108 | buf += sprintf(buf, "TCP status: %d\n\tLocal Users To Server: %d SecMode: 0x%x Req Active: %d", | 110 | buf += sprintf(buf, "TCP status: %d\n\tLocal Users To Server: %d SecMode: 0x%x Req On Wire: %d", |
109 | ses->server->tcpStatus, | 111 | ses->server->tcpStatus, |
110 | atomic_read(&ses->server->socketUseCount), | 112 | atomic_read(&ses->server->socketUseCount), |
111 | ses->server->secMode, | 113 | ses->server->secMode, |
112 | atomic_read(&ses->server->inFlight)); | 114 | atomic_read(&ses->server->inFlight)); |
113 | 115 | ||
116 | #ifdef CONFIG_CIFS_STATS2 | ||
117 | buf += sprintf(buf, "\tIn Send: %d In MaxReq Wait: %d", | ||
118 | atomic_read(&ses->server->inSend), | ||
119 | atomic_read(&ses->server->num_waiters)); | ||
120 | #endif | ||
121 | |||
114 | length = sprintf(buf, "\nMIDs:\n"); | 122 | length = sprintf(buf, "\nMIDs:\n"); |
115 | buf += length; | 123 | buf += length; |
116 | 124 | ||
@@ -149,7 +157,7 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset, | |||
149 | dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); | 157 | dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); |
150 | length = | 158 | length = |
151 | sprintf(buf, | 159 | sprintf(buf, |
152 | "\n%d) %s Uses: %d Type: %s Characteristics: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d", | 160 | "\n%d) %s Uses: %d Type: %s DevInfo: 0x%x Attributes: 0x%x\nPathComponentMax: %d Status: %d", |
153 | i, tcon->treeName, | 161 | i, tcon->treeName, |
154 | atomic_read(&tcon->useCount), | 162 | atomic_read(&tcon->useCount), |
155 | tcon->nativeFileSystem, | 163 | tcon->nativeFileSystem, |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index cd421c76805e..729717281b40 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -123,13 +123,17 @@ struct TCP_Server_Info { | |||
123 | struct list_head pending_mid_q; | 123 | struct list_head pending_mid_q; |
124 | void *Server_NlsInfo; /* BB - placeholder for future NLS info */ | 124 | void *Server_NlsInfo; /* BB - placeholder for future NLS info */ |
125 | unsigned short server_codepage; /* codepage for the server */ | 125 | unsigned short server_codepage; /* codepage for the server */ |
126 | unsigned long ip_address; /* IP addr for the server if known */ | 126 | unsigned long ip_address; /* IP addr for the server if known */ |
127 | enum protocolEnum protocolType; | 127 | enum protocolEnum protocolType; |
128 | char versionMajor; | 128 | char versionMajor; |
129 | char versionMinor; | 129 | char versionMinor; |
130 | unsigned svlocal:1; /* local server or remote */ | 130 | unsigned svlocal:1; /* local server or remote */ |
131 | atomic_t socketUseCount; /* number of open cifs sessions on socket */ | 131 | atomic_t socketUseCount; /* number of open cifs sessions on socket */ |
132 | atomic_t inFlight; /* number of requests on the wire to server */ | 132 | atomic_t inFlight; /* number of requests on the wire to server */ |
133 | #ifdef CONFIG_CIFS_STATS2 | ||
134 | atomic_t inSend; /* requests trying to send */ | ||
135 | atomic_t num_waiters; /* blocked waiting to get in sendrecv */ | ||
136 | #endif | ||
133 | enum statusEnum tcpStatus; /* what we think the status is */ | 137 | enum statusEnum tcpStatus; /* what we think the status is */ |
134 | struct semaphore tcpSem; | 138 | struct semaphore tcpSem; |
135 | struct task_struct *tsk; | 139 | struct task_struct *tsk; |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index c86b7077b92f..893a6fef9853 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -307,9 +307,15 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
307 | if(atomic_read(&ses->server->inFlight) >= | 307 | if(atomic_read(&ses->server->inFlight) >= |
308 | cifs_max_pending){ | 308 | cifs_max_pending){ |
309 | spin_unlock(&GlobalMid_Lock); | 309 | spin_unlock(&GlobalMid_Lock); |
310 | #ifdef CONFIG_CIFS_STATS2 | ||
311 | atomic_inc(&ses->server->num_waiters); | ||
312 | #endif | ||
310 | wait_event(ses->server->request_q, | 313 | wait_event(ses->server->request_q, |
311 | atomic_read(&ses->server->inFlight) | 314 | atomic_read(&ses->server->inFlight) |
312 | < cifs_max_pending); | 315 | < cifs_max_pending); |
316 | #ifdef CONFIG_CIFS_STATS2 | ||
317 | atomic_dec(&ses->server->num_waiters); | ||
318 | #endif | ||
313 | spin_lock(&GlobalMid_Lock); | 319 | spin_lock(&GlobalMid_Lock); |
314 | } else { | 320 | } else { |
315 | if(ses->server->tcpStatus == CifsExiting) { | 321 | if(ses->server->tcpStatus == CifsExiting) { |
@@ -365,8 +371,14 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
365 | /* rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number); */ | 371 | /* rc = cifs_sign_smb2(iov, n_vec, ses->server, &midQ->sequence_number); */ |
366 | 372 | ||
367 | midQ->midState = MID_REQUEST_SUBMITTED; | 373 | midQ->midState = MID_REQUEST_SUBMITTED; |
374 | #ifdef CONFIG_CIFS_STATS2 | ||
375 | atomic_inc(&ses->server->inSend); | ||
376 | #endif | ||
368 | rc = smb_send2(ses->server->ssocket, iov, n_vec, | 377 | rc = smb_send2(ses->server->ssocket, iov, n_vec, |
369 | (struct sockaddr *) &(ses->server->addr.sockAddr)); | 378 | (struct sockaddr *) &(ses->server->addr.sockAddr)); |
379 | #ifdef CONFIG_CIFS_STATS2 | ||
380 | atomic_dec(&ses->server->inSend); | ||
381 | #endif | ||
370 | if(rc < 0) { | 382 | if(rc < 0) { |
371 | DeleteMidQEntry(midQ); | 383 | DeleteMidQEntry(midQ); |
372 | up(&ses->server->tcpSem); | 384 | up(&ses->server->tcpSem); |
@@ -546,9 +558,15 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
546 | if(atomic_read(&ses->server->inFlight) >= | 558 | if(atomic_read(&ses->server->inFlight) >= |
547 | cifs_max_pending){ | 559 | cifs_max_pending){ |
548 | spin_unlock(&GlobalMid_Lock); | 560 | spin_unlock(&GlobalMid_Lock); |
561 | #ifdef CONFIG_CIFS_STATS2 | ||
562 | atomic_inc(&ses->server->num_waiters); | ||
563 | #endif | ||
549 | wait_event(ses->server->request_q, | 564 | wait_event(ses->server->request_q, |
550 | atomic_read(&ses->server->inFlight) | 565 | atomic_read(&ses->server->inFlight) |
551 | < cifs_max_pending); | 566 | < cifs_max_pending); |
567 | #ifdef CONFIG_CIFS_STATS2 | ||
568 | atomic_dec(&ses->server->num_waiters); | ||
569 | #endif | ||
552 | spin_lock(&GlobalMid_Lock); | 570 | spin_lock(&GlobalMid_Lock); |
553 | } else { | 571 | } else { |
554 | if(ses->server->tcpStatus == CifsExiting) { | 572 | if(ses->server->tcpStatus == CifsExiting) { |
@@ -617,8 +635,14 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
617 | rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number); | 635 | rc = cifs_sign_smb(in_buf, ses->server, &midQ->sequence_number); |
618 | 636 | ||
619 | midQ->midState = MID_REQUEST_SUBMITTED; | 637 | midQ->midState = MID_REQUEST_SUBMITTED; |
638 | #ifdef CONFIG_CIFS_STATS2 | ||
639 | atomic_inc(&ses->server->inSend); | ||
640 | #endif | ||
620 | rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, | 641 | rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, |
621 | (struct sockaddr *) &(ses->server->addr.sockAddr)); | 642 | (struct sockaddr *) &(ses->server->addr.sockAddr)); |
643 | #ifdef CONFIG_CIFS_STATS2 | ||
644 | atomic_dec(&ses->server->inSend); | ||
645 | #endif | ||
622 | if(rc < 0) { | 646 | if(rc < 0) { |
623 | DeleteMidQEntry(midQ); | 647 | DeleteMidQEntry(midQ); |
624 | up(&ses->server->tcpSem); | 648 | up(&ses->server->tcpSem); |