Commit 44c581866e2ae4bbc3c8eea5a3e3c7a0f639e12d
1 parent
9094fad1ed
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
CIFS: Move clear/print_stats code to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
Showing 5 changed files with 129 additions and 103 deletions Side-by-side Diff
fs/cifs/cifs_debug.c
... | ... | @@ -282,24 +282,8 @@ |
282 | 282 | struct cifs_tcon, |
283 | 283 | tcon_list); |
284 | 284 | atomic_set(&tcon->num_smbs_sent, 0); |
285 | - atomic_set(&tcon->num_writes, 0); | |
286 | - atomic_set(&tcon->num_reads, 0); | |
287 | - atomic_set(&tcon->num_oplock_brks, 0); | |
288 | - atomic_set(&tcon->num_opens, 0); | |
289 | - atomic_set(&tcon->num_posixopens, 0); | |
290 | - atomic_set(&tcon->num_posixmkdirs, 0); | |
291 | - atomic_set(&tcon->num_closes, 0); | |
292 | - atomic_set(&tcon->num_deletes, 0); | |
293 | - atomic_set(&tcon->num_mkdirs, 0); | |
294 | - atomic_set(&tcon->num_rmdirs, 0); | |
295 | - atomic_set(&tcon->num_renames, 0); | |
296 | - atomic_set(&tcon->num_t2renames, 0); | |
297 | - atomic_set(&tcon->num_ffirst, 0); | |
298 | - atomic_set(&tcon->num_fnext, 0); | |
299 | - atomic_set(&tcon->num_fclose, 0); | |
300 | - atomic_set(&tcon->num_hardlinks, 0); | |
301 | - atomic_set(&tcon->num_symlinks, 0); | |
302 | - atomic_set(&tcon->num_locks, 0); | |
285 | + if (server->ops->clear_stats) | |
286 | + server->ops->clear_stats(tcon); | |
303 | 287 | } |
304 | 288 | } |
305 | 289 | } |
... | ... | @@ -358,42 +342,10 @@ |
358 | 342 | seq_printf(m, "\n%d) %s", i, tcon->treeName); |
359 | 343 | if (tcon->need_reconnect) |
360 | 344 | seq_puts(m, "\tDISCONNECTED "); |
361 | - seq_printf(m, "\nSMBs: %d Oplock Breaks: %d", | |
362 | - atomic_read(&tcon->num_smbs_sent), | |
363 | - atomic_read(&tcon->num_oplock_brks)); | |
364 | - seq_printf(m, "\nReads: %d Bytes: %lld", | |
365 | - atomic_read(&tcon->num_reads), | |
366 | - (long long)(tcon->bytes_read)); | |
367 | - seq_printf(m, "\nWrites: %d Bytes: %lld", | |
368 | - atomic_read(&tcon->num_writes), | |
369 | - (long long)(tcon->bytes_written)); | |
370 | - seq_printf(m, "\nFlushes: %d", | |
371 | - atomic_read(&tcon->num_flushes)); | |
372 | - seq_printf(m, "\nLocks: %d HardLinks: %d " | |
373 | - "Symlinks: %d", | |
374 | - atomic_read(&tcon->num_locks), | |
375 | - atomic_read(&tcon->num_hardlinks), | |
376 | - atomic_read(&tcon->num_symlinks)); | |
377 | - seq_printf(m, "\nOpens: %d Closes: %d " | |
378 | - "Deletes: %d", | |
379 | - atomic_read(&tcon->num_opens), | |
380 | - atomic_read(&tcon->num_closes), | |
381 | - atomic_read(&tcon->num_deletes)); | |
382 | - seq_printf(m, "\nPosix Opens: %d " | |
383 | - "Posix Mkdirs: %d", | |
384 | - atomic_read(&tcon->num_posixopens), | |
385 | - atomic_read(&tcon->num_posixmkdirs)); | |
386 | - seq_printf(m, "\nMkdirs: %d Rmdirs: %d", | |
387 | - atomic_read(&tcon->num_mkdirs), | |
388 | - atomic_read(&tcon->num_rmdirs)); | |
389 | - seq_printf(m, "\nRenames: %d T2 Renames %d", | |
390 | - atomic_read(&tcon->num_renames), | |
391 | - atomic_read(&tcon->num_t2renames)); | |
392 | - seq_printf(m, "\nFindFirst: %d FNext %d " | |
393 | - "FClose %d", | |
394 | - atomic_read(&tcon->num_ffirst), | |
395 | - atomic_read(&tcon->num_fnext), | |
396 | - atomic_read(&tcon->num_fclose)); | |
345 | + seq_printf(m, "\nSMBs: %d", | |
346 | + atomic_read(&tcon->num_smbs_sent)); | |
347 | + if (server->ops->print_stats) | |
348 | + server->ops->print_stats(m, tcon); | |
397 | 349 | } |
398 | 350 | } |
399 | 351 | } |
fs/cifs/cifsglob.h
... | ... | @@ -197,6 +197,8 @@ |
197 | 197 | /* find mid corresponding to the response message */ |
198 | 198 | struct mid_q_entry * (*find_mid)(struct TCP_Server_Info *, char *); |
199 | 199 | void (*dump_detail)(void *); |
200 | + void (*clear_stats)(struct cifs_tcon *); | |
201 | + void (*print_stats)(struct seq_file *m, struct cifs_tcon *); | |
200 | 202 | /* verify the message */ |
201 | 203 | int (*check_message)(char *, unsigned int); |
202 | 204 | bool (*is_oplock_break)(char *, struct TCP_Server_Info *); |
... | ... | @@ -566,27 +568,31 @@ |
566 | 568 | enum statusEnum tidStatus; |
567 | 569 | #ifdef CONFIG_CIFS_STATS |
568 | 570 | atomic_t num_smbs_sent; |
569 | - atomic_t num_writes; | |
570 | - atomic_t num_reads; | |
571 | - atomic_t num_flushes; | |
572 | - atomic_t num_oplock_brks; | |
573 | - atomic_t num_opens; | |
574 | - atomic_t num_closes; | |
575 | - atomic_t num_deletes; | |
576 | - atomic_t num_mkdirs; | |
577 | - atomic_t num_posixopens; | |
578 | - atomic_t num_posixmkdirs; | |
579 | - atomic_t num_rmdirs; | |
580 | - atomic_t num_renames; | |
581 | - atomic_t num_t2renames; | |
582 | - atomic_t num_ffirst; | |
583 | - atomic_t num_fnext; | |
584 | - atomic_t num_fclose; | |
585 | - atomic_t num_hardlinks; | |
586 | - atomic_t num_symlinks; | |
587 | - atomic_t num_locks; | |
588 | - atomic_t num_acl_get; | |
589 | - atomic_t num_acl_set; | |
571 | + union { | |
572 | + struct { | |
573 | + atomic_t num_writes; | |
574 | + atomic_t num_reads; | |
575 | + atomic_t num_flushes; | |
576 | + atomic_t num_oplock_brks; | |
577 | + atomic_t num_opens; | |
578 | + atomic_t num_closes; | |
579 | + atomic_t num_deletes; | |
580 | + atomic_t num_mkdirs; | |
581 | + atomic_t num_posixopens; | |
582 | + atomic_t num_posixmkdirs; | |
583 | + atomic_t num_rmdirs; | |
584 | + atomic_t num_renames; | |
585 | + atomic_t num_t2renames; | |
586 | + atomic_t num_ffirst; | |
587 | + atomic_t num_fnext; | |
588 | + atomic_t num_fclose; | |
589 | + atomic_t num_hardlinks; | |
590 | + atomic_t num_symlinks; | |
591 | + atomic_t num_locks; | |
592 | + atomic_t num_acl_get; | |
593 | + atomic_t num_acl_set; | |
594 | + } cifs_stats; | |
595 | + } stats; | |
590 | 596 | #ifdef CONFIG_CIFS_STATS2 |
591 | 597 | unsigned long long time_writes; |
592 | 598 | unsigned long long time_reads; |
fs/cifs/cifssmb.c
... | ... | @@ -893,7 +893,7 @@ |
893 | 893 | cFYI(1, "Posix delete returned %d", rc); |
894 | 894 | cifs_buf_release(pSMB); |
895 | 895 | |
896 | - cifs_stats_inc(&tcon->num_deletes); | |
896 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_deletes); | |
897 | 897 | |
898 | 898 | if (rc == -EAGAIN) |
899 | 899 | goto PsxDelete; |
... | ... | @@ -936,7 +936,7 @@ |
936 | 936 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
937 | 937 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
938 | 938 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
939 | - cifs_stats_inc(&tcon->num_deletes); | |
939 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_deletes); | |
940 | 940 | if (rc) |
941 | 941 | cFYI(1, "Error in RMFile = %d", rc); |
942 | 942 | |
... | ... | @@ -981,7 +981,7 @@ |
981 | 981 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
982 | 982 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
983 | 983 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
984 | - cifs_stats_inc(&tcon->num_rmdirs); | |
984 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_rmdirs); | |
985 | 985 | if (rc) |
986 | 986 | cFYI(1, "Error in RMDir = %d", rc); |
987 | 987 | |
... | ... | @@ -1024,7 +1024,7 @@ |
1024 | 1024 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
1025 | 1025 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1026 | 1026 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1027 | - cifs_stats_inc(&tcon->num_mkdirs); | |
1027 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_mkdirs); | |
1028 | 1028 | if (rc) |
1029 | 1029 | cFYI(1, "Error in Mkdir = %d", rc); |
1030 | 1030 | |
1031 | 1031 | |
... | ... | @@ -1147,9 +1147,9 @@ |
1147 | 1147 | cifs_buf_release(pSMB); |
1148 | 1148 | |
1149 | 1149 | if (posix_flags & SMB_O_DIRECTORY) |
1150 | - cifs_stats_inc(&tcon->num_posixmkdirs); | |
1150 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_posixmkdirs); | |
1151 | 1151 | else |
1152 | - cifs_stats_inc(&tcon->num_posixopens); | |
1152 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_posixopens); | |
1153 | 1153 | |
1154 | 1154 | if (rc == -EAGAIN) |
1155 | 1155 | goto PsxCreat; |
... | ... | @@ -1270,7 +1270,7 @@ |
1270 | 1270 | /* long_op set to 1 to allow for oplock break timeouts */ |
1271 | 1271 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1272 | 1272 | (struct smb_hdr *)pSMBr, &bytes_returned, 0); |
1273 | - cifs_stats_inc(&tcon->num_opens); | |
1273 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_opens); | |
1274 | 1274 | if (rc) { |
1275 | 1275 | cFYI(1, "Error in Open = %d", rc); |
1276 | 1276 | } else { |
... | ... | @@ -1383,7 +1383,7 @@ |
1383 | 1383 | /* long_op set to 1 to allow for oplock break timeouts */ |
1384 | 1384 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1385 | 1385 | (struct smb_hdr *)pSMBr, &bytes_returned, 0); |
1386 | - cifs_stats_inc(&tcon->num_opens); | |
1386 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_opens); | |
1387 | 1387 | if (rc) { |
1388 | 1388 | cFYI(1, "Error in Open = %d", rc); |
1389 | 1389 | } else { |
... | ... | @@ -1650,7 +1650,7 @@ |
1650 | 1650 | rdata, 0); |
1651 | 1651 | |
1652 | 1652 | if (rc == 0) |
1653 | - cifs_stats_inc(&tcon->num_reads); | |
1653 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_reads); | |
1654 | 1654 | else |
1655 | 1655 | kref_put(&rdata->refcount, cifs_readdata_release); |
1656 | 1656 | |
... | ... | @@ -1720,7 +1720,7 @@ |
1720 | 1720 | iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4; |
1721 | 1721 | rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */, |
1722 | 1722 | &resp_buf_type, CIFS_LOG_ERROR); |
1723 | - cifs_stats_inc(&tcon->num_reads); | |
1723 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_reads); | |
1724 | 1724 | pSMBr = (READ_RSP *)iov[0].iov_base; |
1725 | 1725 | if (rc) { |
1726 | 1726 | cERROR(1, "Send error in read = %d", rc); |
... | ... | @@ -1872,7 +1872,7 @@ |
1872 | 1872 | |
1873 | 1873 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1874 | 1874 | (struct smb_hdr *) pSMBr, &bytes_returned, long_op); |
1875 | - cifs_stats_inc(&tcon->num_writes); | |
1875 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_writes); | |
1876 | 1876 | if (rc) { |
1877 | 1877 | cFYI(1, "Send error in write = %d", rc); |
1878 | 1878 | } else { |
... | ... | @@ -2123,7 +2123,7 @@ |
2123 | 2123 | NULL, cifs_writev_callback, wdata, 0); |
2124 | 2124 | |
2125 | 2125 | if (rc == 0) |
2126 | - cifs_stats_inc(&tcon->num_writes); | |
2126 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_writes); | |
2127 | 2127 | else |
2128 | 2128 | kref_put(&wdata->refcount, cifs_writedata_release); |
2129 | 2129 | |
... | ... | @@ -2213,7 +2213,7 @@ |
2213 | 2213 | |
2214 | 2214 | rc = SendReceive2(xid, tcon->ses, iov, n_vec + 1, &resp_buf_type, |
2215 | 2215 | long_op); |
2216 | - cifs_stats_inc(&tcon->num_writes); | |
2216 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_writes); | |
2217 | 2217 | if (rc) { |
2218 | 2218 | cFYI(1, "Send error Write2 = %d", rc); |
2219 | 2219 | } else if (resp_buf_type == 0) { |
... | ... | @@ -2279,7 +2279,7 @@ |
2279 | 2279 | iov[1].iov_base = (char *)buf; |
2280 | 2280 | iov[1].iov_len = (num_unlock + num_lock) * sizeof(LOCKING_ANDX_RANGE); |
2281 | 2281 | |
2282 | - cifs_stats_inc(&tcon->num_locks); | |
2282 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_locks); | |
2283 | 2283 | rc = SendReceive2(xid, tcon->ses, iov, 2, &resp_buf_type, CIFS_NO_RESP); |
2284 | 2284 | if (rc) |
2285 | 2285 | cFYI(1, "Send error in cifs_lockv = %d", rc); |
... | ... | @@ -2348,7 +2348,7 @@ |
2348 | 2348 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *)pSMB, flags); |
2349 | 2349 | /* SMB buffer freed by function above */ |
2350 | 2350 | } |
2351 | - cifs_stats_inc(&tcon->num_locks); | |
2351 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_locks); | |
2352 | 2352 | if (rc) |
2353 | 2353 | cFYI(1, "Send error in Lock = %d", rc); |
2354 | 2354 | |
... | ... | @@ -2511,7 +2511,7 @@ |
2511 | 2511 | pSMB->LastWriteTime = 0xFFFFFFFF; |
2512 | 2512 | pSMB->ByteCount = 0; |
2513 | 2513 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); |
2514 | - cifs_stats_inc(&tcon->num_closes); | |
2514 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_closes); | |
2515 | 2515 | if (rc) { |
2516 | 2516 | if (rc != -EINTR) { |
2517 | 2517 | /* EINTR is expected when user ctl-c to kill app */ |
... | ... | @@ -2540,7 +2540,7 @@ |
2540 | 2540 | pSMB->FileID = (__u16) smb_file_id; |
2541 | 2541 | pSMB->ByteCount = 0; |
2542 | 2542 | rc = SendReceiveNoRsp(xid, tcon->ses, (char *) pSMB, 0); |
2543 | - cifs_stats_inc(&tcon->num_flushes); | |
2543 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_flushes); | |
2544 | 2544 | if (rc) |
2545 | 2545 | cERROR(1, "Send error in Flush = %d", rc); |
2546 | 2546 | |
... | ... | @@ -2603,7 +2603,7 @@ |
2603 | 2603 | |
2604 | 2604 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2605 | 2605 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2606 | - cifs_stats_inc(&tcon->num_renames); | |
2606 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_renames); | |
2607 | 2607 | if (rc) |
2608 | 2608 | cFYI(1, "Send error in rename = %d", rc); |
2609 | 2609 | |
... | ... | @@ -2684,7 +2684,7 @@ |
2684 | 2684 | pSMB->ByteCount = cpu_to_le16(byte_count); |
2685 | 2685 | rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, |
2686 | 2686 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2687 | - cifs_stats_inc(&pTcon->num_t2renames); | |
2687 | + cifs_stats_inc(&pTcon->stats.cifs_stats.num_t2renames); | |
2688 | 2688 | if (rc) |
2689 | 2689 | cFYI(1, "Send error in Rename (by file handle) = %d", rc); |
2690 | 2690 | |
... | ... | @@ -2841,7 +2841,7 @@ |
2841 | 2841 | pSMB->ByteCount = cpu_to_le16(byte_count); |
2842 | 2842 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2843 | 2843 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2844 | - cifs_stats_inc(&tcon->num_symlinks); | |
2844 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_symlinks); | |
2845 | 2845 | if (rc) |
2846 | 2846 | cFYI(1, "Send error in SetPathInfo create symlink = %d", rc); |
2847 | 2847 | |
... | ... | @@ -2927,7 +2927,7 @@ |
2927 | 2927 | pSMB->ByteCount = cpu_to_le16(byte_count); |
2928 | 2928 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2929 | 2929 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2930 | - cifs_stats_inc(&tcon->num_hardlinks); | |
2930 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_hardlinks); | |
2931 | 2931 | if (rc) |
2932 | 2932 | cFYI(1, "Send error in SetPathInfo (hard link) = %d", rc); |
2933 | 2933 | |
... | ... | @@ -2999,7 +2999,7 @@ |
2999 | 2999 | |
3000 | 3000 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
3001 | 3001 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
3002 | - cifs_stats_inc(&tcon->num_hardlinks); | |
3002 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_hardlinks); | |
3003 | 3003 | if (rc) |
3004 | 3004 | cFYI(1, "Send error in hard link (NT rename) = %d", rc); |
3005 | 3005 | |
... | ... | @@ -3417,7 +3417,7 @@ |
3417 | 3417 | |
3418 | 3418 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
3419 | 3419 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
3420 | - cifs_stats_inc(&tcon->num_acl_get); | |
3420 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_acl_get); | |
3421 | 3421 | if (rc) { |
3422 | 3422 | cFYI(1, "Send error in Query POSIX ACL = %d", rc); |
3423 | 3423 | } else { |
... | ... | @@ -3728,7 +3728,7 @@ |
3728 | 3728 | |
3729 | 3729 | rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovec */, &buf_type, |
3730 | 3730 | 0); |
3731 | - cifs_stats_inc(&tcon->num_acl_get); | |
3731 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_acl_get); | |
3732 | 3732 | if (rc) { |
3733 | 3733 | cFYI(1, "Send error in QuerySecDesc = %d", rc); |
3734 | 3734 | } else { /* decode response */ |
... | ... | @@ -4330,7 +4330,7 @@ |
4330 | 4330 | |
4331 | 4331 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
4332 | 4332 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
4333 | - cifs_stats_inc(&tcon->num_ffirst); | |
4333 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_ffirst); | |
4334 | 4334 | |
4335 | 4335 | if (rc) {/* BB add logic to retry regular search if Unix search |
4336 | 4336 | rejected unexpectedly by server */ |
... | ... | @@ -4457,7 +4457,7 @@ |
4457 | 4457 | |
4458 | 4458 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
4459 | 4459 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
4460 | - cifs_stats_inc(&tcon->num_fnext); | |
4460 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_fnext); | |
4461 | 4461 | if (rc) { |
4462 | 4462 | if (rc == -EBADF) { |
4463 | 4463 | psrch_inf->endOfSearch = true; |
... | ... | @@ -4548,7 +4548,7 @@ |
4548 | 4548 | if (rc) |
4549 | 4549 | cERROR(1, "Send error in FindClose = %d", rc); |
4550 | 4550 | |
4551 | - cifs_stats_inc(&tcon->num_fclose); | |
4551 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_fclose); | |
4552 | 4552 | |
4553 | 4553 | /* Since session is dead, search handle closed on server already */ |
4554 | 4554 | if (rc == -EAGAIN) |
fs/cifs/misc.c
... | ... | @@ -461,7 +461,7 @@ |
461 | 461 | if (tcon->tid != buf->Tid) |
462 | 462 | continue; |
463 | 463 | |
464 | - cifs_stats_inc(&tcon->num_oplock_brks); | |
464 | + cifs_stats_inc(&tcon->stats.cifs_stats.num_oplock_brks); | |
465 | 465 | spin_lock(&cifs_file_list_lock); |
466 | 466 | list_for_each(tmp2, &tcon->openFileList) { |
467 | 467 | netfile = list_entry(tmp2, struct cifsFileInfo, |
fs/cifs/smb1ops.c
... | ... | @@ -520,6 +520,72 @@ |
520 | 520 | return full_path; |
521 | 521 | } |
522 | 522 | |
523 | +static void | |
524 | +cifs_clear_stats(struct cifs_tcon *tcon) | |
525 | +{ | |
526 | +#ifdef CONFIG_CIFS_STATS | |
527 | + atomic_set(&tcon->stats.cifs_stats.num_writes, 0); | |
528 | + atomic_set(&tcon->stats.cifs_stats.num_reads, 0); | |
529 | + atomic_set(&tcon->stats.cifs_stats.num_flushes, 0); | |
530 | + atomic_set(&tcon->stats.cifs_stats.num_oplock_brks, 0); | |
531 | + atomic_set(&tcon->stats.cifs_stats.num_opens, 0); | |
532 | + atomic_set(&tcon->stats.cifs_stats.num_posixopens, 0); | |
533 | + atomic_set(&tcon->stats.cifs_stats.num_posixmkdirs, 0); | |
534 | + atomic_set(&tcon->stats.cifs_stats.num_closes, 0); | |
535 | + atomic_set(&tcon->stats.cifs_stats.num_deletes, 0); | |
536 | + atomic_set(&tcon->stats.cifs_stats.num_mkdirs, 0); | |
537 | + atomic_set(&tcon->stats.cifs_stats.num_rmdirs, 0); | |
538 | + atomic_set(&tcon->stats.cifs_stats.num_renames, 0); | |
539 | + atomic_set(&tcon->stats.cifs_stats.num_t2renames, 0); | |
540 | + atomic_set(&tcon->stats.cifs_stats.num_ffirst, 0); | |
541 | + atomic_set(&tcon->stats.cifs_stats.num_fnext, 0); | |
542 | + atomic_set(&tcon->stats.cifs_stats.num_fclose, 0); | |
543 | + atomic_set(&tcon->stats.cifs_stats.num_hardlinks, 0); | |
544 | + atomic_set(&tcon->stats.cifs_stats.num_symlinks, 0); | |
545 | + atomic_set(&tcon->stats.cifs_stats.num_locks, 0); | |
546 | + atomic_set(&tcon->stats.cifs_stats.num_acl_get, 0); | |
547 | + atomic_set(&tcon->stats.cifs_stats.num_acl_set, 0); | |
548 | +#endif | |
549 | +} | |
550 | + | |
551 | +static void | |
552 | +cifs_print_stats(struct seq_file *m, struct cifs_tcon *tcon) | |
553 | +{ | |
554 | +#ifdef CONFIG_CIFS_STATS | |
555 | + seq_printf(m, " Oplocks breaks: %d", | |
556 | + atomic_read(&tcon->stats.cifs_stats.num_oplock_brks)); | |
557 | + seq_printf(m, "\nReads: %d Bytes: %llu", | |
558 | + atomic_read(&tcon->stats.cifs_stats.num_reads), | |
559 | + (long long)(tcon->bytes_read)); | |
560 | + seq_printf(m, "\nWrites: %d Bytes: %llu", | |
561 | + atomic_read(&tcon->stats.cifs_stats.num_writes), | |
562 | + (long long)(tcon->bytes_written)); | |
563 | + seq_printf(m, "\nFlushes: %d", | |
564 | + atomic_read(&tcon->stats.cifs_stats.num_flushes)); | |
565 | + seq_printf(m, "\nLocks: %d HardLinks: %d Symlinks: %d", | |
566 | + atomic_read(&tcon->stats.cifs_stats.num_locks), | |
567 | + atomic_read(&tcon->stats.cifs_stats.num_hardlinks), | |
568 | + atomic_read(&tcon->stats.cifs_stats.num_symlinks)); | |
569 | + seq_printf(m, "\nOpens: %d Closes: %d Deletes: %d", | |
570 | + atomic_read(&tcon->stats.cifs_stats.num_opens), | |
571 | + atomic_read(&tcon->stats.cifs_stats.num_closes), | |
572 | + atomic_read(&tcon->stats.cifs_stats.num_deletes)); | |
573 | + seq_printf(m, "\nPosix Opens: %d Posix Mkdirs: %d", | |
574 | + atomic_read(&tcon->stats.cifs_stats.num_posixopens), | |
575 | + atomic_read(&tcon->stats.cifs_stats.num_posixmkdirs)); | |
576 | + seq_printf(m, "\nMkdirs: %d Rmdirs: %d", | |
577 | + atomic_read(&tcon->stats.cifs_stats.num_mkdirs), | |
578 | + atomic_read(&tcon->stats.cifs_stats.num_rmdirs)); | |
579 | + seq_printf(m, "\nRenames: %d T2 Renames %d", | |
580 | + atomic_read(&tcon->stats.cifs_stats.num_renames), | |
581 | + atomic_read(&tcon->stats.cifs_stats.num_t2renames)); | |
582 | + seq_printf(m, "\nFindFirst: %d FNext %d FClose %d", | |
583 | + atomic_read(&tcon->stats.cifs_stats.num_ffirst), | |
584 | + atomic_read(&tcon->stats.cifs_stats.num_fnext), | |
585 | + atomic_read(&tcon->stats.cifs_stats.num_fclose)); | |
586 | +#endif | |
587 | +} | |
588 | + | |
523 | 589 | struct smb_version_operations smb1_operations = { |
524 | 590 | .send_cancel = send_nt_cancel, |
525 | 591 | .compare_fids = cifs_compare_fids, |
... | ... | @@ -537,6 +603,8 @@ |
537 | 603 | .find_mid = cifs_find_mid, |
538 | 604 | .check_message = checkSMB, |
539 | 605 | .dump_detail = cifs_dump_detail, |
606 | + .clear_stats = cifs_clear_stats, | |
607 | + .print_stats = cifs_print_stats, | |
540 | 608 | .is_oplock_break = is_valid_oplock_break, |
541 | 609 | .check_trans2 = cifs_check_trans2, |
542 | 610 | .need_neg = cifs_need_neg, |