aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2013-05-04 23:12:25 -0400
committerSteve French <smfrench@gmail.com>2013-05-04 23:17:23 -0400
commitf96637be081141d6f8813429499f164260b49d70 (patch)
treec91f5a9b5a2b7a67bbeda15d7c9805655547a098 /fs/cifs/transport.c
parentf7f7c1850eb98da758731ea7edfa830ebefe24cd (diff)
[CIFS] cifs: Rename cERROR and cFYI to cifs_dbg
It's not obvious from reading the macro names that these macros are for debugging. Convert the names to a single more typical kernel style cifs_dbg macro. cERROR(1, ...) -> cifs_dbg(VFS, ...) cFYI(1, ...) -> cifs_dbg(FYI, ...) cFYI(DBG2, ...) -> cifs_dbg(NOISY, ...) Move the terminating format newline from the macro to the call site. Add CONFIG_CIFS_DEBUG function cifs_vfs_err to emit the "CIFS VFS: " prefix for VFS messages. Size is reduced ~ 1% when CONFIG_CIFS_DEBUG is set (default y) $ size fs/cifs/cifs.ko* text data bss dec hex filename 265245 2525 132 267902 4167e fs/cifs/cifs.ko.new 268359 2525 132 271016 422a8 fs/cifs/cifs.ko.old Other miscellaneous changes around these conversions: o Miscellaneous typo fixes o Add terminating \n's to almost all formats and remove them from the macros to be more kernel style like. A few formats previously had defective \n's o Remove unnecessary OOM messages as kmalloc() calls dump_stack o Coalesce formats to make grep easier, added missing spaces when coalescing formats o Use %s, __func__ instead of embedded function name o Removed unnecessary "cifs: " prefixes o Convert kzalloc with multiply to kcalloc o Remove unused cifswarn macro Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c61
1 files changed, 31 insertions, 30 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 1a528680ec5a..cf8bf69bd60c 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -49,7 +49,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)
49 struct mid_q_entry *temp; 49 struct mid_q_entry *temp;
50 50
51 if (server == NULL) { 51 if (server == NULL) {
52 cERROR(1, "Null TCP session in AllocMidQEntry"); 52 cifs_dbg(VFS, "Null TCP session in AllocMidQEntry\n");
53 return NULL; 53 return NULL;
54 } 54 }
55 55
@@ -61,7 +61,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)
61 temp->mid = smb_buffer->Mid; /* always LE */ 61 temp->mid = smb_buffer->Mid; /* always LE */
62 temp->pid = current->pid; 62 temp->pid = current->pid;
63 temp->command = cpu_to_le16(smb_buffer->Command); 63 temp->command = cpu_to_le16(smb_buffer->Command);
64 cFYI(1, "For smb_command %d", smb_buffer->Command); 64 cifs_dbg(FYI, "For smb_command %d\n", smb_buffer->Command);
65 /* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */ 65 /* do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */
66 /* when mid allocated can be before when sent */ 66 /* when mid allocated can be before when sent */
67 temp->when_alloc = jiffies; 67 temp->when_alloc = jiffies;
@@ -188,8 +188,8 @@ smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec,
188 WARN_ON_ONCE(rc == -ENOSPC); 188 WARN_ON_ONCE(rc == -ENOSPC);
189 i++; 189 i++;
190 if (i >= 14 || (!server->noblocksnd && (i > 2))) { 190 if (i >= 14 || (!server->noblocksnd && (i > 2))) {
191 cERROR(1, "sends on sock %p stuck for 15 " 191 cifs_dbg(VFS, "sends on sock %p stuck for 15 seconds\n",
192 "seconds", ssocket); 192 ssocket);
193 rc = -EAGAIN; 193 rc = -EAGAIN;
194 break; 194 break;
195 } 195 }
@@ -209,14 +209,14 @@ smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec,
209 } 209 }
210 210
211 if (rc > remaining) { 211 if (rc > remaining) {
212 cERROR(1, "sent %d requested %d", rc, remaining); 212 cifs_dbg(VFS, "sent %d requested %d\n", rc, remaining);
213 break; 213 break;
214 } 214 }
215 215
216 if (rc == 0) { 216 if (rc == 0) {
217 /* should never happen, letting socket clear before 217 /* should never happen, letting socket clear before
218 retrying is our only obvious option here */ 218 retrying is our only obvious option here */
219 cERROR(1, "tcp sent no data"); 219 cifs_dbg(VFS, "tcp sent no data\n");
220 msleep(500); 220 msleep(500);
221 continue; 221 continue;
222 } 222 }
@@ -291,7 +291,7 @@ smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst)
291 if (ssocket == NULL) 291 if (ssocket == NULL)
292 return -ENOTSOCK; 292 return -ENOTSOCK;
293 293
294 cFYI(1, "Sending smb: smb_len=%u", smb_buf_length); 294 cifs_dbg(FYI, "Sending smb: smb_len=%u\n", smb_buf_length);
295 dump_smb(iov[0].iov_base, iov[0].iov_len); 295 dump_smb(iov[0].iov_base, iov[0].iov_len);
296 296
297 /* cork the socket */ 297 /* cork the socket */
@@ -324,8 +324,8 @@ uncork:
324 (char *)&val, sizeof(val)); 324 (char *)&val, sizeof(val));
325 325
326 if ((total_len > 0) && (total_len != smb_buf_length + 4)) { 326 if ((total_len > 0) && (total_len != smb_buf_length + 4)) {
327 cFYI(1, "partial send (wanted=%u sent=%zu): terminating " 327 cifs_dbg(FYI, "partial send (wanted=%u sent=%zu): terminating session\n",
328 "session", smb_buf_length + 4, total_len); 328 smb_buf_length + 4, total_len);
329 /* 329 /*
330 * If we have only sent part of an SMB then the next SMB could 330 * If we have only sent part of an SMB then the next SMB could
331 * be taken as the remainder of this one. We need to kill the 331 * be taken as the remainder of this one. We need to kill the
@@ -335,7 +335,8 @@ uncork:
335 } 335 }
336 336
337 if (rc < 0 && rc != -EINTR) 337 if (rc < 0 && rc != -EINTR)
338 cERROR(1, "Error %d sending data on socket to server", rc); 338 cifs_dbg(VFS, "Error %d sending data on socket to server\n",
339 rc);
339 else 340 else
340 rc = 0; 341 rc = 0;
341 342
@@ -427,7 +428,7 @@ static int allocate_mid(struct cifs_ses *ses, struct smb_hdr *in_buf,
427 } 428 }
428 429
429 if (ses->server->tcpStatus == CifsNeedReconnect) { 430 if (ses->server->tcpStatus == CifsNeedReconnect) {
430 cFYI(1, "tcp session dead - return to caller to retry"); 431 cifs_dbg(FYI, "tcp session dead - return to caller to retry\n");
431 return -EAGAIN; 432 return -EAGAIN;
432 } 433 }
433 434
@@ -559,7 +560,7 @@ SendReceiveNoRsp(const unsigned int xid, struct cifs_ses *ses,
559 iov[0].iov_len = get_rfc1002_length(in_buf) + 4; 560 iov[0].iov_len = get_rfc1002_length(in_buf) + 4;
560 flags |= CIFS_NO_RESP; 561 flags |= CIFS_NO_RESP;
561 rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags); 562 rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags);
562 cFYI(DBG2, "SendRcvNoRsp flags %d rc %d", flags, rc); 563 cifs_dbg(NOISY, "SendRcvNoRsp flags %d rc %d\n", flags, rc);
563 564
564 return rc; 565 return rc;
565} 566}
@@ -569,8 +570,8 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server)
569{ 570{
570 int rc = 0; 571 int rc = 0;
571 572
572 cFYI(1, "%s: cmd=%d mid=%llu state=%d", __func__, 573 cifs_dbg(FYI, "%s: cmd=%d mid=%llu state=%d\n",
573 le16_to_cpu(mid->command), mid->mid, mid->mid_state); 574 __func__, le16_to_cpu(mid->command), mid->mid, mid->mid_state);
574 575
575 spin_lock(&GlobalMid_Lock); 576 spin_lock(&GlobalMid_Lock);
576 switch (mid->mid_state) { 577 switch (mid->mid_state) {
@@ -588,8 +589,8 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server)
588 break; 589 break;
589 default: 590 default:
590 list_del_init(&mid->qhead); 591 list_del_init(&mid->qhead);
591 cERROR(1, "%s: invalid mid state mid=%llu state=%d", __func__, 592 cifs_dbg(VFS, "%s: invalid mid state mid=%llu state=%d\n",
592 mid->mid, mid->mid_state); 593 __func__, mid->mid, mid->mid_state);
593 rc = -EIO; 594 rc = -EIO;
594 } 595 }
595 spin_unlock(&GlobalMid_Lock); 596 spin_unlock(&GlobalMid_Lock);
@@ -626,8 +627,8 @@ cifs_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server,
626 rc = cifs_verify_signature(&rqst, server, 627 rc = cifs_verify_signature(&rqst, server,
627 mid->sequence_number + 1); 628 mid->sequence_number + 1);
628 if (rc) 629 if (rc)
629 cERROR(1, "SMB signature verification returned error = " 630 cifs_dbg(VFS, "SMB signature verification returned error = %d\n",
630 "%d", rc); 631 rc);
631 } 632 }
632 633
633 /* BB special case reconnect tid and uid here? */ 634 /* BB special case reconnect tid and uid here? */
@@ -672,7 +673,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
672 673
673 if ((ses == NULL) || (ses->server == NULL)) { 674 if ((ses == NULL) || (ses->server == NULL)) {
674 cifs_small_buf_release(buf); 675 cifs_small_buf_release(buf);
675 cERROR(1, "Null session"); 676 cifs_dbg(VFS, "Null session\n");
676 return -EIO; 677 return -EIO;
677 } 678 }
678 679
@@ -752,7 +753,7 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
752 753
753 if (!midQ->resp_buf || midQ->mid_state != MID_RESPONSE_RECEIVED) { 754 if (!midQ->resp_buf || midQ->mid_state != MID_RESPONSE_RECEIVED) {
754 rc = -EIO; 755 rc = -EIO;
755 cFYI(1, "Bad MID state?"); 756 cifs_dbg(FYI, "Bad MID state?\n");
756 goto out; 757 goto out;
757 } 758 }
758 759
@@ -788,11 +789,11 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
788 struct mid_q_entry *midQ; 789 struct mid_q_entry *midQ;
789 790
790 if (ses == NULL) { 791 if (ses == NULL) {
791 cERROR(1, "Null smb session"); 792 cifs_dbg(VFS, "Null smb session\n");
792 return -EIO; 793 return -EIO;
793 } 794 }
794 if (ses->server == NULL) { 795 if (ses->server == NULL) {
795 cERROR(1, "Null tcp session"); 796 cifs_dbg(VFS, "Null tcp session\n");
796 return -EIO; 797 return -EIO;
797 } 798 }
798 799
@@ -805,8 +806,8 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
805 806
806 if (be32_to_cpu(in_buf->smb_buf_length) > CIFSMaxBufSize + 807 if (be32_to_cpu(in_buf->smb_buf_length) > CIFSMaxBufSize +
807 MAX_CIFS_HDR_SIZE - 4) { 808 MAX_CIFS_HDR_SIZE - 4) {
808 cERROR(1, "Illegal length, greater than maximum frame, %d", 809 cifs_dbg(VFS, "Illegal length, greater than maximum frame, %d\n",
809 be32_to_cpu(in_buf->smb_buf_length)); 810 be32_to_cpu(in_buf->smb_buf_length));
810 return -EIO; 811 return -EIO;
811 } 812 }
812 813
@@ -871,7 +872,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
871 if (!midQ->resp_buf || !out_buf || 872 if (!midQ->resp_buf || !out_buf ||
872 midQ->mid_state != MID_RESPONSE_RECEIVED) { 873 midQ->mid_state != MID_RESPONSE_RECEIVED) {
873 rc = -EIO; 874 rc = -EIO;
874 cERROR(1, "Bad MID state?"); 875 cifs_dbg(VFS, "Bad MID state?\n");
875 goto out; 876 goto out;
876 } 877 }
877 878
@@ -921,13 +922,13 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
921 struct cifs_ses *ses; 922 struct cifs_ses *ses;
922 923
923 if (tcon == NULL || tcon->ses == NULL) { 924 if (tcon == NULL || tcon->ses == NULL) {
924 cERROR(1, "Null smb session"); 925 cifs_dbg(VFS, "Null smb session\n");
925 return -EIO; 926 return -EIO;
926 } 927 }
927 ses = tcon->ses; 928 ses = tcon->ses;
928 929
929 if (ses->server == NULL) { 930 if (ses->server == NULL) {
930 cERROR(1, "Null tcp session"); 931 cifs_dbg(VFS, "Null tcp session\n");
931 return -EIO; 932 return -EIO;
932 } 933 }
933 934
@@ -940,8 +941,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
940 941
941 if (be32_to_cpu(in_buf->smb_buf_length) > CIFSMaxBufSize + 942 if (be32_to_cpu(in_buf->smb_buf_length) > CIFSMaxBufSize +
942 MAX_CIFS_HDR_SIZE - 4) { 943 MAX_CIFS_HDR_SIZE - 4) {
943 cERROR(1, "Illegal length, greater than maximum frame, %d", 944 cifs_dbg(VFS, "Illegal length, greater than maximum frame, %d\n",
944 be32_to_cpu(in_buf->smb_buf_length)); 945 be32_to_cpu(in_buf->smb_buf_length));
945 return -EIO; 946 return -EIO;
946 } 947 }
947 948
@@ -1038,7 +1039,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
1038 /* rcvd frame is ok */ 1039 /* rcvd frame is ok */
1039 if (out_buf == NULL || midQ->mid_state != MID_RESPONSE_RECEIVED) { 1040 if (out_buf == NULL || midQ->mid_state != MID_RESPONSE_RECEIVED) {
1040 rc = -EIO; 1041 rc = -EIO;
1041 cERROR(1, "Bad MID state?"); 1042 cifs_dbg(VFS, "Bad MID state?\n");
1042 goto out; 1043 goto out;
1043 } 1044 }
1044 1045