diff options
author | Joe Perches <joe@perches.com> | 2013-05-04 23:12:25 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2013-05-04 23:17:23 -0400 |
commit | f96637be081141d6f8813429499f164260b49d70 (patch) | |
tree | c91f5a9b5a2b7a67bbeda15d7c9805655547a098 /fs/cifs/misc.c | |
parent | f7f7c1850eb98da758731ea7edfa830ebefe24cd (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/misc.c')
-rw-r--r-- | fs/cifs/misc.c | 78 |
1 files changed, 37 insertions, 41 deletions
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 1b15bf839f37..1bec014779fd 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -54,7 +54,7 @@ _get_xid(void) | |||
54 | if (GlobalTotalActiveXid > GlobalMaxActiveXid) | 54 | if (GlobalTotalActiveXid > GlobalMaxActiveXid) |
55 | GlobalMaxActiveXid = GlobalTotalActiveXid; | 55 | GlobalMaxActiveXid = GlobalTotalActiveXid; |
56 | if (GlobalTotalActiveXid > 65000) | 56 | if (GlobalTotalActiveXid > 65000) |
57 | cFYI(1, "warning: more than 65000 requests active"); | 57 | cifs_dbg(FYI, "warning: more than 65000 requests active\n"); |
58 | xid = GlobalCurrentXid++; | 58 | xid = GlobalCurrentXid++; |
59 | spin_unlock(&GlobalMid_Lock); | 59 | spin_unlock(&GlobalMid_Lock); |
60 | return xid; | 60 | return xid; |
@@ -91,7 +91,7 @@ void | |||
91 | sesInfoFree(struct cifs_ses *buf_to_free) | 91 | sesInfoFree(struct cifs_ses *buf_to_free) |
92 | { | 92 | { |
93 | if (buf_to_free == NULL) { | 93 | if (buf_to_free == NULL) { |
94 | cFYI(1, "Null buffer passed to sesInfoFree"); | 94 | cifs_dbg(FYI, "Null buffer passed to sesInfoFree\n"); |
95 | return; | 95 | return; |
96 | } | 96 | } |
97 | 97 | ||
@@ -130,7 +130,7 @@ void | |||
130 | tconInfoFree(struct cifs_tcon *buf_to_free) | 130 | tconInfoFree(struct cifs_tcon *buf_to_free) |
131 | { | 131 | { |
132 | if (buf_to_free == NULL) { | 132 | if (buf_to_free == NULL) { |
133 | cFYI(1, "Null buffer passed to tconInfoFree"); | 133 | cifs_dbg(FYI, "Null buffer passed to tconInfoFree\n"); |
134 | return; | 134 | return; |
135 | } | 135 | } |
136 | atomic_dec(&tconInfoAllocCount); | 136 | atomic_dec(&tconInfoAllocCount); |
@@ -180,7 +180,7 @@ void | |||
180 | cifs_buf_release(void *buf_to_free) | 180 | cifs_buf_release(void *buf_to_free) |
181 | { | 181 | { |
182 | if (buf_to_free == NULL) { | 182 | if (buf_to_free == NULL) { |
183 | /* cFYI(1, "Null buffer passed to cifs_buf_release");*/ | 183 | /* cifs_dbg(FYI, "Null buffer passed to cifs_buf_release\n");*/ |
184 | return; | 184 | return; |
185 | } | 185 | } |
186 | mempool_free(buf_to_free, cifs_req_poolp); | 186 | mempool_free(buf_to_free, cifs_req_poolp); |
@@ -216,7 +216,7 @@ cifs_small_buf_release(void *buf_to_free) | |||
216 | { | 216 | { |
217 | 217 | ||
218 | if (buf_to_free == NULL) { | 218 | if (buf_to_free == NULL) { |
219 | cFYI(1, "Null buffer passed to cifs_small_buf_release"); | 219 | cifs_dbg(FYI, "Null buffer passed to cifs_small_buf_release\n"); |
220 | return; | 220 | return; |
221 | } | 221 | } |
222 | mempool_free(buf_to_free, cifs_sm_req_poolp); | 222 | mempool_free(buf_to_free, cifs_sm_req_poolp); |
@@ -282,15 +282,15 @@ check_smb_hdr(struct smb_hdr *smb, __u16 mid) | |||
282 | { | 282 | { |
283 | /* does it have the right SMB "signature" ? */ | 283 | /* does it have the right SMB "signature" ? */ |
284 | if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) { | 284 | if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) { |
285 | cERROR(1, "Bad protocol string signature header 0x%x", | 285 | cifs_dbg(VFS, "Bad protocol string signature header 0x%x\n", |
286 | *(unsigned int *)smb->Protocol); | 286 | *(unsigned int *)smb->Protocol); |
287 | return 1; | 287 | return 1; |
288 | } | 288 | } |
289 | 289 | ||
290 | /* Make sure that message ids match */ | 290 | /* Make sure that message ids match */ |
291 | if (mid != smb->Mid) { | 291 | if (mid != smb->Mid) { |
292 | cERROR(1, "Mids do not match. received=%u expected=%u", | 292 | cifs_dbg(VFS, "Mids do not match. received=%u expected=%u\n", |
293 | smb->Mid, mid); | 293 | smb->Mid, mid); |
294 | return 1; | 294 | return 1; |
295 | } | 295 | } |
296 | 296 | ||
@@ -302,7 +302,7 @@ check_smb_hdr(struct smb_hdr *smb, __u16 mid) | |||
302 | if (smb->Command == SMB_COM_LOCKING_ANDX) | 302 | if (smb->Command == SMB_COM_LOCKING_ANDX) |
303 | return 0; | 303 | return 0; |
304 | 304 | ||
305 | cERROR(1, "Server sent request, not response. mid=%u", smb->Mid); | 305 | cifs_dbg(VFS, "Server sent request, not response. mid=%u\n", smb->Mid); |
306 | return 1; | 306 | return 1; |
307 | } | 307 | } |
308 | 308 | ||
@@ -313,8 +313,8 @@ checkSMB(char *buf, unsigned int total_read) | |||
313 | __u16 mid = smb->Mid; | 313 | __u16 mid = smb->Mid; |
314 | __u32 rfclen = be32_to_cpu(smb->smb_buf_length); | 314 | __u32 rfclen = be32_to_cpu(smb->smb_buf_length); |
315 | __u32 clc_len; /* calculated length */ | 315 | __u32 clc_len; /* calculated length */ |
316 | cFYI(0, "checkSMB Length: 0x%x, smb_buf_length: 0x%x", | 316 | cifs_dbg(FYI, "checkSMB Length: 0x%x, smb_buf_length: 0x%x\n", |
317 | total_read, rfclen); | 317 | total_read, rfclen); |
318 | 318 | ||
319 | /* is this frame too small to even get to a BCC? */ | 319 | /* is this frame too small to even get to a BCC? */ |
320 | if (total_read < 2 + sizeof(struct smb_hdr)) { | 320 | if (total_read < 2 + sizeof(struct smb_hdr)) { |
@@ -340,9 +340,9 @@ checkSMB(char *buf, unsigned int total_read) | |||
340 | tmp[sizeof(struct smb_hdr)+1] = 0; | 340 | tmp[sizeof(struct smb_hdr)+1] = 0; |
341 | return 0; | 341 | return 0; |
342 | } | 342 | } |
343 | cERROR(1, "rcvd invalid byte count (bcc)"); | 343 | cifs_dbg(VFS, "rcvd invalid byte count (bcc)\n"); |
344 | } else { | 344 | } else { |
345 | cERROR(1, "Length less than smb header size"); | 345 | cifs_dbg(VFS, "Length less than smb header size\n"); |
346 | } | 346 | } |
347 | return -EIO; | 347 | return -EIO; |
348 | } | 348 | } |
@@ -353,8 +353,8 @@ checkSMB(char *buf, unsigned int total_read) | |||
353 | clc_len = smbCalcSize(smb); | 353 | clc_len = smbCalcSize(smb); |
354 | 354 | ||
355 | if (4 + rfclen != total_read) { | 355 | if (4 + rfclen != total_read) { |
356 | cERROR(1, "Length read does not match RFC1001 length %d", | 356 | cifs_dbg(VFS, "Length read does not match RFC1001 length %d\n", |
357 | rfclen); | 357 | rfclen); |
358 | return -EIO; | 358 | return -EIO; |
359 | } | 359 | } |
360 | 360 | ||
@@ -365,12 +365,12 @@ checkSMB(char *buf, unsigned int total_read) | |||
365 | if (((4 + rfclen) & 0xFFFF) == (clc_len & 0xFFFF)) | 365 | if (((4 + rfclen) & 0xFFFF) == (clc_len & 0xFFFF)) |
366 | return 0; /* bcc wrapped */ | 366 | return 0; /* bcc wrapped */ |
367 | } | 367 | } |
368 | cFYI(1, "Calculated size %u vs length %u mismatch for mid=%u", | 368 | cifs_dbg(FYI, "Calculated size %u vs length %u mismatch for mid=%u\n", |
369 | clc_len, 4 + rfclen, smb->Mid); | 369 | clc_len, 4 + rfclen, smb->Mid); |
370 | 370 | ||
371 | if (4 + rfclen < clc_len) { | 371 | if (4 + rfclen < clc_len) { |
372 | cERROR(1, "RFC1001 size %u smaller than SMB for mid=%u", | 372 | cifs_dbg(VFS, "RFC1001 size %u smaller than SMB for mid=%u\n", |
373 | rfclen, smb->Mid); | 373 | rfclen, smb->Mid); |
374 | return -EIO; | 374 | return -EIO; |
375 | } else if (rfclen > clc_len + 512) { | 375 | } else if (rfclen > clc_len + 512) { |
376 | /* | 376 | /* |
@@ -382,8 +382,8 @@ checkSMB(char *buf, unsigned int total_read) | |||
382 | * trailing data, we choose limit the amount of extra | 382 | * trailing data, we choose limit the amount of extra |
383 | * data to 512 bytes. | 383 | * data to 512 bytes. |
384 | */ | 384 | */ |
385 | cERROR(1, "RFC1001 size %u more than 512 bytes larger " | 385 | cifs_dbg(VFS, "RFC1001 size %u more than 512 bytes larger than SMB for mid=%u\n", |
386 | "than SMB for mid=%u", rfclen, smb->Mid); | 386 | rfclen, smb->Mid); |
387 | return -EIO; | 387 | return -EIO; |
388 | } | 388 | } |
389 | } | 389 | } |
@@ -401,7 +401,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) | |||
401 | struct cifsInodeInfo *pCifsInode; | 401 | struct cifsInodeInfo *pCifsInode; |
402 | struct cifsFileInfo *netfile; | 402 | struct cifsFileInfo *netfile; |
403 | 403 | ||
404 | cFYI(1, "Checking for oplock break or dnotify response"); | 404 | cifs_dbg(FYI, "Checking for oplock break or dnotify response\n"); |
405 | if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) && | 405 | if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) && |
406 | (pSMB->hdr.Flags & SMBFLG_RESPONSE)) { | 406 | (pSMB->hdr.Flags & SMBFLG_RESPONSE)) { |
407 | struct smb_com_transaction_change_notify_rsp *pSMBr = | 407 | struct smb_com_transaction_change_notify_rsp *pSMBr = |
@@ -413,15 +413,15 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) | |||
413 | 413 | ||
414 | pnotify = (struct file_notify_information *) | 414 | pnotify = (struct file_notify_information *) |
415 | ((char *)&pSMBr->hdr.Protocol + data_offset); | 415 | ((char *)&pSMBr->hdr.Protocol + data_offset); |
416 | cFYI(1, "dnotify on %s Action: 0x%x", | 416 | cifs_dbg(FYI, "dnotify on %s Action: 0x%x\n", |
417 | pnotify->FileName, pnotify->Action); | 417 | pnotify->FileName, pnotify->Action); |
418 | /* cifs_dump_mem("Rcvd notify Data: ",buf, | 418 | /* cifs_dump_mem("Rcvd notify Data: ",buf, |
419 | sizeof(struct smb_hdr)+60); */ | 419 | sizeof(struct smb_hdr)+60); */ |
420 | return true; | 420 | return true; |
421 | } | 421 | } |
422 | if (pSMBr->hdr.Status.CifsError) { | 422 | if (pSMBr->hdr.Status.CifsError) { |
423 | cFYI(1, "notify err 0x%d", | 423 | cifs_dbg(FYI, "notify err 0x%d\n", |
424 | pSMBr->hdr.Status.CifsError); | 424 | pSMBr->hdr.Status.CifsError); |
425 | return true; | 425 | return true; |
426 | } | 426 | } |
427 | return false; | 427 | return false; |
@@ -435,7 +435,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) | |||
435 | large dirty files cached on the client */ | 435 | large dirty files cached on the client */ |
436 | if ((NT_STATUS_INVALID_HANDLE) == | 436 | if ((NT_STATUS_INVALID_HANDLE) == |
437 | le32_to_cpu(pSMB->hdr.Status.CifsError)) { | 437 | le32_to_cpu(pSMB->hdr.Status.CifsError)) { |
438 | cFYI(1, "invalid handle on oplock break"); | 438 | cifs_dbg(FYI, "invalid handle on oplock break\n"); |
439 | return true; | 439 | return true; |
440 | } else if (ERRbadfid == | 440 | } else if (ERRbadfid == |
441 | le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { | 441 | le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { |
@@ -447,7 +447,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) | |||
447 | if (pSMB->hdr.WordCount != 8) | 447 | if (pSMB->hdr.WordCount != 8) |
448 | return false; | 448 | return false; |
449 | 449 | ||
450 | cFYI(1, "oplock type 0x%d level 0x%d", | 450 | cifs_dbg(FYI, "oplock type 0x%d level 0x%d\n", |
451 | pSMB->LockType, pSMB->OplockLevel); | 451 | pSMB->LockType, pSMB->OplockLevel); |
452 | if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) | 452 | if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) |
453 | return false; | 453 | return false; |
@@ -469,7 +469,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) | |||
469 | if (pSMB->Fid != netfile->fid.netfid) | 469 | if (pSMB->Fid != netfile->fid.netfid) |
470 | continue; | 470 | continue; |
471 | 471 | ||
472 | cFYI(1, "file id match, oplock break"); | 472 | cifs_dbg(FYI, "file id match, oplock break\n"); |
473 | pCifsInode = CIFS_I(netfile->dentry->d_inode); | 473 | pCifsInode = CIFS_I(netfile->dentry->d_inode); |
474 | 474 | ||
475 | cifs_set_oplock_level(pCifsInode, | 475 | cifs_set_oplock_level(pCifsInode, |
@@ -484,12 +484,12 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) | |||
484 | } | 484 | } |
485 | spin_unlock(&cifs_file_list_lock); | 485 | spin_unlock(&cifs_file_list_lock); |
486 | spin_unlock(&cifs_tcp_ses_lock); | 486 | spin_unlock(&cifs_tcp_ses_lock); |
487 | cFYI(1, "No matching file for oplock break"); | 487 | cifs_dbg(FYI, "No matching file for oplock break\n"); |
488 | return true; | 488 | return true; |
489 | } | 489 | } |
490 | } | 490 | } |
491 | spin_unlock(&cifs_tcp_ses_lock); | 491 | spin_unlock(&cifs_tcp_ses_lock); |
492 | cFYI(1, "Can not process oplock break for non-existent connection"); | 492 | cifs_dbg(FYI, "Can not process oplock break for non-existent connection\n"); |
493 | return true; | 493 | return true; |
494 | } | 494 | } |
495 | 495 | ||
@@ -536,12 +536,8 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb) | |||
536 | { | 536 | { |
537 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | 537 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { |
538 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; | 538 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; |
539 | cERROR(1, "Autodisabling the use of server inode numbers on " | 539 | cifs_dbg(VFS, "Autodisabling the use of server inode numbers on %s. This server doesn't seem to support them properly. Hardlinks will not be recognized on this mount. Consider mounting with the \"noserverino\" option to silence this message.\n", |
540 | "%s. This server doesn't seem to support them " | 540 | cifs_sb_master_tcon(cifs_sb)->treeName); |
541 | "properly. Hardlinks will not be recognized on this " | ||
542 | "mount. Consider mounting with the \"noserverino\" " | ||
543 | "option to silence this message.", | ||
544 | cifs_sb_master_tcon(cifs_sb)->treeName); | ||
545 | } | 541 | } |
546 | } | 542 | } |
547 | 543 | ||
@@ -552,13 +548,13 @@ void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock) | |||
552 | if (oplock == OPLOCK_EXCLUSIVE) { | 548 | if (oplock == OPLOCK_EXCLUSIVE) { |
553 | cinode->clientCanCacheAll = true; | 549 | cinode->clientCanCacheAll = true; |
554 | cinode->clientCanCacheRead = true; | 550 | cinode->clientCanCacheRead = true; |
555 | cFYI(1, "Exclusive Oplock granted on inode %p", | 551 | cifs_dbg(FYI, "Exclusive Oplock granted on inode %p\n", |
556 | &cinode->vfs_inode); | 552 | &cinode->vfs_inode); |
557 | } else if (oplock == OPLOCK_READ) { | 553 | } else if (oplock == OPLOCK_READ) { |
558 | cinode->clientCanCacheAll = false; | 554 | cinode->clientCanCacheAll = false; |
559 | cinode->clientCanCacheRead = true; | 555 | cinode->clientCanCacheRead = true; |
560 | cFYI(1, "Level II Oplock granted on inode %p", | 556 | cifs_dbg(FYI, "Level II Oplock granted on inode %p\n", |
561 | &cinode->vfs_inode); | 557 | &cinode->vfs_inode); |
562 | } else { | 558 | } else { |
563 | cinode->clientCanCacheAll = false; | 559 | cinode->clientCanCacheAll = false; |
564 | cinode->clientCanCacheRead = false; | 560 | cinode->clientCanCacheRead = false; |