|
26 | 26 | #include "smbdirect.h"
|
27 | 27 | #endif
|
28 | 28 | #include "cifs_swn.h"
|
| 29 | +#include "cached_dir.h" |
29 | 30 |
|
30 | 31 | void
|
31 | 32 | cifs_dump_mem(char *label, void *data, int length)
|
@@ -280,6 +281,54 @@ static int cifs_debug_files_proc_show(struct seq_file *m, void *v)
|
280 | 281 | return 0;
|
281 | 282 | }
|
282 | 283 |
|
| 284 | +static int cifs_debug_dirs_proc_show(struct seq_file *m, void *v) |
| 285 | +{ |
| 286 | + struct list_head *stmp, *tmp, *tmp1; |
| 287 | + struct TCP_Server_Info *server; |
| 288 | + struct cifs_ses *ses; |
| 289 | + struct cifs_tcon *tcon; |
| 290 | + struct cached_fids *cfids; |
| 291 | + struct cached_fid *cfid; |
| 292 | + LIST_HEAD(entry); |
| 293 | + |
| 294 | + seq_puts(m, "# Version:1\n"); |
| 295 | + seq_puts(m, "# Format:\n"); |
| 296 | + seq_puts(m, "# <tree id> <sess id> <persistent fid> <path>\n"); |
| 297 | + |
| 298 | + spin_lock(&cifs_tcp_ses_lock); |
| 299 | + list_for_each(stmp, &cifs_tcp_ses_list) { |
| 300 | + server = list_entry(stmp, struct TCP_Server_Info, |
| 301 | + tcp_ses_list); |
| 302 | + list_for_each(tmp, &server->smb_ses_list) { |
| 303 | + ses = list_entry(tmp, struct cifs_ses, smb_ses_list); |
| 304 | + list_for_each(tmp1, &ses->tcon_list) { |
| 305 | + tcon = list_entry(tmp1, struct cifs_tcon, tcon_list); |
| 306 | + cfids = tcon->cfids; |
| 307 | + spin_lock(&cfids->cfid_list_lock); /* check lock ordering */ |
| 308 | + seq_printf(m, "Num entries: %d\n", cfids->num_entries); |
| 309 | + list_for_each_entry(cfid, &cfids->entries, entry) { |
| 310 | + seq_printf(m, "0x%x 0x%llx 0x%llx %s", |
| 311 | + tcon->tid, |
| 312 | + ses->Suid, |
| 313 | + cfid->fid.persistent_fid, |
| 314 | + cfid->path); |
| 315 | + if (cfid->file_all_info_is_valid) |
| 316 | + seq_printf(m, "\tvalid file info"); |
| 317 | + if (cfid->dirents.is_valid) |
| 318 | + seq_printf(m, ", valid dirents"); |
| 319 | + seq_printf(m, "\n"); |
| 320 | + } |
| 321 | + spin_unlock(&cfids->cfid_list_lock); |
| 322 | + |
| 323 | + |
| 324 | + } |
| 325 | + } |
| 326 | + } |
| 327 | + spin_unlock(&cifs_tcp_ses_lock); |
| 328 | + seq_putc(m, '\n'); |
| 329 | + return 0; |
| 330 | +} |
| 331 | + |
283 | 332 | static __always_inline const char *compression_alg_str(__le16 alg)
|
284 | 333 | {
|
285 | 334 | switch (alg) {
|
@@ -863,6 +912,9 @@ cifs_proc_init(void)
|
863 | 912 | proc_create_single("open_files", 0400, proc_fs_cifs,
|
864 | 913 | cifs_debug_files_proc_show);
|
865 | 914 |
|
| 915 | + proc_create_single("open_dirs", 0400, proc_fs_cifs, |
| 916 | + cifs_debug_dirs_proc_show); |
| 917 | + |
866 | 918 | proc_create("Stats", 0644, proc_fs_cifs, &cifs_stats_proc_ops);
|
867 | 919 | proc_create("cifsFYI", 0644, proc_fs_cifs, &cifsFYI_proc_ops);
|
868 | 920 | proc_create("traceSMB", 0644, proc_fs_cifs, &traceSMB_proc_ops);
|
@@ -907,6 +959,7 @@ cifs_proc_clean(void)
|
907 | 959 |
|
908 | 960 | remove_proc_entry("DebugData", proc_fs_cifs);
|
909 | 961 | remove_proc_entry("open_files", proc_fs_cifs);
|
| 962 | + remove_proc_entry("open_dirs", proc_fs_cifs); |
910 | 963 | remove_proc_entry("cifsFYI", proc_fs_cifs);
|
911 | 964 | remove_proc_entry("traceSMB", proc_fs_cifs);
|
912 | 965 | remove_proc_entry("Stats", proc_fs_cifs);
|
|
0 commit comments