aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.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/file.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/file.c')
-rw-r--r--fs/cifs/file.c166
1 files changed, 81 insertions, 85 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 2d4a231dd70b..48b29d24c9f4 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -78,9 +78,8 @@ static u32 cifs_posix_convert_flags(unsigned int flags)
78 if (flags & O_EXCL) 78 if (flags & O_EXCL)
79 posix_flags |= SMB_O_EXCL; 79 posix_flags |= SMB_O_EXCL;
80 } else if (flags & O_EXCL) 80 } else if (flags & O_EXCL)
81 cFYI(1, "Application %s pid %d has incorrectly set O_EXCL flag" 81 cifs_dbg(FYI, "Application %s pid %d has incorrectly set O_EXCL flag but not O_CREAT on file open. Ignoring O_EXCL\n",
82 "but not O_CREAT on file open. Ignoring O_EXCL", 82 current->comm, current->tgid);
83 current->comm, current->tgid);
84 83
85 if (flags & O_TRUNC) 84 if (flags & O_TRUNC)
86 posix_flags |= SMB_O_TRUNC; 85 posix_flags |= SMB_O_TRUNC;
@@ -123,7 +122,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
123 struct tcon_link *tlink; 122 struct tcon_link *tlink;
124 struct cifs_tcon *tcon; 123 struct cifs_tcon *tcon;
125 124
126 cFYI(1, "posix open %s", full_path); 125 cifs_dbg(FYI, "posix open %s\n", full_path);
127 126
128 presp_data = kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL); 127 presp_data = kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL);
129 if (presp_data == NULL) 128 if (presp_data == NULL)
@@ -308,7 +307,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
308 */ 307 */
309 if (oplock == server->vals->oplock_read && 308 if (oplock == server->vals->oplock_read &&
310 cifs_has_mand_locks(cinode)) { 309 cifs_has_mand_locks(cinode)) {
311 cFYI(1, "Reset oplock val from read to None due to mand locks"); 310 cifs_dbg(FYI, "Reset oplock val from read to None due to mand locks\n");
312 oplock = 0; 311 oplock = 0;
313 } 312 }
314 313
@@ -374,8 +373,8 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
374 list_del(&cifs_file->tlist); 373 list_del(&cifs_file->tlist);
375 374
376 if (list_empty(&cifsi->openFileList)) { 375 if (list_empty(&cifsi->openFileList)) {
377 cFYI(1, "closing last open instance for inode %p", 376 cifs_dbg(FYI, "closing last open instance for inode %p\n",
378 cifs_file->dentry->d_inode); 377 cifs_file->dentry->d_inode);
379 /* 378 /*
380 * In strict cache mode we need invalidate mapping on the last 379 * In strict cache mode we need invalidate mapping on the last
381 * close because it may cause a error when we open this file 380 * close because it may cause a error when we open this file
@@ -454,7 +453,7 @@ int cifs_open(struct inode *inode, struct file *file)
454 goto out; 453 goto out;
455 } 454 }
456 455
457 cFYI(1, "inode = 0x%p file flags are 0x%x for %s", 456 cifs_dbg(FYI, "inode = 0x%p file flags are 0x%x for %s\n",
458 inode, file->f_flags, full_path); 457 inode, file->f_flags, full_path);
459 458
460 if (server->oplocks) 459 if (server->oplocks)
@@ -470,16 +469,13 @@ int cifs_open(struct inode *inode, struct file *file)
470 cifs_sb->mnt_file_mode /* ignored */, 469 cifs_sb->mnt_file_mode /* ignored */,
471 file->f_flags, &oplock, &fid.netfid, xid); 470 file->f_flags, &oplock, &fid.netfid, xid);
472 if (rc == 0) { 471 if (rc == 0) {
473 cFYI(1, "posix open succeeded"); 472 cifs_dbg(FYI, "posix open succeeded\n");
474 posix_open_ok = true; 473 posix_open_ok = true;
475 } else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { 474 } else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
476 if (tcon->ses->serverNOS) 475 if (tcon->ses->serverNOS)
477 cERROR(1, "server %s of type %s returned" 476 cifs_dbg(VFS, "server %s of type %s returned unexpected error on SMB posix open, disabling posix open support. Check if server update available.\n",
478 " unexpected error on SMB posix open" 477 tcon->ses->serverName,
479 ", disabling posix open support." 478 tcon->ses->serverNOS);
480 " Check if server update available.",
481 tcon->ses->serverName,
482 tcon->ses->serverNOS);
483 tcon->broken_posix_open = true; 479 tcon->broken_posix_open = true;
484 } else if ((rc != -EIO) && (rc != -EREMOTE) && 480 } else if ((rc != -EIO) && (rc != -EREMOTE) &&
485 (rc != -EOPNOTSUPP)) /* path not found or net err */ 481 (rc != -EOPNOTSUPP)) /* path not found or net err */
@@ -621,8 +617,8 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
621 return rc; 617 return rc;
622 } 618 }
623 619
624 cFYI(1, "inode = 0x%p file flags 0x%x for %s", inode, cfile->f_flags, 620 cifs_dbg(FYI, "inode = 0x%p file flags 0x%x for %s\n",
625 full_path); 621 inode, cfile->f_flags, full_path);
626 622
627 if (tcon->ses->server->oplocks) 623 if (tcon->ses->server->oplocks)
628 oplock = REQ_OPLOCK; 624 oplock = REQ_OPLOCK;
@@ -643,7 +639,7 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
643 cifs_sb->mnt_file_mode /* ignored */, 639 cifs_sb->mnt_file_mode /* ignored */,
644 oflags, &oplock, &fid.netfid, xid); 640 oflags, &oplock, &fid.netfid, xid);
645 if (rc == 0) { 641 if (rc == 0) {
646 cFYI(1, "posix reopen succeeded"); 642 cifs_dbg(FYI, "posix reopen succeeded\n");
647 goto reopen_success; 643 goto reopen_success;
648 } 644 }
649 /* 645 /*
@@ -672,8 +668,8 @@ cifs_reopen_file(struct cifsFileInfo *cfile, bool can_flush)
672 NULL, cifs_sb); 668 NULL, cifs_sb);
673 if (rc) { 669 if (rc) {
674 mutex_unlock(&cfile->fh_mutex); 670 mutex_unlock(&cfile->fh_mutex);
675 cFYI(1, "cifs_reopen returned 0x%x", rc); 671 cifs_dbg(FYI, "cifs_reopen returned 0x%x\n", rc);
676 cFYI(1, "oplock: %d", oplock); 672 cifs_dbg(FYI, "oplock: %d\n", oplock);
677 goto reopen_error_exit; 673 goto reopen_error_exit;
678 } 674 }
679 675
@@ -729,7 +725,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
729 struct TCP_Server_Info *server; 725 struct TCP_Server_Info *server;
730 char *buf; 726 char *buf;
731 727
732 cFYI(1, "Closedir inode = 0x%p", inode); 728 cifs_dbg(FYI, "Closedir inode = 0x%p\n", inode);
733 729
734 if (cfile == NULL) 730 if (cfile == NULL)
735 return rc; 731 return rc;
@@ -738,7 +734,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
738 tcon = tlink_tcon(cfile->tlink); 734 tcon = tlink_tcon(cfile->tlink);
739 server = tcon->ses->server; 735 server = tcon->ses->server;
740 736
741 cFYI(1, "Freeing private data in close dir"); 737 cifs_dbg(FYI, "Freeing private data in close dir\n");
742 spin_lock(&cifs_file_list_lock); 738 spin_lock(&cifs_file_list_lock);
743 if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) { 739 if (!cfile->srch_inf.endOfSearch && !cfile->invalidHandle) {
744 cfile->invalidHandle = true; 740 cfile->invalidHandle = true;
@@ -747,7 +743,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
747 rc = server->ops->close_dir(xid, tcon, &cfile->fid); 743 rc = server->ops->close_dir(xid, tcon, &cfile->fid);
748 else 744 else
749 rc = -ENOSYS; 745 rc = -ENOSYS;
750 cFYI(1, "Closing uncompleted readdir with rc %d", rc); 746 cifs_dbg(FYI, "Closing uncompleted readdir with rc %d\n", rc);
751 /* not much we can do if it fails anyway, ignore rc */ 747 /* not much we can do if it fails anyway, ignore rc */
752 rc = 0; 748 rc = 0;
753 } else 749 } else
@@ -755,7 +751,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
755 751
756 buf = cfile->srch_inf.ntwrk_buf_start; 752 buf = cfile->srch_inf.ntwrk_buf_start;
757 if (buf) { 753 if (buf) {
758 cFYI(1, "closedir free smb buf in srch struct"); 754 cifs_dbg(FYI, "closedir free smb buf in srch struct\n");
759 cfile->srch_inf.ntwrk_buf_start = NULL; 755 cfile->srch_inf.ntwrk_buf_start = NULL;
760 if (cfile->srch_inf.smallBuf) 756 if (cfile->srch_inf.smallBuf)
761 cifs_small_buf_release(buf); 757 cifs_small_buf_release(buf);
@@ -1140,7 +1136,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
1140 * The list ended. We don't have enough allocated 1136 * The list ended. We don't have enough allocated
1141 * structures - something is really wrong. 1137 * structures - something is really wrong.
1142 */ 1138 */
1143 cERROR(1, "Can't push all brlocks!"); 1139 cifs_dbg(VFS, "Can't push all brlocks!\n");
1144 break; 1140 break;
1145 } 1141 }
1146 length = 1 + flock->fl_end - flock->fl_start; 1142 length = 1 + flock->fl_end - flock->fl_start;
@@ -1213,47 +1209,46 @@ cifs_read_flock(struct file_lock *flock, __u32 *type, int *lock, int *unlock,
1213 bool *wait_flag, struct TCP_Server_Info *server) 1209 bool *wait_flag, struct TCP_Server_Info *server)
1214{ 1210{
1215 if (flock->fl_flags & FL_POSIX) 1211 if (flock->fl_flags & FL_POSIX)
1216 cFYI(1, "Posix"); 1212 cifs_dbg(FYI, "Posix\n");
1217 if (flock->fl_flags & FL_FLOCK) 1213 if (flock->fl_flags & FL_FLOCK)
1218 cFYI(1, "Flock"); 1214 cifs_dbg(FYI, "Flock\n");
1219 if (flock->fl_flags & FL_SLEEP) { 1215 if (flock->fl_flags & FL_SLEEP) {
1220 cFYI(1, "Blocking lock"); 1216 cifs_dbg(FYI, "Blocking lock\n");
1221 *wait_flag = true; 1217 *wait_flag = true;
1222 } 1218 }
1223 if (flock->fl_flags & FL_ACCESS) 1219 if (flock->fl_flags & FL_ACCESS)
1224 cFYI(1, "Process suspended by mandatory locking - " 1220 cifs_dbg(FYI, "Process suspended by mandatory locking - not implemented yet\n");
1225 "not implemented yet");
1226 if (flock->fl_flags & FL_LEASE) 1221 if (flock->fl_flags & FL_LEASE)
1227 cFYI(1, "Lease on file - not implemented yet"); 1222 cifs_dbg(FYI, "Lease on file - not implemented yet\n");
1228 if (flock->fl_flags & 1223 if (flock->fl_flags &
1229 (~(FL_POSIX | FL_FLOCK | FL_SLEEP | 1224 (~(FL_POSIX | FL_FLOCK | FL_SLEEP |
1230 FL_ACCESS | FL_LEASE | FL_CLOSE))) 1225 FL_ACCESS | FL_LEASE | FL_CLOSE)))
1231 cFYI(1, "Unknown lock flags 0x%x", flock->fl_flags); 1226 cifs_dbg(FYI, "Unknown lock flags 0x%x\n", flock->fl_flags);
1232 1227
1233 *type = server->vals->large_lock_type; 1228 *type = server->vals->large_lock_type;
1234 if (flock->fl_type == F_WRLCK) { 1229 if (flock->fl_type == F_WRLCK) {
1235 cFYI(1, "F_WRLCK "); 1230 cifs_dbg(FYI, "F_WRLCK\n");
1236 *type |= server->vals->exclusive_lock_type; 1231 *type |= server->vals->exclusive_lock_type;
1237 *lock = 1; 1232 *lock = 1;
1238 } else if (flock->fl_type == F_UNLCK) { 1233 } else if (flock->fl_type == F_UNLCK) {
1239 cFYI(1, "F_UNLCK"); 1234 cifs_dbg(FYI, "F_UNLCK\n");
1240 *type |= server->vals->unlock_lock_type; 1235 *type |= server->vals->unlock_lock_type;
1241 *unlock = 1; 1236 *unlock = 1;
1242 /* Check if unlock includes more than one lock range */ 1237 /* Check if unlock includes more than one lock range */
1243 } else if (flock->fl_type == F_RDLCK) { 1238 } else if (flock->fl_type == F_RDLCK) {
1244 cFYI(1, "F_RDLCK"); 1239 cifs_dbg(FYI, "F_RDLCK\n");
1245 *type |= server->vals->shared_lock_type; 1240 *type |= server->vals->shared_lock_type;
1246 *lock = 1; 1241 *lock = 1;
1247 } else if (flock->fl_type == F_EXLCK) { 1242 } else if (flock->fl_type == F_EXLCK) {
1248 cFYI(1, "F_EXLCK"); 1243 cifs_dbg(FYI, "F_EXLCK\n");
1249 *type |= server->vals->exclusive_lock_type; 1244 *type |= server->vals->exclusive_lock_type;
1250 *lock = 1; 1245 *lock = 1;
1251 } else if (flock->fl_type == F_SHLCK) { 1246 } else if (flock->fl_type == F_SHLCK) {
1252 cFYI(1, "F_SHLCK"); 1247 cifs_dbg(FYI, "F_SHLCK\n");
1253 *type |= server->vals->shared_lock_type; 1248 *type |= server->vals->shared_lock_type;
1254 *lock = 1; 1249 *lock = 1;
1255 } else 1250 } else
1256 cFYI(1, "Unknown type of lock"); 1251 cifs_dbg(FYI, "Unknown type of lock\n");
1257} 1252}
1258 1253
1259static int 1254static int
@@ -1296,8 +1291,8 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
1296 type, 0, 1, false); 1291 type, 0, 1, false);
1297 flock->fl_type = F_UNLCK; 1292 flock->fl_type = F_UNLCK;
1298 if (rc != 0) 1293 if (rc != 0)
1299 cERROR(1, "Error unlocking previously locked " 1294 cifs_dbg(VFS, "Error unlocking previously locked range %d during test of lock\n",
1300 "range %d during test of lock", rc); 1295 rc);
1301 return 0; 1296 return 0;
1302 } 1297 }
1303 1298
@@ -1316,8 +1311,8 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
1316 type | server->vals->shared_lock_type, 0, 1, false); 1311 type | server->vals->shared_lock_type, 0, 1, false);
1317 flock->fl_type = F_RDLCK; 1312 flock->fl_type = F_RDLCK;
1318 if (rc != 0) 1313 if (rc != 0)
1319 cERROR(1, "Error unlocking previously locked " 1314 cifs_dbg(VFS, "Error unlocking previously locked range %d during test of lock\n",
1320 "range %d during test of lock", rc); 1315 rc);
1321 } else 1316 } else
1322 flock->fl_type = F_WRLCK; 1317 flock->fl_type = F_WRLCK;
1323 1318
@@ -1508,8 +1503,8 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type,
1508 if (!CIFS_I(inode)->clientCanCacheAll && 1503 if (!CIFS_I(inode)->clientCanCacheAll &&
1509 CIFS_I(inode)->clientCanCacheRead) { 1504 CIFS_I(inode)->clientCanCacheRead) {
1510 cifs_invalidate_mapping(inode); 1505 cifs_invalidate_mapping(inode);
1511 cFYI(1, "Set no oplock for inode=%p due to mand locks", 1506 cifs_dbg(FYI, "Set no oplock for inode=%p due to mand locks\n",
1512 inode); 1507 inode);
1513 CIFS_I(inode)->clientCanCacheRead = false; 1508 CIFS_I(inode)->clientCanCacheRead = false;
1514 } 1509 }
1515 1510
@@ -1546,9 +1541,9 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *flock)
1546 rc = -EACCES; 1541 rc = -EACCES;
1547 xid = get_xid(); 1542 xid = get_xid();
1548 1543
1549 cFYI(1, "Lock parm: 0x%x flockflags: 0x%x flocktype: 0x%x start: %lld " 1544 cifs_dbg(FYI, "Lock parm: 0x%x flockflags: 0x%x flocktype: 0x%x start: %lld end: %lld\n",
1550 "end: %lld", cmd, flock->fl_flags, flock->fl_type, 1545 cmd, flock->fl_flags, flock->fl_type,
1551 flock->fl_start, flock->fl_end); 1546 flock->fl_start, flock->fl_end);
1552 1547
1553 cfile = (struct cifsFileInfo *)file->private_data; 1548 cfile = (struct cifsFileInfo *)file->private_data;
1554 tcon = tlink_tcon(cfile->tlink); 1549 tcon = tlink_tcon(cfile->tlink);
@@ -1620,8 +1615,8 @@ cifs_write(struct cifsFileInfo *open_file, __u32 pid, const char *write_data,
1620 1615
1621 cifs_sb = CIFS_SB(dentry->d_sb); 1616 cifs_sb = CIFS_SB(dentry->d_sb);
1622 1617
1623 cFYI(1, "write %zd bytes to offset %lld of %s", write_size, 1618 cifs_dbg(FYI, "write %zd bytes to offset %lld of %s\n",
1624 *offset, dentry->d_name.name); 1619 write_size, *offset, dentry->d_name.name);
1625 1620
1626 tcon = tlink_tcon(open_file->tlink); 1621 tcon = tlink_tcon(open_file->tlink);
1627 server = tcon->ses->server; 1622 server = tcon->ses->server;
@@ -1736,7 +1731,7 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode,
1736 it being zero) during stress testcases so we need to check for it */ 1731 it being zero) during stress testcases so we need to check for it */
1737 1732
1738 if (cifs_inode == NULL) { 1733 if (cifs_inode == NULL) {
1739 cERROR(1, "Null inode passed to cifs_writeable_file"); 1734 cifs_dbg(VFS, "Null inode passed to cifs_writeable_file\n");
1740 dump_stack(); 1735 dump_stack();
1741 return NULL; 1736 return NULL;
1742 } 1737 }
@@ -1848,7 +1843,7 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
1848 else if (bytes_written < 0) 1843 else if (bytes_written < 0)
1849 rc = bytes_written; 1844 rc = bytes_written;
1850 } else { 1845 } else {
1851 cFYI(1, "No writeable filehandles for inode"); 1846 cifs_dbg(FYI, "No writeable filehandles for inode\n");
1852 rc = -EIO; 1847 rc = -EIO;
1853 } 1848 }
1854 1849
@@ -2015,7 +2010,7 @@ retry:
2015 wdata->cfile = find_writable_file(CIFS_I(mapping->host), 2010 wdata->cfile = find_writable_file(CIFS_I(mapping->host),
2016 false); 2011 false);
2017 if (!wdata->cfile) { 2012 if (!wdata->cfile) {
2018 cERROR(1, "No writable handles for inode"); 2013 cifs_dbg(VFS, "No writable handles for inode\n");
2019 rc = -EBADF; 2014 rc = -EBADF;
2020 break; 2015 break;
2021 } 2016 }
@@ -2076,7 +2071,7 @@ cifs_writepage_locked(struct page *page, struct writeback_control *wbc)
2076/* BB add check for wbc flags */ 2071/* BB add check for wbc flags */
2077 page_cache_get(page); 2072 page_cache_get(page);
2078 if (!PageUptodate(page)) 2073 if (!PageUptodate(page))
2079 cFYI(1, "ppw - page not up to date"); 2074 cifs_dbg(FYI, "ppw - page not up to date\n");
2080 2075
2081 /* 2076 /*
2082 * Set the "writeback" flag, and clear "dirty" in the radix tree. 2077 * Set the "writeback" flag, and clear "dirty" in the radix tree.
@@ -2127,7 +2122,7 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
2127 else 2122 else
2128 pid = current->tgid; 2123 pid = current->tgid;
2129 2124
2130 cFYI(1, "write_end for page %p from pos %lld with %d bytes", 2125 cifs_dbg(FYI, "write_end for page %p from pos %lld with %d bytes\n",
2131 page, pos, copied); 2126 page, pos, copied);
2132 2127
2133 if (PageChecked(page)) { 2128 if (PageChecked(page)) {
@@ -2191,13 +2186,13 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end,
2191 2186
2192 xid = get_xid(); 2187 xid = get_xid();
2193 2188
2194 cFYI(1, "Sync file - name: %s datasync: 0x%x", 2189 cifs_dbg(FYI, "Sync file - name: %s datasync: 0x%x\n",
2195 file->f_path.dentry->d_name.name, datasync); 2190 file->f_path.dentry->d_name.name, datasync);
2196 2191
2197 if (!CIFS_I(inode)->clientCanCacheRead) { 2192 if (!CIFS_I(inode)->clientCanCacheRead) {
2198 rc = cifs_invalidate_mapping(inode); 2193 rc = cifs_invalidate_mapping(inode);
2199 if (rc) { 2194 if (rc) {
2200 cFYI(1, "rc: %d during invalidate phase", rc); 2195 cifs_dbg(FYI, "rc: %d during invalidate phase\n", rc);
2201 rc = 0; /* don't care about it in fsync */ 2196 rc = 0; /* don't care about it in fsync */
2202 } 2197 }
2203 } 2198 }
@@ -2233,8 +2228,8 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
2233 2228
2234 xid = get_xid(); 2229 xid = get_xid();
2235 2230
2236 cFYI(1, "Sync file - name: %s datasync: 0x%x", 2231 cifs_dbg(FYI, "Sync file - name: %s datasync: 0x%x\n",
2237 file->f_path.dentry->d_name.name, datasync); 2232 file->f_path.dentry->d_name.name, datasync);
2238 2233
2239 tcon = tlink_tcon(smbfile->tlink); 2234 tcon = tlink_tcon(smbfile->tlink);
2240 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) { 2235 if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOSSYNC)) {
@@ -2262,7 +2257,7 @@ int cifs_flush(struct file *file, fl_owner_t id)
2262 if (file->f_mode & FMODE_WRITE) 2257 if (file->f_mode & FMODE_WRITE)
2263 rc = filemap_write_and_wait(inode->i_mapping); 2258 rc = filemap_write_and_wait(inode->i_mapping);
2264 2259
2265 cFYI(1, "Flush inode %p file %p rc %d", inode, file, rc); 2260 cifs_dbg(FYI, "Flush inode %p file %p rc %d\n", inode, file, rc);
2266 2261
2267 return rc; 2262 return rc;
2268} 2263}
@@ -2579,8 +2574,8 @@ cifs_strict_writev(struct kiocb *iocb, const struct iovec *iov,
2579 * an old data. 2574 * an old data.
2580 */ 2575 */
2581 cifs_invalidate_mapping(inode); 2576 cifs_invalidate_mapping(inode);
2582 cFYI(1, "Set no oplock for inode=%p after a write operation", 2577 cifs_dbg(FYI, "Set no oplock for inode=%p after a write operation\n",
2583 inode); 2578 inode);
2584 cinode->clientCanCacheRead = false; 2579 cinode->clientCanCacheRead = false;
2585 } 2580 }
2586 return written; 2581 return written;
@@ -2756,15 +2751,15 @@ cifs_uncached_read_into_pages(struct TCP_Server_Info *server,
2756 /* enough data to fill the page */ 2751 /* enough data to fill the page */
2757 iov.iov_base = kmap(page); 2752 iov.iov_base = kmap(page);
2758 iov.iov_len = PAGE_SIZE; 2753 iov.iov_len = PAGE_SIZE;
2759 cFYI(1, "%u: iov_base=%p iov_len=%zu", 2754 cifs_dbg(FYI, "%u: iov_base=%p iov_len=%zu\n",
2760 i, iov.iov_base, iov.iov_len); 2755 i, iov.iov_base, iov.iov_len);
2761 len -= PAGE_SIZE; 2756 len -= PAGE_SIZE;
2762 } else if (len > 0) { 2757 } else if (len > 0) {
2763 /* enough for partial page, fill and zero the rest */ 2758 /* enough for partial page, fill and zero the rest */
2764 iov.iov_base = kmap(page); 2759 iov.iov_base = kmap(page);
2765 iov.iov_len = len; 2760 iov.iov_len = len;
2766 cFYI(1, "%u: iov_base=%p iov_len=%zu", 2761 cifs_dbg(FYI, "%u: iov_base=%p iov_len=%zu\n",
2767 i, iov.iov_base, iov.iov_len); 2762 i, iov.iov_base, iov.iov_len);
2768 memset(iov.iov_base + len, '\0', PAGE_SIZE - len); 2763 memset(iov.iov_base + len, '\0', PAGE_SIZE - len);
2769 rdata->tailsz = len; 2764 rdata->tailsz = len;
2770 len = 0; 2765 len = 0;
@@ -2824,7 +2819,7 @@ cifs_iovec_read(struct file *file, const struct iovec *iov,
2824 pid = current->tgid; 2819 pid = current->tgid;
2825 2820
2826 if ((file->f_flags & O_ACCMODE) == O_WRONLY) 2821 if ((file->f_flags & O_ACCMODE) == O_WRONLY)
2827 cFYI(1, "attempting read on write only file instance"); 2822 cifs_dbg(FYI, "attempting read on write only file instance\n");
2828 2823
2829 do { 2824 do {
2830 cur_len = min_t(const size_t, len - total_read, cifs_sb->rsize); 2825 cur_len = min_t(const size_t, len - total_read, cifs_sb->rsize);
@@ -3003,7 +2998,7 @@ cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset)
3003 pid = current->tgid; 2998 pid = current->tgid;
3004 2999
3005 if ((file->f_flags & O_ACCMODE) == O_WRONLY) 3000 if ((file->f_flags & O_ACCMODE) == O_WRONLY)
3006 cFYI(1, "attempting read on write only file instance"); 3001 cifs_dbg(FYI, "attempting read on write only file instance\n");
3007 3002
3008 for (total_read = 0, cur_offset = read_data; read_size > total_read; 3003 for (total_read = 0, cur_offset = read_data; read_size > total_read;
3009 total_read += bytes_read, cur_offset += bytes_read) { 3004 total_read += bytes_read, cur_offset += bytes_read) {
@@ -3094,7 +3089,8 @@ int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
3094 xid = get_xid(); 3089 xid = get_xid();
3095 rc = cifs_revalidate_file(file); 3090 rc = cifs_revalidate_file(file);
3096 if (rc) { 3091 if (rc) {
3097 cFYI(1, "Validation prior to mmap failed, error=%d", rc); 3092 cifs_dbg(FYI, "Validation prior to mmap failed, error=%d\n",
3093 rc);
3098 free_xid(xid); 3094 free_xid(xid);
3099 return rc; 3095 return rc;
3100 } 3096 }
@@ -3147,7 +3143,7 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
3147 /* determine the eof that the server (probably) has */ 3143 /* determine the eof that the server (probably) has */
3148 eof = CIFS_I(rdata->mapping->host)->server_eof; 3144 eof = CIFS_I(rdata->mapping->host)->server_eof;
3149 eof_index = eof ? (eof - 1) >> PAGE_CACHE_SHIFT : 0; 3145 eof_index = eof ? (eof - 1) >> PAGE_CACHE_SHIFT : 0;
3150 cFYI(1, "eof=%llu eof_index=%lu", eof, eof_index); 3146 cifs_dbg(FYI, "eof=%llu eof_index=%lu\n", eof, eof_index);
3151 3147
3152 rdata->tailsz = PAGE_CACHE_SIZE; 3148 rdata->tailsz = PAGE_CACHE_SIZE;
3153 for (i = 0; i < nr_pages; i++) { 3149 for (i = 0; i < nr_pages; i++) {
@@ -3157,15 +3153,15 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
3157 /* enough data to fill the page */ 3153 /* enough data to fill the page */
3158 iov.iov_base = kmap(page); 3154 iov.iov_base = kmap(page);
3159 iov.iov_len = PAGE_CACHE_SIZE; 3155 iov.iov_len = PAGE_CACHE_SIZE;
3160 cFYI(1, "%u: idx=%lu iov_base=%p iov_len=%zu", 3156 cifs_dbg(FYI, "%u: idx=%lu iov_base=%p iov_len=%zu\n",
3161 i, page->index, iov.iov_base, iov.iov_len); 3157 i, page->index, iov.iov_base, iov.iov_len);
3162 len -= PAGE_CACHE_SIZE; 3158 len -= PAGE_CACHE_SIZE;
3163 } else if (len > 0) { 3159 } else if (len > 0) {
3164 /* enough for partial page, fill and zero the rest */ 3160 /* enough for partial page, fill and zero the rest */
3165 iov.iov_base = kmap(page); 3161 iov.iov_base = kmap(page);
3166 iov.iov_len = len; 3162 iov.iov_len = len;
3167 cFYI(1, "%u: idx=%lu iov_base=%p iov_len=%zu", 3163 cifs_dbg(FYI, "%u: idx=%lu iov_base=%p iov_len=%zu\n",
3168 i, page->index, iov.iov_base, iov.iov_len); 3164 i, page->index, iov.iov_base, iov.iov_len);
3169 memset(iov.iov_base + len, 3165 memset(iov.iov_base + len,
3170 '\0', PAGE_CACHE_SIZE - len); 3166 '\0', PAGE_CACHE_SIZE - len);
3171 rdata->tailsz = len; 3167 rdata->tailsz = len;
@@ -3245,8 +3241,8 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
3245 rc = 0; 3241 rc = 0;
3246 INIT_LIST_HEAD(&tmplist); 3242 INIT_LIST_HEAD(&tmplist);
3247 3243
3248 cFYI(1, "%s: file=%p mapping=%p num_pages=%u", __func__, file, 3244 cifs_dbg(FYI, "%s: file=%p mapping=%p num_pages=%u\n",
3249 mapping, num_pages); 3245 __func__, file, mapping, num_pages);
3250 3246
3251 /* 3247 /*
3252 * Start with the page at end of list and move it to private 3248 * Start with the page at end of list and move it to private
@@ -3376,7 +3372,7 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
3376 if (rc < 0) 3372 if (rc < 0)
3377 goto io_error; 3373 goto io_error;
3378 else 3374 else
3379 cFYI(1, "Bytes read %d", rc); 3375 cifs_dbg(FYI, "Bytes read %d\n", rc);
3380 3376
3381 file_inode(file)->i_atime = 3377 file_inode(file)->i_atime =
3382 current_fs_time(file_inode(file)->i_sb); 3378 current_fs_time(file_inode(file)->i_sb);
@@ -3414,7 +3410,7 @@ static int cifs_readpage(struct file *file, struct page *page)
3414 return rc; 3410 return rc;
3415 } 3411 }
3416 3412
3417 cFYI(1, "readpage %p at offset %d 0x%x", 3413 cifs_dbg(FYI, "readpage %p at offset %d 0x%x\n",
3418 page, (int)offset, (int)offset); 3414 page, (int)offset, (int)offset);
3419 3415
3420 rc = cifs_readpage_worker(file, page, &offset); 3416 rc = cifs_readpage_worker(file, page, &offset);
@@ -3481,7 +3477,7 @@ static int cifs_write_begin(struct file *file, struct address_space *mapping,
3481 struct page *page; 3477 struct page *page;
3482 int rc = 0; 3478 int rc = 0;
3483 3479
3484 cFYI(1, "write_begin from %lld len %d", (long long)pos, len); 3480 cifs_dbg(FYI, "write_begin from %lld len %d\n", (long long)pos, len);
3485 3481
3486 page = grab_cache_page_write_begin(mapping, index, flags); 3482 page = grab_cache_page_write_begin(mapping, index, flags);
3487 if (!page) { 3483 if (!page) {
@@ -3570,7 +3566,7 @@ static int cifs_launder_page(struct page *page)
3570 .range_end = range_end, 3566 .range_end = range_end,
3571 }; 3567 };
3572 3568
3573 cFYI(1, "Launder page: %p", page); 3569 cifs_dbg(FYI, "Launder page: %p\n", page);
3574 3570
3575 if (clear_page_dirty_for_io(page)) 3571 if (clear_page_dirty_for_io(page))
3576 rc = cifs_writepage_locked(page, &wbc); 3572 rc = cifs_writepage_locked(page, &wbc);
@@ -3590,8 +3586,8 @@ void cifs_oplock_break(struct work_struct *work)
3590 3586
3591 if (!cinode->clientCanCacheAll && cinode->clientCanCacheRead && 3587 if (!cinode->clientCanCacheAll && cinode->clientCanCacheRead &&
3592 cifs_has_mand_locks(cinode)) { 3588 cifs_has_mand_locks(cinode)) {
3593 cFYI(1, "Reset oplock to None for inode=%p due to mand locks", 3589 cifs_dbg(FYI, "Reset oplock to None for inode=%p due to mand locks\n",
3594 inode); 3590 inode);
3595 cinode->clientCanCacheRead = false; 3591 cinode->clientCanCacheRead = false;
3596 } 3592 }
3597 3593
@@ -3606,12 +3602,12 @@ void cifs_oplock_break(struct work_struct *work)
3606 mapping_set_error(inode->i_mapping, rc); 3602 mapping_set_error(inode->i_mapping, rc);
3607 cifs_invalidate_mapping(inode); 3603 cifs_invalidate_mapping(inode);
3608 } 3604 }
3609 cFYI(1, "Oplock flush inode %p rc %d", inode, rc); 3605 cifs_dbg(FYI, "Oplock flush inode %p rc %d\n", inode, rc);
3610 } 3606 }
3611 3607
3612 rc = cifs_push_locks(cfile); 3608 rc = cifs_push_locks(cfile);
3613 if (rc) 3609 if (rc)
3614 cERROR(1, "Push locks rc = %d", rc); 3610 cifs_dbg(VFS, "Push locks rc = %d\n", rc);
3615 3611
3616 /* 3612 /*
3617 * releasing stale oplock after recent reconnect of smb session using 3613 * releasing stale oplock after recent reconnect of smb session using
@@ -3622,7 +3618,7 @@ void cifs_oplock_break(struct work_struct *work)
3622 if (!cfile->oplock_break_cancelled) { 3618 if (!cfile->oplock_break_cancelled) {
3623 rc = tcon->ses->server->ops->oplock_response(tcon, &cfile->fid, 3619 rc = tcon->ses->server->ops->oplock_response(tcon, &cfile->fid,
3624 cinode); 3620 cinode);
3625 cFYI(1, "Oplock release rc = %d", rc); 3621 cifs_dbg(FYI, "Oplock release rc = %d\n", rc);
3626 } 3622 }
3627} 3623}
3628 3624