aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-08-21 00:42:53 -0400
committerSteve French <sfrench@us.ibm.com>2005-08-21 00:42:53 -0400
commita5a2b489bae8f66559a531df99a26eb16b42299e (patch)
tree080a579fe5e5382dc3493e302174b9c584964be4 /fs/cifs/cifssmb.c
parent646352319b6cd369750a706706810d87f6b6efa7 (diff)
[CIFS] Make CIFS statistics more accurate and add some stats that were
missing. Most importantly SMB reads were undercounted. Signed-off-by: Steve French (sfrench@us.ibm.com)
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c89
1 files changed, 51 insertions, 38 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 930be0927de2..1292db50fe65 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -584,14 +584,12 @@ DelFileRetry:
584 pSMB->ByteCount = cpu_to_le16(name_len + 1); 584 pSMB->ByteCount = cpu_to_le16(name_len + 1);
585 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 585 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
586 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 586 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
587#ifdef CONFIG_CIFS_STATS
588 atomic_inc(&tcon->num_deletes);
589#endif
587 if (rc) { 590 if (rc) {
588 cFYI(1, ("Error in RMFile = %d", rc)); 591 cFYI(1, ("Error in RMFile = %d", rc));
589 } 592 }
590#ifdef CONFIG_CIFS_STATS
591 else {
592 atomic_inc(&tcon->num_deletes);
593 }
594#endif
595 593
596 cifs_buf_release(pSMB); 594 cifs_buf_release(pSMB);
597 if (rc == -EAGAIN) 595 if (rc == -EAGAIN)
@@ -633,14 +631,12 @@ RmDirRetry:
633 pSMB->ByteCount = cpu_to_le16(name_len + 1); 631 pSMB->ByteCount = cpu_to_le16(name_len + 1);
634 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 632 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
635 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 633 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
634#ifdef CONFIG_CIFS_STATS
635 atomic_inc(&tcon->num_rmdirs);
636#endif
636 if (rc) { 637 if (rc) {
637 cFYI(1, ("Error in RMDir = %d", rc)); 638 cFYI(1, ("Error in RMDir = %d", rc));
638 } 639 }
639#ifdef CONFIG_CIFS_STATS
640 else {
641 atomic_inc(&tcon->num_rmdirs);
642 }
643#endif
644 640
645 cifs_buf_release(pSMB); 641 cifs_buf_release(pSMB);
646 if (rc == -EAGAIN) 642 if (rc == -EAGAIN)
@@ -681,14 +677,13 @@ MkDirRetry:
681 pSMB->ByteCount = cpu_to_le16(name_len + 1); 677 pSMB->ByteCount = cpu_to_le16(name_len + 1);
682 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 678 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
683 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 679 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
680#ifdef CONFIG_CIFS_STATS
681 atomic_inc(&tcon->num_mkdirs);
682#endif
684 if (rc) { 683 if (rc) {
685 cFYI(1, ("Error in Mkdir = %d", rc)); 684 cFYI(1, ("Error in Mkdir = %d", rc));
686 } 685 }
687#ifdef CONFIG_CIFS_STATS 686
688 else {
689 atomic_inc(&tcon->num_mkdirs);
690 }
691#endif
692 cifs_buf_release(pSMB); 687 cifs_buf_release(pSMB);
693 if (rc == -EAGAIN) 688 if (rc == -EAGAIN)
694 goto MkDirRetry; 689 goto MkDirRetry;
@@ -772,6 +767,9 @@ openRetry:
772 /* long_op set to 1 to allow for oplock break timeouts */ 767 /* long_op set to 1 to allow for oplock break timeouts */
773 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 768 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
774 (struct smb_hdr *) pSMBr, &bytes_returned, 1); 769 (struct smb_hdr *) pSMBr, &bytes_returned, 1);
770#ifdef CONFIG_CIFS_STATS
771 atomic_inc(&tcon->num_opens);
772#endif
775 if (rc) { 773 if (rc) {
776 cFYI(1, ("Error in Open = %d", rc)); 774 cFYI(1, ("Error in Open = %d", rc));
777 } else { 775 } else {
@@ -789,11 +787,8 @@ openRetry:
789 pfile_info->EndOfFile = pSMBr->EndOfFile; 787 pfile_info->EndOfFile = pSMBr->EndOfFile;
790 pfile_info->NumberOfLinks = cpu_to_le32(1); 788 pfile_info->NumberOfLinks = cpu_to_le32(1);
791 } 789 }
792
793#ifdef CONFIG_CIFS_STATS
794 atomic_inc(&tcon->num_opens);
795#endif
796 } 790 }
791
797 cifs_buf_release(pSMB); 792 cifs_buf_release(pSMB);
798 if (rc == -EAGAIN) 793 if (rc == -EAGAIN)
799 goto openRetry; 794 goto openRetry;
@@ -838,6 +833,9 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
838 833
839 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 834 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
840 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 835 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
836#ifdef CONFIG_CIFS_STATS
837 atomic_inc(&tcon->num_reads);
838#endif
841 if (rc) { 839 if (rc) {
842 cERROR(1, ("Send error in read = %d", rc)); 840 cERROR(1, ("Send error in read = %d", rc));
843 } else { 841 } else {
@@ -940,6 +938,9 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
940 938
941 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 939 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
942 (struct smb_hdr *) pSMBr, &bytes_returned, long_op); 940 (struct smb_hdr *) pSMBr, &bytes_returned, long_op);
941#ifdef CONFIG_CIFS_STATS
942 atomic_inc(&tcon->num_writes);
943#endif
943 if (rc) { 944 if (rc) {
944 cFYI(1, ("Send error in write = %d", rc)); 945 cFYI(1, ("Send error in write = %d", rc));
945 *nbytes = 0; 946 *nbytes = 0;
@@ -1012,6 +1013,9 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
1012 1013
1013 rc = SendReceive2(xid, tcon->ses, (struct smb_hdr *) pSMB, smb_hdr_len, 1014 rc = SendReceive2(xid, tcon->ses, (struct smb_hdr *) pSMB, smb_hdr_len,
1014 buf, bytes_sent, &bytes_returned, long_op); 1015 buf, bytes_sent, &bytes_returned, long_op);
1016#ifdef CONFIG_CIFS_STATS
1017 atomic_inc(&tcon->num_writes);
1018#endif
1015 if (rc) { 1019 if (rc) {
1016 cFYI(1, ("Send error in write = %d", rc)); 1020 cFYI(1, ("Send error in write = %d", rc));
1017 *nbytes = 0; 1021 *nbytes = 0;
@@ -1087,7 +1091,9 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
1087 1091
1088 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1092 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1089 (struct smb_hdr *) pSMBr, &bytes_returned, timeout); 1093 (struct smb_hdr *) pSMBr, &bytes_returned, timeout);
1090 1094#ifdef CONFIG_CIFS_STATS
1095 atomic_inc(&tcon->num_locks);
1096#endif
1091 if (rc) { 1097 if (rc) {
1092 cFYI(1, ("Send error in Lock = %d", rc)); 1098 cFYI(1, ("Send error in Lock = %d", rc));
1093 } 1099 }
@@ -1121,6 +1127,9 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
1121 pSMB->ByteCount = 0; 1127 pSMB->ByteCount = 0;
1122 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1128 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1123 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 1129 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
1130#ifdef CONFIG_CIFS_STATS
1131 atomic_inc(&tcon->num_closes);
1132#endif
1124 if (rc) { 1133 if (rc) {
1125 if(rc!=-EINTR) { 1134 if(rc!=-EINTR) {
1126 /* EINTR is expected when user ctl-c to kill app */ 1135 /* EINTR is expected when user ctl-c to kill app */
@@ -1193,16 +1202,13 @@ renameRetry:
1193 1202
1194 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1203 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1195 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 1204 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
1205#ifdef CONFIG_CIFS_STATS
1206 atomic_inc(&tcon->num_renames);
1207#endif
1196 if (rc) { 1208 if (rc) {
1197 cFYI(1, ("Send error in rename = %d", rc)); 1209 cFYI(1, ("Send error in rename = %d", rc));
1198 } 1210 }
1199 1211
1200#ifdef CONFIG_CIFS_STATS
1201 else {
1202 atomic_inc(&tcon->num_renames);
1203 }
1204#endif
1205
1206 cifs_buf_release(pSMB); 1212 cifs_buf_release(pSMB);
1207 1213
1208 if (rc == -EAGAIN) 1214 if (rc == -EAGAIN)
@@ -1277,14 +1283,13 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
1277 pSMB->ByteCount = cpu_to_le16(byte_count); 1283 pSMB->ByteCount = cpu_to_le16(byte_count);
1278 rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, 1284 rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB,
1279 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 1285 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
1286#ifdef CONFIG_CIFS_STATS
1287 atomic_inc(&pTcon->num_t2renames);
1288#endif
1280 if (rc) { 1289 if (rc) {
1281 cFYI(1,("Send error in Rename (by file handle) = %d", rc)); 1290 cFYI(1,("Send error in Rename (by file handle) = %d", rc));
1282 } 1291 }
1283#ifdef CONFIG_CIFS_STATS 1292
1284 else {
1285 atomic_inc(&pTcon->num_t2renames);
1286 }
1287#endif
1288 cifs_buf_release(pSMB); 1293 cifs_buf_release(pSMB);
1289 1294
1290 /* Note: On -EAGAIN error only caller can retry on handle based calls 1295 /* Note: On -EAGAIN error only caller can retry on handle based calls
@@ -1438,6 +1443,9 @@ createSymLinkRetry:
1438 pSMB->ByteCount = cpu_to_le16(byte_count); 1443 pSMB->ByteCount = cpu_to_le16(byte_count);
1439 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1444 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1440 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 1445 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
1446#ifdef CONFIG_CIFS_STATS
1447 atomic_inc(&tcon->num_symlinks);
1448#endif
1441 if (rc) { 1449 if (rc) {
1442 cFYI(1, 1450 cFYI(1,
1443 ("Send error in SetPathInfo (create symlink) = %d", 1451 ("Send error in SetPathInfo (create symlink) = %d",
@@ -1527,6 +1535,9 @@ createHardLinkRetry:
1527 pSMB->ByteCount = cpu_to_le16(byte_count); 1535 pSMB->ByteCount = cpu_to_le16(byte_count);
1528 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1536 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1529 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 1537 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
1538#ifdef CONFIG_CIFS_STATS
1539 atomic_inc(&tcon->num_hardlinks);
1540#endif
1530 if (rc) { 1541 if (rc) {
1531 cFYI(1, ("Send error in SetPathInfo (hard link) = %d", rc)); 1542 cFYI(1, ("Send error in SetPathInfo (hard link) = %d", rc));
1532 } 1543 }
@@ -1597,6 +1608,9 @@ winCreateHardLinkRetry:
1597 1608
1598 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 1609 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
1599 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 1610 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
1611#ifdef CONFIG_CIFS_STATS
1612 atomic_inc(&tcon->num_hardlinks);
1613#endif
1600 if (rc) { 1614 if (rc) {
1601 cFYI(1, ("Send error in hard link (NT rename) = %d", rc)); 1615 cFYI(1, ("Send error in hard link (NT rename) = %d", rc));
1602 } 1616 }
@@ -2519,6 +2533,9 @@ findFirstRetry:
2519 2533
2520 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 2534 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2521 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 2535 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
2536#ifdef CONFIG_CIFS_STATS
2537 atomic_inc(&tcon->num_ffirst);
2538#endif
2522 2539
2523 if (rc) {/* BB add logic to retry regular search if Unix search rejected unexpectedly by server */ 2540 if (rc) {/* BB add logic to retry regular search if Unix search rejected unexpectedly by server */
2524 /* BB Add code to handle unsupported level rc */ 2541 /* BB Add code to handle unsupported level rc */
@@ -2532,9 +2549,6 @@ findFirstRetry:
2532 if (rc == -EAGAIN) 2549 if (rc == -EAGAIN)
2533 goto findFirstRetry; 2550 goto findFirstRetry;
2534 } else { /* decode response */ 2551 } else { /* decode response */
2535#ifdef CONFIG_CIFS_STATS
2536 atomic_inc(&tcon->num_ffirst);
2537#endif
2538 /* BB remember to free buffer if error BB */ 2552 /* BB remember to free buffer if error BB */
2539 rc = validate_t2((struct smb_t2_rsp *)pSMBr); 2553 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
2540 if(rc == 0) { 2554 if(rc == 0) {
@@ -2643,7 +2657,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
2643 2657
2644 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, 2658 rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
2645 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 2659 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
2646 2660#ifdef CONFIG_CIFS_STATS
2661 atomic_inc(&tcon->num_fnext);
2662#endif
2647 if (rc) { 2663 if (rc) {
2648 if (rc == -EBADF) { 2664 if (rc == -EBADF) {
2649 psrch_inf->endOfSearch = TRUE; 2665 psrch_inf->endOfSearch = TRUE;
@@ -2651,9 +2667,6 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
2651 } else 2667 } else
2652 cFYI(1, ("FindNext returned = %d", rc)); 2668 cFYI(1, ("FindNext returned = %d", rc));
2653 } else { /* decode response */ 2669 } else { /* decode response */
2654#ifdef CONFIG_CIFS_STATS
2655 atomic_inc(&tcon->num_fnext);
2656#endif
2657 rc = validate_t2((struct smb_t2_rsp *)pSMBr); 2670 rc = validate_t2((struct smb_t2_rsp *)pSMBr);
2658 2671
2659 if(rc == 0) { 2672 if(rc == 0) {