aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifs_debug.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/cifs_debug.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/cifs_debug.c')
-rw-r--r--fs/cifs/cifs_debug.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 6f7810992db3..f4054d695f81 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -203,6 +203,49 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
203} 203}
204 204
205#ifdef CONFIG_CIFS_STATS 205#ifdef CONFIG_CIFS_STATS
206
207static int
208cifs_stats_write(struct file *file, const char __user *buffer,
209 unsigned long count, void *data)
210{
211 char c;
212 int rc;
213 struct list_head *tmp;
214 struct cifsTconInfo *tcon;
215
216 rc = get_user(c, buffer);
217 if (rc)
218 return rc;
219
220 if (c == '1' || c == 'y' || c == 'Y') {
221 read_lock(&GlobalSMBSeslock);
222 list_for_each(tmp, &GlobalTreeConnectionList) {
223 tcon = list_entry(tmp, struct cifsTconInfo,
224 cifsConnectionList);
225 atomic_set(&tcon->num_smbs_sent, 0);
226 atomic_set(&tcon->num_writes, 0);
227 atomic_set(&tcon->num_reads, 0);
228 atomic_set(&tcon->num_oplock_brks, 0);
229 atomic_set(&tcon->num_opens, 0);
230 atomic_set(&tcon->num_closes, 0);
231 atomic_set(&tcon->num_deletes, 0);
232 atomic_set(&tcon->num_mkdirs, 0);
233 atomic_set(&tcon->num_rmdirs, 0);
234 atomic_set(&tcon->num_renames, 0);
235 atomic_set(&tcon->num_t2renames, 0);
236 atomic_set(&tcon->num_ffirst, 0);
237 atomic_set(&tcon->num_fnext, 0);
238 atomic_set(&tcon->num_fclose, 0);
239 atomic_set(&tcon->num_hardlinks, 0);
240 atomic_set(&tcon->num_symlinks, 0);
241 atomic_set(&tcon->num_locks, 0);
242 }
243 read_unlock(&GlobalSMBSeslock);
244 }
245
246 return count;
247}
248
206static int 249static int
207cifs_stats_read(char *buf, char **beginBuffer, off_t offset, 250cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
208 int count, int *eof, void *data) 251 int count, int *eof, void *data)
@@ -365,8 +408,10 @@ cifs_proc_init(void)
365 cifs_debug_data_read, NULL); 408 cifs_debug_data_read, NULL);
366 409
367#ifdef CONFIG_CIFS_STATS 410#ifdef CONFIG_CIFS_STATS
368 create_proc_read_entry("Stats", 0, proc_fs_cifs, 411 pde = create_proc_read_entry("Stats", 0, proc_fs_cifs,
369 cifs_stats_read, NULL); 412 cifs_stats_read, NULL);
413 if (pde)
414 pde->write_proc = cifs_stats_write;
370#endif 415#endif
371 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, 416 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
372 cifsFYI_read, NULL); 417 cifsFYI_read, NULL);
@@ -483,6 +528,8 @@ cifsFYI_write(struct file *file, const char __user *buffer,
483 cifsFYI = 0; 528 cifsFYI = 0;
484 else if (c == '1' || c == 'y' || c == 'Y') 529 else if (c == '1' || c == 'y' || c == 'Y')
485 cifsFYI = 1; 530 cifsFYI = 1;
531 else if((c > '1') && (c <= '9'))
532 cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */
486 533
487 return count; 534 return count;
488} 535}