diff options
author | Steve French <sfrench@us.ibm.com> | 2005-08-24 16:59:35 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-08-24 16:59:35 -0400 |
commit | a45443475835ab4d1c753159812aca21b5c333a3 (patch) | |
tree | 308c2535875dec62bdafae3d3ed2a98af588d608 /fs/cifs/cifssmb.c | |
parent | 6b8edfe0f918e7585acb3bd63f62ff56e32dd3d2 (diff) |
CIFS: Reduce CONFIG_CIFS_STATS ifdefs
Make cifs_stats code conditional in the header files to avoid ifdefs in the
main code.
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 88 |
1 files changed, 24 insertions, 64 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 811ab3dffafa..698cdcebca04 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -166,11 +166,9 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
166 | 166 | ||
167 | header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon,wct); | 167 | header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon,wct); |
168 | 168 | ||
169 | #ifdef CONFIG_CIFS_STATS | 169 | if(tcon != NULL) |
170 | if(tcon != NULL) { | 170 | cifs_stats_inc(&tcon->num_smbs_sent); |
171 | atomic_inc(&tcon->num_smbs_sent); | 171 | |
172 | } | ||
173 | #endif /* CONFIG_CIFS_STATS */ | ||
174 | return rc; | 172 | return rc; |
175 | } | 173 | } |
176 | 174 | ||
@@ -269,11 +267,9 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, | |||
269 | header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon, | 267 | header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon, |
270 | wct /*wct */ ); | 268 | wct /*wct */ ); |
271 | 269 | ||
272 | #ifdef CONFIG_CIFS_STATS | 270 | if(tcon != NULL) |
273 | if(tcon != NULL) { | 271 | cifs_stats_inc(&tcon->num_smbs_sent); |
274 | atomic_inc(&tcon->num_smbs_sent); | 272 | |
275 | } | ||
276 | #endif /* CONFIG_CIFS_STATS */ | ||
277 | return rc; | 273 | return rc; |
278 | } | 274 | } |
279 | 275 | ||
@@ -584,9 +580,7 @@ DelFileRetry: | |||
584 | pSMB->ByteCount = cpu_to_le16(name_len + 1); | 580 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
585 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 581 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
586 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 582 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
587 | #ifdef CONFIG_CIFS_STATS | 583 | cifs_stats_inc(&tcon->num_deletes); |
588 | atomic_inc(&tcon->num_deletes); | ||
589 | #endif | ||
590 | if (rc) { | 584 | if (rc) { |
591 | cFYI(1, ("Error in RMFile = %d", rc)); | 585 | cFYI(1, ("Error in RMFile = %d", rc)); |
592 | } | 586 | } |
@@ -631,9 +625,7 @@ RmDirRetry: | |||
631 | pSMB->ByteCount = cpu_to_le16(name_len + 1); | 625 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
632 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 626 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
633 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 627 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
634 | #ifdef CONFIG_CIFS_STATS | 628 | cifs_stats_inc(&tcon->num_rmdirs); |
635 | atomic_inc(&tcon->num_rmdirs); | ||
636 | #endif | ||
637 | if (rc) { | 629 | if (rc) { |
638 | cFYI(1, ("Error in RMDir = %d", rc)); | 630 | cFYI(1, ("Error in RMDir = %d", rc)); |
639 | } | 631 | } |
@@ -677,9 +669,7 @@ MkDirRetry: | |||
677 | pSMB->ByteCount = cpu_to_le16(name_len + 1); | 669 | pSMB->ByteCount = cpu_to_le16(name_len + 1); |
678 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 670 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
679 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 671 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
680 | #ifdef CONFIG_CIFS_STATS | 672 | cifs_stats_inc(&tcon->num_mkdirs); |
681 | atomic_inc(&tcon->num_mkdirs); | ||
682 | #endif | ||
683 | if (rc) { | 673 | if (rc) { |
684 | cFYI(1, ("Error in Mkdir = %d", rc)); | 674 | cFYI(1, ("Error in Mkdir = %d", rc)); |
685 | } | 675 | } |
@@ -767,9 +757,7 @@ openRetry: | |||
767 | /* long_op set to 1 to allow for oplock break timeouts */ | 757 | /* long_op set to 1 to allow for oplock break timeouts */ |
768 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 758 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
769 | (struct smb_hdr *) pSMBr, &bytes_returned, 1); | 759 | (struct smb_hdr *) pSMBr, &bytes_returned, 1); |
770 | #ifdef CONFIG_CIFS_STATS | 760 | cifs_stats_inc(&tcon->num_opens); |
771 | atomic_inc(&tcon->num_opens); | ||
772 | #endif | ||
773 | if (rc) { | 761 | if (rc) { |
774 | cFYI(1, ("Error in Open = %d", rc)); | 762 | cFYI(1, ("Error in Open = %d", rc)); |
775 | } else { | 763 | } else { |
@@ -833,9 +821,7 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, | |||
833 | 821 | ||
834 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 822 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
835 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 823 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
836 | #ifdef CONFIG_CIFS_STATS | 824 | cifs_stats_inc(&tcon->num_reads); |
837 | atomic_inc(&tcon->num_reads); | ||
838 | #endif | ||
839 | if (rc) { | 825 | if (rc) { |
840 | cERROR(1, ("Send error in read = %d", rc)); | 826 | cERROR(1, ("Send error in read = %d", rc)); |
841 | } else { | 827 | } else { |
@@ -938,9 +924,7 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, | |||
938 | 924 | ||
939 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 925 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
940 | (struct smb_hdr *) pSMBr, &bytes_returned, long_op); | 926 | (struct smb_hdr *) pSMBr, &bytes_returned, long_op); |
941 | #ifdef CONFIG_CIFS_STATS | 927 | cifs_stats_inc(&tcon->num_writes); |
942 | atomic_inc(&tcon->num_writes); | ||
943 | #endif | ||
944 | if (rc) { | 928 | if (rc) { |
945 | cFYI(1, ("Send error in write = %d", rc)); | 929 | cFYI(1, ("Send error in write = %d", rc)); |
946 | *nbytes = 0; | 930 | *nbytes = 0; |
@@ -1013,9 +997,7 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, | |||
1013 | 997 | ||
1014 | rc = SendReceive2(xid, tcon->ses, (struct smb_hdr *) pSMB, smb_hdr_len, | 998 | rc = SendReceive2(xid, tcon->ses, (struct smb_hdr *) pSMB, smb_hdr_len, |
1015 | buf, bytes_sent, &bytes_returned, long_op); | 999 | buf, bytes_sent, &bytes_returned, long_op); |
1016 | #ifdef CONFIG_CIFS_STATS | 1000 | cifs_stats_inc(&tcon->num_writes); |
1017 | atomic_inc(&tcon->num_writes); | ||
1018 | #endif | ||
1019 | if (rc) { | 1001 | if (rc) { |
1020 | cFYI(1, ("Send error in write = %d", rc)); | 1002 | cFYI(1, ("Send error in write = %d", rc)); |
1021 | *nbytes = 0; | 1003 | *nbytes = 0; |
@@ -1091,9 +1073,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, | |||
1091 | 1073 | ||
1092 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1074 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1093 | (struct smb_hdr *) pSMBr, &bytes_returned, timeout); | 1075 | (struct smb_hdr *) pSMBr, &bytes_returned, timeout); |
1094 | #ifdef CONFIG_CIFS_STATS | 1076 | cifs_stats_inc(&tcon->num_locks); |
1095 | atomic_inc(&tcon->num_locks); | ||
1096 | #endif | ||
1097 | if (rc) { | 1077 | if (rc) { |
1098 | cFYI(1, ("Send error in Lock = %d", rc)); | 1078 | cFYI(1, ("Send error in Lock = %d", rc)); |
1099 | } | 1079 | } |
@@ -1127,9 +1107,7 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id) | |||
1127 | pSMB->ByteCount = 0; | 1107 | pSMB->ByteCount = 0; |
1128 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1108 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1129 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1109 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1130 | #ifdef CONFIG_CIFS_STATS | 1110 | cifs_stats_inc(&tcon->num_closes); |
1131 | atomic_inc(&tcon->num_closes); | ||
1132 | #endif | ||
1133 | if (rc) { | 1111 | if (rc) { |
1134 | if(rc!=-EINTR) { | 1112 | if(rc!=-EINTR) { |
1135 | /* EINTR is expected when user ctl-c to kill app */ | 1113 | /* EINTR is expected when user ctl-c to kill app */ |
@@ -1202,9 +1180,7 @@ renameRetry: | |||
1202 | 1180 | ||
1203 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1181 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1204 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1182 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1205 | #ifdef CONFIG_CIFS_STATS | 1183 | cifs_stats_inc(&tcon->num_renames); |
1206 | atomic_inc(&tcon->num_renames); | ||
1207 | #endif | ||
1208 | if (rc) { | 1184 | if (rc) { |
1209 | cFYI(1, ("Send error in rename = %d", rc)); | 1185 | cFYI(1, ("Send error in rename = %d", rc)); |
1210 | } | 1186 | } |
@@ -1283,9 +1259,7 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, | |||
1283 | pSMB->ByteCount = cpu_to_le16(byte_count); | 1259 | pSMB->ByteCount = cpu_to_le16(byte_count); |
1284 | rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, | 1260 | rc = SendReceive(xid, pTcon->ses, (struct smb_hdr *) pSMB, |
1285 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1261 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1286 | #ifdef CONFIG_CIFS_STATS | 1262 | cifs_stats_inc(&pTcon->num_t2renames); |
1287 | atomic_inc(&pTcon->num_t2renames); | ||
1288 | #endif | ||
1289 | if (rc) { | 1263 | if (rc) { |
1290 | cFYI(1,("Send error in Rename (by file handle) = %d", rc)); | 1264 | cFYI(1,("Send error in Rename (by file handle) = %d", rc)); |
1291 | } | 1265 | } |
@@ -1443,9 +1417,7 @@ createSymLinkRetry: | |||
1443 | pSMB->ByteCount = cpu_to_le16(byte_count); | 1417 | pSMB->ByteCount = cpu_to_le16(byte_count); |
1444 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1418 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1445 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1419 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1446 | #ifdef CONFIG_CIFS_STATS | 1420 | cifs_stats_inc(&tcon->num_symlinks); |
1447 | atomic_inc(&tcon->num_symlinks); | ||
1448 | #endif | ||
1449 | if (rc) { | 1421 | if (rc) { |
1450 | cFYI(1, | 1422 | cFYI(1, |
1451 | ("Send error in SetPathInfo (create symlink) = %d", | 1423 | ("Send error in SetPathInfo (create symlink) = %d", |
@@ -1535,9 +1507,7 @@ createHardLinkRetry: | |||
1535 | pSMB->ByteCount = cpu_to_le16(byte_count); | 1507 | pSMB->ByteCount = cpu_to_le16(byte_count); |
1536 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1508 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1537 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1509 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1538 | #ifdef CONFIG_CIFS_STATS | 1510 | cifs_stats_inc(&tcon->num_hardlinks); |
1539 | atomic_inc(&tcon->num_hardlinks); | ||
1540 | #endif | ||
1541 | if (rc) { | 1511 | if (rc) { |
1542 | cFYI(1, ("Send error in SetPathInfo (hard link) = %d", rc)); | 1512 | cFYI(1, ("Send error in SetPathInfo (hard link) = %d", rc)); |
1543 | } | 1513 | } |
@@ -1608,9 +1578,7 @@ winCreateHardLinkRetry: | |||
1608 | 1578 | ||
1609 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 1579 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
1610 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 1580 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
1611 | #ifdef CONFIG_CIFS_STATS | 1581 | cifs_stats_inc(&tcon->num_hardlinks); |
1612 | atomic_inc(&tcon->num_hardlinks); | ||
1613 | #endif | ||
1614 | if (rc) { | 1582 | if (rc) { |
1615 | cFYI(1, ("Send error in hard link (NT rename) = %d", rc)); | 1583 | cFYI(1, ("Send error in hard link (NT rename) = %d", rc)); |
1616 | } | 1584 | } |
@@ -2490,9 +2458,7 @@ findUniqueRetry: | |||
2490 | if (rc) { | 2458 | if (rc) { |
2491 | cFYI(1, ("Send error in FindFileDirInfo = %d", rc)); | 2459 | cFYI(1, ("Send error in FindFileDirInfo = %d", rc)); |
2492 | } else { /* decode response */ | 2460 | } else { /* decode response */ |
2493 | #ifdef CONFIG_CIFS_STATS | 2461 | cifs_stats_inc(&tcon->num_ffirst); |
2494 | atomic_inc(&tcon->num_ffirst); | ||
2495 | #endif | ||
2496 | /* BB fill in */ | 2462 | /* BB fill in */ |
2497 | } | 2463 | } |
2498 | 2464 | ||
@@ -2592,9 +2558,7 @@ findFirstRetry: | |||
2592 | 2558 | ||
2593 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2559 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2594 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2560 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2595 | #ifdef CONFIG_CIFS_STATS | 2561 | cifs_stats_inc(&tcon->num_ffirst); |
2596 | atomic_inc(&tcon->num_ffirst); | ||
2597 | #endif | ||
2598 | 2562 | ||
2599 | if (rc) {/* BB add logic to retry regular search if Unix search rejected unexpectedly by server */ | 2563 | if (rc) {/* BB add logic to retry regular search if Unix search rejected unexpectedly by server */ |
2600 | /* BB Add code to handle unsupported level rc */ | 2564 | /* BB Add code to handle unsupported level rc */ |
@@ -2716,9 +2680,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, | |||
2716 | 2680 | ||
2717 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2681 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2718 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2682 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2719 | #ifdef CONFIG_CIFS_STATS | 2683 | cifs_stats_inc(&tcon->num_fnext); |
2720 | atomic_inc(&tcon->num_fnext); | ||
2721 | #endif | ||
2722 | if (rc) { | 2684 | if (rc) { |
2723 | if (rc == -EBADF) { | 2685 | if (rc == -EBADF) { |
2724 | psrch_inf->endOfSearch = TRUE; | 2686 | psrch_inf->endOfSearch = TRUE; |
@@ -2795,9 +2757,7 @@ CIFSFindClose(const int xid, struct cifsTconInfo *tcon, const __u16 searchHandle | |||
2795 | if (rc) { | 2757 | if (rc) { |
2796 | cERROR(1, ("Send error in FindClose = %d", rc)); | 2758 | cERROR(1, ("Send error in FindClose = %d", rc)); |
2797 | } | 2759 | } |
2798 | #ifdef CONFIG_CIFS_STATS | 2760 | cifs_stats_inc(&tcon->num_fclose); |
2799 | atomic_inc(&tcon->num_fclose); | ||
2800 | #endif | ||
2801 | cifs_small_buf_release(pSMB); | 2761 | cifs_small_buf_release(pSMB); |
2802 | 2762 | ||
2803 | /* Since session is dead, search handle closed on server already */ | 2763 | /* Since session is dead, search handle closed on server already */ |