aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifs_debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/cifs_debug.c')
-rw-r--r--fs/cifs/cifs_debug.c103
1 files changed, 87 insertions, 16 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 4061e43471c1..22a444a3fe4c 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, " In 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,
@@ -195,6 +203,49 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
195} 203}
196 204
197#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' || c == '0') {
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
198static int 249static int
199cifs_stats_read(char *buf, char **beginBuffer, off_t offset, 250cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
200 int count, int *eof, void *data) 251 int count, int *eof, void *data)
@@ -254,35 +305,51 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
254 buf += sprintf(buf, "\tDISCONNECTED "); 305 buf += sprintf(buf, "\tDISCONNECTED ");
255 length += 14; 306 length += 14;
256 } 307 }
257 item_length = sprintf(buf,"\nSMBs: %d Oplock Breaks: %d", 308 item_length = sprintf(buf, "\nSMBs: %d Oplock Breaks: %d",
258 atomic_read(&tcon->num_smbs_sent), 309 atomic_read(&tcon->num_smbs_sent),
259 atomic_read(&tcon->num_oplock_brks)); 310 atomic_read(&tcon->num_oplock_brks));
260 buf += item_length; 311 buf += item_length;
261 length += item_length; 312 length += item_length;
262 item_length = sprintf(buf,"\nReads: %d Bytes %lld", 313 item_length = sprintf(buf, "\nReads: %d Bytes: %lld",
263 atomic_read(&tcon->num_reads), 314 atomic_read(&tcon->num_reads),
264 (long long)(tcon->bytes_read)); 315 (long long)(tcon->bytes_read));
265 buf += item_length; 316 buf += item_length;
266 length += item_length; 317 length += item_length;
267 item_length = sprintf(buf,"\nWrites: %d Bytes: %lld", 318 item_length = sprintf(buf, "\nWrites: %d Bytes: %lld",
268 atomic_read(&tcon->num_writes), 319 atomic_read(&tcon->num_writes),
269 (long long)(tcon->bytes_written)); 320 (long long)(tcon->bytes_written));
321 buf += item_length;
322 length += item_length;
323 item_length = sprintf(buf,
324 "\nLocks: %d HardLinks: %d Symlinks: %d",
325 atomic_read(&tcon->num_locks),
326 atomic_read(&tcon->num_hardlinks),
327 atomic_read(&tcon->num_symlinks));
328 buf += item_length;
329 length += item_length;
330
331 item_length = sprintf(buf, "\nOpens: %d Closes: %d Deletes: %d",
332 atomic_read(&tcon->num_opens),
333 atomic_read(&tcon->num_closes),
334 atomic_read(&tcon->num_deletes));
270 buf += item_length; 335 buf += item_length;
271 length += item_length; 336 length += item_length;
272 item_length = sprintf(buf, 337 item_length = sprintf(buf, "\nMkdirs: %d Rmdirs: %d",
273 "\nOpens: %d Deletes: %d\nMkdirs: %d Rmdirs: %d",
274 atomic_read(&tcon->num_opens),
275 atomic_read(&tcon->num_deletes),
276 atomic_read(&tcon->num_mkdirs), 338 atomic_read(&tcon->num_mkdirs),
277 atomic_read(&tcon->num_rmdirs)); 339 atomic_read(&tcon->num_rmdirs));
278 buf += item_length; 340 buf += item_length;
279 length += item_length; 341 length += item_length;
280 item_length = sprintf(buf, 342 item_length = sprintf(buf, "\nRenames: %d T2 Renames %d",
281 "\nRenames: %d T2 Renames %d",
282 atomic_read(&tcon->num_renames), 343 atomic_read(&tcon->num_renames),
283 atomic_read(&tcon->num_t2renames)); 344 atomic_read(&tcon->num_t2renames));
284 buf += item_length; 345 buf += item_length;
285 length += item_length; 346 length += item_length;
347 item_length = sprintf(buf, "\nFindFirst: %d FNext %d FClose %d",
348 atomic_read(&tcon->num_ffirst),
349 atomic_read(&tcon->num_fnext),
350 atomic_read(&tcon->num_fclose));
351 buf += item_length;
352 length += item_length;
286 } 353 }
287 read_unlock(&GlobalSMBSeslock); 354 read_unlock(&GlobalSMBSeslock);
288 355
@@ -341,8 +408,10 @@ cifs_proc_init(void)
341 cifs_debug_data_read, NULL); 408 cifs_debug_data_read, NULL);
342 409
343#ifdef CONFIG_CIFS_STATS 410#ifdef CONFIG_CIFS_STATS
344 create_proc_read_entry("Stats", 0, proc_fs_cifs, 411 pde = create_proc_read_entry("Stats", 0, proc_fs_cifs,
345 cifs_stats_read, NULL); 412 cifs_stats_read, NULL);
413 if (pde)
414 pde->write_proc = cifs_stats_write;
346#endif 415#endif
347 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, 416 pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
348 cifsFYI_read, NULL); 417 cifsFYI_read, NULL);
@@ -360,7 +429,7 @@ cifs_proc_init(void)
360 if (pde) 429 if (pde)
361 pde->write_proc = oplockEnabled_write; 430 pde->write_proc = oplockEnabled_write;
362 431
363 pde = create_proc_read_entry("ReenableOldCifsReaddirCode", 0, proc_fs_cifs, 432 pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs,
364 quotaEnabled_read, NULL); 433 quotaEnabled_read, NULL);
365 if (pde) 434 if (pde)
366 pde->write_proc = quotaEnabled_write; 435 pde->write_proc = quotaEnabled_write;
@@ -419,7 +488,7 @@ cifs_proc_clean(void)
419 remove_proc_entry("ExtendedSecurity",proc_fs_cifs); 488 remove_proc_entry("ExtendedSecurity",proc_fs_cifs);
420 remove_proc_entry("PacketSigningEnabled",proc_fs_cifs); 489 remove_proc_entry("PacketSigningEnabled",proc_fs_cifs);
421 remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs); 490 remove_proc_entry("LinuxExtensionsEnabled",proc_fs_cifs);
422 remove_proc_entry("ReenableOldCifsReaddirCode",proc_fs_cifs); 491 remove_proc_entry("Experimental",proc_fs_cifs);
423 remove_proc_entry("LookupCacheEnabled",proc_fs_cifs); 492 remove_proc_entry("LookupCacheEnabled",proc_fs_cifs);
424 remove_proc_entry("cifs", proc_root_fs); 493 remove_proc_entry("cifs", proc_root_fs);
425} 494}
@@ -459,6 +528,8 @@ cifsFYI_write(struct file *file, const char __user *buffer,
459 cifsFYI = 0; 528 cifsFYI = 0;
460 else if (c == '1' || c == 'y' || c == 'Y') 529 else if (c == '1' || c == 'y' || c == 'Y')
461 cifsFYI = 1; 530 cifsFYI = 1;
531 else if((c > '1') && (c <= '9'))
532 cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */
462 533
463 return count; 534 return count;
464} 535}