aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-10-11 22:58:06 -0400
committerSteve French <sfrench@us.ibm.com>2005-10-11 22:58:06 -0400
commit1047abc159b4eb4ba4a7342a0969e16e9d4b4c69 (patch)
tree532cf6200f2c63869f006dfad2b41d9d408a9a59 /fs/cifs/transport.c
parent4ca9c190d902caa7efb899a4c7fc8c6e6d926e95 (diff)
[CIFS] CIFS Stats improvements
New cifs_writepages routine was not updated bytes written in cifs stats. Also added ability to clear /proc/fs/cifs/Stats by writing (0 or 1) to it. Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index d8865fbd876a..981ea0d8b9cd 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -59,7 +59,9 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
59 temp->pid = current->pid; 59 temp->pid = current->pid;
60 temp->command = smb_buffer->Command; 60 temp->command = smb_buffer->Command;
61 cFYI(1, ("For smb_command %d", temp->command)); 61 cFYI(1, ("For smb_command %d", temp->command));
62 do_gettimeofday(&temp->when_sent); 62 /* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */
63 /* when mid allocated can be before when sent */
64 temp->when_alloc = jiffies;
63 temp->ses = ses; 65 temp->ses = ses;
64 temp->tsk = current; 66 temp->tsk = current;
65 } 67 }
@@ -75,6 +77,9 @@ AllocMidQEntry(struct smb_hdr *smb_buffer, struct cifsSesInfo *ses)
75static void 77static void
76DeleteMidQEntry(struct mid_q_entry *midEntry) 78DeleteMidQEntry(struct mid_q_entry *midEntry)
77{ 79{
80#ifdef CONFIG_CIFS_STATS2
81 unsigned long now;
82#endif
78 spin_lock(&GlobalMid_Lock); 83 spin_lock(&GlobalMid_Lock);
79 midEntry->midState = MID_FREE; 84 midEntry->midState = MID_FREE;
80 list_del(&midEntry->qhead); 85 list_del(&midEntry->qhead);
@@ -84,6 +89,22 @@ DeleteMidQEntry(struct mid_q_entry *midEntry)
84 cifs_buf_release(midEntry->resp_buf); 89 cifs_buf_release(midEntry->resp_buf);
85 else 90 else
86 cifs_small_buf_release(midEntry->resp_buf); 91 cifs_small_buf_release(midEntry->resp_buf);
92#ifdef CONFIG_CIFS_STATS2
93 now = jiffies;
94 /* commands taking longer than one second are indications that
95 something is wrong, unless it is quite a slow link or server */
96 if((now - midEntry->when_alloc) > HZ) {
97 if((cifsFYI & CIFS_TIMER) &&
98 (midEntry->command != SMB_COM_LOCKING_ANDX)) {
99 printk(KERN_DEBUG " CIFS slow rsp: cmd %d mid %d",
100 midEntry->command, midEntry->mid);
101 printk(" A: 0x%lx S: 0x%lx R: 0x%lx\n",
102 now - midEntry->when_alloc,
103 now - midEntry->when_sent,
104 now - midEntry->when_received);
105 }
106 }
107#endif
87 mempool_free(midEntry, cifs_mid_poolp); 108 mempool_free(midEntry, cifs_mid_poolp);
88} 109}
89 110
@@ -382,6 +403,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
382 (struct sockaddr *) &(ses->server->addr.sockAddr)); 403 (struct sockaddr *) &(ses->server->addr.sockAddr));
383#ifdef CONFIG_CIFS_STATS2 404#ifdef CONFIG_CIFS_STATS2
384 atomic_dec(&ses->server->inSend); 405 atomic_dec(&ses->server->inSend);
406 midQ->when_sent = jiffies;
385#endif 407#endif
386 if(rc < 0) { 408 if(rc < 0) {
387 DeleteMidQEntry(midQ); 409 DeleteMidQEntry(midQ);
@@ -646,6 +668,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
646 (struct sockaddr *) &(ses->server->addr.sockAddr)); 668 (struct sockaddr *) &(ses->server->addr.sockAddr));
647#ifdef CONFIG_CIFS_STATS2 669#ifdef CONFIG_CIFS_STATS2
648 atomic_dec(&ses->server->inSend); 670 atomic_dec(&ses->server->inSend);
671 midQ->when_sent = jiffies;
649#endif 672#endif
650 if(rc < 0) { 673 if(rc < 0) {
651 DeleteMidQEntry(midQ); 674 DeleteMidQEntry(midQ);