Skip to contentSkip to conversation

cifs: Rename cERROR and cifserror to cifs_vfs_err

PATCH In review Joe Perches 3 participants 10 messages Mar 12, 2013 – Mar 25, 2013 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: Rename cERROR and cifserror to cifs_vfs_err

The cERROR macro is always used as cERROR(1, and cifserror is just a printk(KERN_ERR "CIFS VFS: ".

Make a cifs_vfs_err function that uses the vsprintf %pV extension to avoid duplicating the "CIFS VFS: " prefix.

Remove the cERROR macro and use cifs_vfs_err directly.

Size is reduced ~ 1% when CONFIG_CIFS_DEBUG is set (default y)

$ size fs/cifs/cifs.ko*
   text	   data	    bss	    dec	    hex	filename
 265520	   2525	    132	 268177	  41791	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 Remove unnecessary terminating \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

---
 fs/cifs/cache.c         |   2 +-
 fs/cifs/cifs_debug.c    |  61 ++++++++++++++--------
 fs/cifs/cifs_debug.h    |  15 +-----
 fs/cifs/cifs_dfs_ref.c  |   8 +--
 fs/cifs/cifs_unicode.c  |   4 +-
 fs/cifs/cifsacl.c       |  22 ++++----
 fs/cifs/cifsencrypt.c   |  87 +++++++++++++++----------------
 fs/cifs/cifsfs.c        |   9 ++--
 fs/cifs/cifssmb.c       |  69 +++++++++++--------------
 fs/cifs/connect.c       | 135 +++++++++++++++++++++---------------------------
 fs/cifs/dir.c           |   6 +--
 fs/cifs/file.c          |  25 ++++-----
 fs/cifs/fscache.c       |   2 +-
 fs/cifs/inode.c         |   4 +-
 fs/cifs/link.c          |  10 ++--
 fs/cifs/misc.c          |  34 ++++++------
 fs/cifs/netmisc.c       |   6 +--
 fs/cifs/readdir.c       |  25 +++++----
 fs/cifs/sess.c          |  40 +++++++-------
 fs/cifs/smb1ops.c       |   6 +--
 fs/cifs/smb2inode.c     |   2 +-
 fs/cifs/smb2misc.c      |  54 +++++++++----------
 fs/cifs/smb2ops.c       |  14 ++---
 fs/cifs/smb2pdu.c       |  60 +++++++++++----------
 fs/cifs/smb2transport.c |  18 +++----
 fs/cifs/smbencrypt.c    |  14 ++---
 fs/cifs/transport.c     |  42 +++++++--------
 fs/cifs/xattr.c         |   4 +-
 28 files changed, 373 insertions(+), 405 deletions(-)
fs/cifs/cache.c +1 -1
index 282d6de..e2166dc 100644
@@ -92,7 +92,7 @@ static uint16_t cifs_server_get_key(const void *cookie_netfs_data,
 		break;
 
 	default:
-		cERROR(1, "Unknown network family '%d'", sa->sa_family);
+		cifs_vfs_err("Unknown network family '%d'", sa->sa_family);
 		key_len = 0;
 		break;
 	}
fs/cifs/cifs_debug.c +39 -22

99 lines not on this page · raw message

fs/cifs/cifs_debug.h +2 -13
index 69ae3d3..66449e1 100644
@@ -62,14 +62,8 @@ do {									\
 	printk(KERN_WARNING fmt "\n", ##__VA_ARGS__)
 
 /* error event message: e.g., i/o error */
-#define cifserror(fmt, ...)						\
-	printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__);		\
 
-#define cERROR(set, fmt, ...)						\
-do {									\
-	if (set)							\
-		cifserror(fmt, ##__VA_ARGS__);				\
-} while (0)
+__printf(1, 2) void cifs_vfs_err(const char *fmt, ...);
 
 /*
  *	debug OFF
@@ -87,16 +81,11 @@ do {									\
 	if (0 && set)							\
 		cifsfyi(fmt, ##__VA_ARGS__);				\
 } while (0)
-#define cifserror(fmt, ...)						\
+#define cif_vfs_err(fmt, ...)						\
 do {									\
 	if (0)								\
 		printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__);	\
 } while (0)
-#define cERROR(set, fmt, ...)						\
-do {									\
-	if (0 && set)							\
-		cifserror(fmt, ##__VA_ARGS__);				\
-} while (0)
 #endif		/* _CIFS_DEBUG */
 
 #endif				/* _H_CIFS_DEBUG */
fs/cifs/cifs_dfs_ref.c +4 -4
index 210fce2..e7f1a40 100644
@@ -84,8 +84,8 @@ static char *cifs_get_share_name(const char *node_name)
 	/* find server name end */
 	pSep = memchr(UNC+2, '\\', len-2);
 	if (!pSep) {
-		cERROR(1, "%s: no server name end in node name: %s",
-			__func__, node_name);
+		cifs_vfs_err("%s: no server name end in node name: %s",
+			     __func__, node_name);
 		kfree(UNC);
 		return ERR_PTR(-EINVAL);
 	}
@@ -320,8 +320,8 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)
 		/* connect to a node */
 		len = strlen(referrals[i].node_name);
 		if (len < 2) {
-			cERROR(1, "%s: Net Address path too short: %s",
-					__func__, referrals[i].node_name);
+			cifs_vfs_err("%s: Net Address path too short: %s",
+				     __func__, referrals[i].node_name);
 			mnt = ERR_PTR(-EINVAL);
 			break;
 		}
fs/cifs/cifs_unicode.c +2 -2
index 71d5d0a..70c6de0 100644
@@ -227,8 +227,8 @@ cifs_strtoUTF16(__le16 *to, const char *from, int len,
 	for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
 		charlen = codepage->char2uni(from, len, &wchar_to);
 		if (charlen < 1) {
-			cERROR(1, "strtoUTF16: char2uni of 0x%x returned %d",
-				*from, charlen);
+			cifs_vfs_err("strtoUTF16: char2uni of 0x%x returned %d",
+				     *from, charlen);
 			/* A question mark */
 			wchar_to = 0x003f;
 			charlen = 1;
fs/cifs/cifsacl.c +11 -11
index f1e3f25..9581b5d 100644
@@ -462,7 +462,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
 			*pbits_to_set &= ~S_IXUGO;
 		return;
 	} else if (type != ACCESS_ALLOWED) {
-		cERROR(1, "unknown access control type %d", type);
+		cifs_vfs_err("unknown access control type %d", type);
 		return;
 	}
 	/* else ACCESS_ALLOWED type */
@@ -551,12 +551,12 @@ static void dump_ace(struct cifs_ace *pace, char *end_of_acl)
 	/* validate that we do not go past end of acl */
 
 	if (le16_to_cpu(pace->size) < 16) {
-		cERROR(1, "ACE too small %d", le16_to_cpu(pace->size));
+		cifs_vfs_err("ACE too small %d", le16_to_cpu(pace->size));
 		return;
 	}
 
 	if (end_of_acl < (char *)pace + le16_to_cpu(pace->size)) {
-		cERROR(1, "ACL too small to parse ACE");
+		cifs_vfs_err("ACL too small to parse ACE");
 		return;
 	}
 
@@ -601,7 +601,7 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
 
 	/* validate that we do not go past end of acl */
 	if (end_of_acl < (char *)pdacl + le16_to_cpu(pdacl->size)) {
-		cERROR(1, "ACL too small to parse DACL");
+		cifs_vfs_err("ACL too small to parse DACL");
 		return;
 	}
 
@@ -628,7 +628,7 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
 		ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
 				GFP_KERNEL);
 		if (!ppace) {
-			cERROR(1, "DACL memory allocation error");
+			cifs_vfs_err("DACL memory allocation error");
 			return;
 		}
 
@@ -703,7 +703,7 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl)
 	/* validate that we do not go past end of ACL - sid must be at least 8
 	   bytes long (assuming no sub-auths - e.g. the null SID */
 	if (end_of_acl < (char *)psid + 8) {
-		cERROR(1, "ACL too small to parse SID %p", psid);
+		cifs_vfs_err("ACL too small to parse SID %p", psid);
 		return -EINVAL;
 	}
 
@@ -972,7 +972,7 @@ int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
 			create_options, &fid, &oplock, NULL, cifs_sb->local_nls,
 			cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
 	if (rc) {
-		cERROR(1, "Unable to open file to set ACL");
+		cifs_vfs_err("Unable to open file to set ACL");
 		goto out;
 	}
 
@@ -1005,12 +1005,12 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
 	/* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
 	if (IS_ERR(pntsd)) {
 		rc = PTR_ERR(pntsd);
-		cERROR(1, "%s: error %d getting sec desc", __func__, rc);
+		cifs_vfs_err("%s: error %d getting sec desc", __func__, rc);
 	} else {
 		rc = parse_sec_desc(cifs_sb, pntsd, acllen, fattr);
 		kfree(pntsd);
 		if (rc)
-			cERROR(1, "parse sec desc failed rc = %d", rc);
+			cifs_vfs_err("parse sec desc failed rc = %d", rc);
 	}
 
 	return rc;
@@ -1033,7 +1033,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
 	pntsd = get_cifs_acl(CIFS_SB(inode->i_sb), inode, path, &secdesclen);
 	if (IS_ERR(pntsd)) {
 		rc = PTR_ERR(pntsd);
-		cERROR(1, "%s: error %d getting sec desc", __func__, rc);
+		cifs_vfs_err("%s: error %d getting sec desc", __func__, rc);
 		goto out;
 	}
 
@@ -1046,7 +1046,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 nmode,
 	secdesclen = max_t(u32, secdesclen, DEFAULT_SEC_DESC_LEN);
 	pnntsd = kmalloc(secdesclen, GFP_KERNEL);
 	if (!pnntsd) {
-		cERROR(1, "Unable to allocate security descriptor");
+		cifs_vfs_err("Unable to allocate security descriptor");
 		kfree(pntsd);
 		return -ENOMEM;
 	}
fs/cifs/cifsencrypt.c +43 -44

328 lines not on this page · raw message

fs/cifs/cifsfs.c +5 -4
index 1a052c0..f4038e5 100644
@@ -145,7 +145,7 @@ cifs_read_super(struct super_block *sb)
 	return 0;
 
 out_no_root:
-	cERROR(1, "cifs_read_super: get root inode failed");
+	cifs_vfs_err("%s: get root inode failed", __func__);
 	return rc;
 }
 
@@ -631,7 +631,8 @@ cifs_do_mount(struct file_system_type *fs_type,
 	rc = cifs_mount(cifs_sb, volume_info);
 	if (rc) {
 		if (!(flags & MS_SILENT))
-			cERROR(1, "cifs_mount failed w/return code = %d", rc);
+			cifs_vfs_err("cifs_mount failed w/return code = %d",
+				     rc);
 		root = ERR_PTR(rc);
 		goto out_mountdata;
 	}
@@ -1005,7 +1006,7 @@ cifs_init_request_bufs(void)
 	} else {
 		CIFSMaxBufSize &= 0x1FE00; /* Round size to even 512 byte mult*/
 	}
-/*	cERROR(1, "CIFSMaxBufSize %d 0x%x",CIFSMaxBufSize,CIFSMaxBufSize); */
+/*	cifs_vfs_err("CIFSMaxBufSize %d 0x%x",CIFSMaxBufSize,CIFSMaxBufSize); */
 	cifs_req_cachep = kmem_cache_create("cifs_request",
 					    CIFSMaxBufSize + max_hdr_size, 0,
 					    SLAB_HWCACHE_ALIGN, NULL);
@@ -1016,7 +1017,7 @@ cifs_init_request_bufs(void)
 		cifs_min_rcv = 1;
 	else if (cifs_min_rcv > 64) {
 		cifs_min_rcv = 64;
-		cERROR(1, "cifs_min_rcv set to maximum (64)");
+		cifs_vfs_err("cifs_min_rcv set to maximum (64)");
 	}
 
 	cifs_req_poolp = mempool_create_slab_pool(cifs_min_rcv,
fs/cifs/cifssmb.c +30 -39

225 lines not on this page · raw message

fs/cifs/connect.c +59 -76

376 lines not on this page · raw message

fs/cifs/dir.c +3 -3
index 1cd0162..b158e77 100644
@@ -102,7 +102,7 @@ cifs_bp_rename_retry:
 		namelen += (1 + temp->d_name.len);
 		temp = temp->d_parent;
 		if (temp == NULL) {
-			cERROR(1, "corrupt dentry");
+			cifs_vfs_err("corrupt dentry");
 			rcu_read_unlock();
 			return NULL;
 		}
@@ -129,7 +129,7 @@ cifs_bp_rename_retry:
 		spin_unlock(&temp->d_lock);
 		temp = temp->d_parent;
 		if (temp == NULL) {
-			cERROR(1, "corrupt dentry");
+			cifs_vfs_err("corrupt dentry");
 			rcu_read_unlock();
 			kfree(full_path);
 			return NULL;
@@ -742,7 +742,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 	/*	if it was once a directory (but how can we tell?) we could do
 		shrink_dcache_parent(direntry); */
 	} else if (rc != -EACCES) {
-		cERROR(1, "Unexpected lookup error %d", rc);
+		cifs_vfs_err("Unexpected lookup error %d", rc);
 		/* We special case check for Access Denied - since that
 		is a common return code */
 	}
fs/cifs/file.c +11 -14
index 8c0d855..e742d5a 100644
@@ -470,12 +470,9 @@ int cifs_open(struct inode *inode, struct file *file)
 			posix_open_ok = true;
 		} else if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
 			if (tcon->ses->serverNOS)
-				cERROR(1, "server %s of type %s returned"
-					   " unexpected error on SMB posix open"
-					   ", disabling posix open support."
-					   " Check if server update available.",
-					   tcon->ses->serverName,
-					   tcon->ses->serverNOS);
+				cifs_vfs_err("server %s of type %s returned unexpected error on SMB posix open, disabling posix open support. Check if server update available.",
+					     tcon->ses->serverName,
+					     tcon->ses->serverNOS);
 			tcon->broken_posix_open = true;
 		} else if ((rc != -EIO) && (rc != -EREMOTE) &&
 			 (rc != -EOPNOTSUPP)) /* path not found or net err */
@@ -1136,7 +1133,7 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile)
 			 * The list ended. We don't have enough allocated
 			 * structures - something is really wrong.
 			 */
-			cERROR(1, "Can't push all brlocks!");
+			cifs_vfs_err("Can't push all brlocks!");
 			break;
 		}
 		length = 1 + flock->fl_end - flock->fl_start;
@@ -1292,8 +1289,8 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
 					    type, 0, 1, false);
 		flock->fl_type = F_UNLCK;
 		if (rc != 0)
-			cERROR(1, "Error unlocking previously locked "
-				  "range %d during test of lock", rc);
+			cifs_vfs_err("Error unlocking previously locked range %d during test of lock",
+				     rc);
 		return 0;
 	}
 
@@ -1312,8 +1309,8 @@ cifs_getlk(struct file *file, struct file_lock *flock, __u32 type,
 			type | server->vals->shared_lock_type, 0, 1, false);
 		flock->fl_type = F_RDLCK;
 		if (rc != 0)
-			cERROR(1, "Error unlocking previously locked "
-				  "range %d during test of lock", rc);
+			cifs_vfs_err("Error unlocking previously locked range %d during test of lock",
+				     rc);
 	} else
 		flock->fl_type = F_WRLCK;
 
@@ -1732,7 +1729,7 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode,
 	it being zero) during stress testcases so we need to check for it */
 
 	if (cifs_inode == NULL) {
-		cERROR(1, "Null inode passed to cifs_writeable_file");
+		cifs_vfs_err("Null inode passed to cifs_writeable_file");
 		dump_stack();
 		return NULL;
 	}
@@ -2011,7 +2008,7 @@ retry:
 			wdata->cfile = find_writable_file(CIFS_I(mapping->host),
 							  false);
 			if (!wdata->cfile) {
-				cERROR(1, "No writable handles for inode");
+				cifs_vfs_err("No writable handles for inode");
 				rc = -EBADF;
 				break;
 			}
@@ -3610,7 +3607,7 @@ void cifs_oplock_break(struct work_struct *work)
 
 	rc = cifs_push_locks(cfile);
 	if (rc)
-		cERROR(1, "Push locks rc = %d", rc);
+		cifs_vfs_err("Push locks rc = %d", rc);
 
 	/*
 	 * releasing stale oplock after recent reconnect of smb session using
fs/cifs/fscache.c +1 -1
index 42e5363..467b63d 100644
@@ -173,7 +173,7 @@ int __cifs_readpage_from_fscache(struct inode *inode, struct page *page)
 		return 1;
 
 	default:
-		cERROR(1, "unknown error ret = %d", ret);
+		cifs_vfs_err("unknown error ret = %d", ret);
 	}
 	return ret;
 }
fs/cifs/inode.c +2 -2
index 0079696..851ec8d 100644
@@ -1683,8 +1683,8 @@ cifs_invalidate_mapping(struct inode *inode)
 	if (inode->i_mapping && inode->i_mapping->nrpages != 0) {
 		rc = invalidate_inode_pages2(inode->i_mapping);
 		if (rc) {
-			cERROR(1, "%s: could not invalidate inode %p", __func__,
-			       inode);
+			cifs_vfs_err("%s: could not invalidate inode %p",
+				     __func__, inode);
 			cifs_i->invalid_mapping = true;
 		}
 	}
fs/cifs/link.c +5 -5
index 9f6c4c4..27496f2 100644
@@ -56,14 +56,14 @@ symlink_hash(unsigned int link_len, const char *link_str, u8 *md5_hash)
 	md5 = crypto_alloc_shash("md5", 0, 0);
 	if (IS_ERR(md5)) {
 		rc = PTR_ERR(md5);
-		cERROR(1, "%s: Crypto md5 allocation error %d", __func__, rc);
+		cifs_vfs_err("%s: Crypto md5 allocation error %d",
+			     __func__, rc);
 		return rc;
 	}
 	size = sizeof(struct shash_desc) + crypto_shash_descsize(md5);
 	sdescmd5 = kmalloc(size, GFP_KERNEL);
 	if (!sdescmd5) {
 		rc = -ENOMEM;
-		cERROR(1, "%s: Memory allocation failure", __func__);
 		goto symlink_hash_err;
 	}
 	sdescmd5->shash.tfm = md5;
@@ -71,17 +71,17 @@ symlink_hash(unsigned int link_len, const char *link_str, u8 *md5_hash)
 
 	rc = crypto_shash_init(&sdescmd5->shash);
 	if (rc) {
-		cERROR(1, "%s: Could not init md5 shash", __func__);
+		cifs_vfs_err("%s: Could not init md5 shash", __func__);
 		goto symlink_hash_err;
 	}
 	rc = crypto_shash_update(&sdescmd5->shash, link_str, link_len);
 	if (rc) {
-		cERROR(1, "%s: Could not update with link_str", __func__);
+		cifs_vfs_err("%s: Could not update with link_str", __func__);
 		goto symlink_hash_err;
 	}
 	rc = crypto_shash_final(&sdescmd5->shash, md5_hash);
 	if (rc)
-		cERROR(1, "%s: Could not generate md5 hash", __func__);
+		cifs_vfs_err("%s: Could not generate md5 hash", __func__);
 
 symlink_hash_err:
 	crypto_free_shash(md5);
fs/cifs/misc.c +15 -19
index 1b15bf8..d05bfc6 100644
@@ -282,15 +282,15 @@ check_smb_hdr(struct smb_hdr *smb, __u16 mid)
 {
 	/* does it have the right SMB "signature" ? */
 	if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) {
-		cERROR(1, "Bad protocol string signature header 0x%x",
-			*(unsigned int *)smb->Protocol);
+		cifs_vfs_err("Bad protocol string signature header 0x%x",
+			     *(unsigned int *)smb->Protocol);
 		return 1;
 	}
 
 	/* Make sure that message ids match */
 	if (mid != smb->Mid) {
-		cERROR(1, "Mids do not match. received=%u expected=%u",
-			smb->Mid, mid);
+		cifs_vfs_err("Mids do not match. received=%u expected=%u",
+			     smb->Mid, mid);
 		return 1;
 	}
 
@@ -302,7 +302,7 @@ check_smb_hdr(struct smb_hdr *smb, __u16 mid)
 	if (smb->Command == SMB_COM_LOCKING_ANDX)
 		return 0;
 
-	cERROR(1, "Server sent request, not response. mid=%u", smb->Mid);
+	cifs_vfs_err("Server sent request, not response. mid=%u", smb->Mid);
 	return 1;
 }
 
@@ -340,9 +340,9 @@ checkSMB(char *buf, unsigned int total_read)
 				tmp[sizeof(struct smb_hdr)+1] = 0;
 				return 0;
 			}
-			cERROR(1, "rcvd invalid byte count (bcc)");
+			cifs_vfs_err("rcvd invalid byte count (bcc)");
 		} else {
-			cERROR(1, "Length less than smb header size");
+			cifs_vfs_err("Length less than smb header size");
 		}
 		return -EIO;
 	}
@@ -353,8 +353,8 @@ checkSMB(char *buf, unsigned int total_read)
 	clc_len = smbCalcSize(smb);
 
 	if (4 + rfclen != total_read) {
-		cERROR(1, "Length read does not match RFC1001 length %d",
-				rfclen);
+		cifs_vfs_err("Length read does not match RFC1001 length %d",
+			     rfclen);
 		return -EIO;
 	}
 
@@ -369,8 +369,8 @@ checkSMB(char *buf, unsigned int total_read)
 				clc_len, 4 + rfclen, smb->Mid);
 
 		if (4 + rfclen < clc_len) {
-			cERROR(1, "RFC1001 size %u smaller than SMB for mid=%u",
-					rfclen, smb->Mid);
+			cifs_vfs_err("RFC1001 size %u smaller than SMB for mid=%u",
+				     rfclen, smb->Mid);
 			return -EIO;
 		} else if (rfclen > clc_len + 512) {
 			/*
@@ -382,8 +382,8 @@ checkSMB(char *buf, unsigned int total_read)
 			 * trailing data, we choose limit the amount of extra
 			 * data to 512 bytes.
 			 */
-			cERROR(1, "RFC1001 size %u more than 512 bytes larger "
-				  "than SMB for mid=%u", rfclen, smb->Mid);
+			cifs_vfs_err("RFC1001 size %u more than 512 bytes larger than SMB for mid=%u",
+				     rfclen, smb->Mid);
 			return -EIO;
 		}
 	}
@@ -536,12 +536,8 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb)
 {
 	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
 		cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM;
-		cERROR(1, "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.",
-			   cifs_sb_master_tcon(cifs_sb)->treeName);
+		cifs_vfs_err("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.",
+			     cifs_sb_master_tcon(cifs_sb)->treeName);
 	}
 }
 
fs/cifs/netmisc.c +3 -3
index a82bc51..36f8845 100644
@@ -956,15 +956,15 @@ struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset)
 	sec = 2 * st->TwoSeconds;
 	min = st->Minutes;
 	if ((sec > 59) || (min > 59))
-		cERROR(1, "illegal time min %d sec %d", min, sec);
+		cifs_vfs_err("illegal time min %d sec %d", min, sec);
 	sec += (min * 60);
 	sec += 60 * 60 * st->Hours;
 	if (st->Hours > 24)
-		cERROR(1, "illegal hours %d", st->Hours);
+		cifs_vfs_err("illegal hours %d", st->Hours);
 	days = sd->Day;
 	month = sd->Month;
 	if ((days > 31) || (month > 12)) {
-		cERROR(1, "illegal date, month %d day: %d", month, days);
+		cifs_vfs_err("illegal date, month %d day: %d", month, days);
 		if (month > 12)
 			month = 12;
 	}
fs/cifs/readdir.c +12 -13
index df40cc5..25a1186 100644
@@ -356,15 +356,15 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
 	cFYI(1, "new entry %p old entry %p", new_entry, old_entry);
 	/* validate that new_entry is not past end of SMB */
 	if (new_entry >= end_of_smb) {
-		cERROR(1, "search entry %p began after end of SMB %p old entry %p",
-			new_entry, end_of_smb, old_entry);
+		cifs_vfs_err("search entry %p began after end of SMB %p old entry %p",
+			     new_entry, end_of_smb, old_entry);
 		return NULL;
 	} else if (((level == SMB_FIND_FILE_INFO_STANDARD) &&
 		    (new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb))
 		  || ((level != SMB_FIND_FILE_INFO_STANDARD) &&
 		   (new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb)))  {
-		cERROR(1, "search entry %p extends after end of SMB %p",
-			new_entry, end_of_smb);
+		cifs_vfs_err("search entry %p extends after end of SMB %p",
+			     new_entry, end_of_smb);
 		return NULL;
 	} else
 		return new_entry;
@@ -640,9 +640,8 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon,
 		}
 		if ((cur_ent == NULL) && (i < pos_in_buf)) {
 			/* BB fixme - check if we should flag this error */
-			cERROR(1, "reached end of buf searching for pos in buf"
-				  " %d index to find %lld rc %d", pos_in_buf,
-				  index_to_find, rc);
+			cifs_vfs_err("reached end of buf searching for pos in buf %d index to find %lld rc %d",
+				     pos_in_buf, index_to_find, rc);
 		}
 		rc = 0;
 		*current_entry = cur_ent;
@@ -678,8 +677,8 @@ static int cifs_filldir(char *find_entry, struct file *file, filldir_t filldir,
 		return rc;
 
 	if (de.namelen > max_len) {
-		cERROR(1, "bad search response length %zd past smb end",
-			  de.namelen);
+		cifs_vfs_err("bad search response length %zd past smb end",
+			     de.namelen);
 		return -EINVAL;
 	}
 
@@ -777,7 +776,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
 	case 0:
 		if (filldir(direntry, ".", 1, file->f_pos,
 		     file_inode(file)->i_ino, DT_DIR) < 0) {
-			cERROR(1, "Filldir for current dir failed");
+			cifs_vfs_err("Filldir for current dir failed");
 			rc = -ENOMEM;
 			break;
 		}
@@ -785,7 +784,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
 	case 1:
 		if (filldir(direntry, "..", 2, file->f_pos,
 		     parent_ino(file->f_path.dentry), DT_DIR) < 0) {
-			cERROR(1, "Filldir for parent dir failed");
+			cifs_vfs_err("Filldir for parent dir failed");
 			rc = -ENOMEM;
 			break;
 		}
@@ -840,8 +839,8 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
 		for (i = 0; (i < num_to_fill) && (rc == 0); i++) {
 			if (current_entry == NULL) {
 				/* evaluate whether this case is an error */
-				cERROR(1, "past SMB end,  num to fill %d i %d",
-					  num_to_fill, i);
+				cifs_vfs_err("past SMB end,  num to fill %d i %d",
+					     num_to_fill, i);
 				break;
 			}
 			/*
fs/cifs/sess.c +19 -21
index 76809f4..64468e8 100644
@@ -373,16 +373,16 @@ int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
 	CHALLENGE_MESSAGE *pblob = (CHALLENGE_MESSAGE *)bcc_ptr;
 
 	if (blob_len < sizeof(CHALLENGE_MESSAGE)) {
-		cERROR(1, "challenge blob len %d too small", blob_len);
+		cifs_vfs_err("challenge blob len %d too small", blob_len);
 		return -EINVAL;
 	}
 
 	if (memcmp(pblob->Signature, "NTLMSSP", 8)) {
-		cERROR(1, "blob signature incorrect %s", pblob->Signature);
+		cifs_vfs_err("blob signature incorrect %s", pblob->Signature);
 		return -EINVAL;
 	}
 	if (pblob->MessageType != NtLmChallenge) {
-		cERROR(1, "Incorrect message type %d", pblob->MessageType);
+		cifs_vfs_err("Incorrect message type %d", pblob->MessageType);
 		return -EINVAL;
 	}
 
@@ -395,13 +395,14 @@ int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
 	tioffset = le32_to_cpu(pblob->TargetInfoArray.BufferOffset);
 	tilen = le16_to_cpu(pblob->TargetInfoArray.Length);
 	if (tioffset > blob_len || tioffset + tilen > blob_len) {
-		cERROR(1, "tioffset + tilen too high %u + %u", tioffset, tilen);
+		cifs_vfs_err("tioffset + tilen too high %u + %u",
+			     tioffset, tilen);
 		return -EINVAL;
 	}
 	if (tilen) {
 		ses->auth_key.response = kmalloc(tilen, GFP_KERNEL);
 		if (!ses->auth_key.response) {
-			cERROR(1, "Challenge target info allocation failure");
+			cifs_vfs_err("Challenge target info allocation failure");
 			return -ENOMEM;
 		}
 		memcpy(ses->auth_key.response, bcc_ptr + tioffset, tilen);
@@ -486,7 +487,7 @@ int build_ntlmssp_auth_blob(unsigned char *pbuffer,
 	sec_blob->NtChallengeResponse.BufferOffset = cpu_to_le32(tmp - pbuffer);
 	rc = setup_ntlmv2_rsp(ses, nls_cp);
 	if (rc) {
-		cERROR(1, "Error %d during NTLMSSP authentication", rc);
+		cifs_vfs_err("Error %d during NTLMSSP authentication", rc);
 		goto setup_ntlmv2_ret;
 	}
 	memcpy(tmp, ses->auth_key.response + CIFS_SESS_KEY_SIZE,
@@ -688,7 +689,7 @@ ssetup_ntlmssp_authenticate:
 		/* calculate ntlm response and session key */
 		rc = setup_ntlm_response(ses, nls_cp);
 		if (rc) {
-			cERROR(1, "Error %d during NTLM authentication", rc);
+			cifs_vfs_err("Error %d during NTLM authentication", rc);
 			goto ssetup_exit;
 		}
 
@@ -718,7 +719,8 @@ ssetup_ntlmssp_authenticate:
 		/* calculate nlmv2 response and session key */
 		rc = setup_ntlmv2_rsp(ses, nls_cp);
 		if (rc) {
-			cERROR(1, "Error %d during NTLMv2 authentication", rc);
+			cifs_vfs_err("Error %d during NTLMv2 authentication",
+				     rc);
 			goto ssetup_exit;
 		}
 		memcpy(bcc_ptr, ses->auth_key.response + CIFS_SESS_KEY_SIZE,
@@ -754,17 +756,14 @@ ssetup_ntlmssp_authenticate:
 		/* check version field to make sure that cifs.upcall is
 		   sending us a response in an expected form */
 		if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) {
-			cERROR(1, "incorrect version of cifs.upcall (expected"
-				   " %d but got %d)",
-				   CIFS_SPNEGO_UPCALL_VERSION, msg->version);
+			cifs_vfs_err("incorrect version of cifs.upcall (expected %d but got %d)",
+				     CIFS_SPNEGO_UPCALL_VERSION, msg->version);
 			rc = -EKEYREJECTED;
 			goto ssetup_exit;
 		}
 
 		ses->auth_key.response = kmalloc(msg->sesskey_len, GFP_KERNEL);
 		if (!ses->auth_key.response) {
-			cERROR(1, "Kerberos can't allocate (%u bytes) memory",
-					msg->sesskey_len);
 			rc = -ENOMEM;
 			goto ssetup_exit;
 		}
@@ -790,13 +789,13 @@ ssetup_ntlmssp_authenticate:
 		/* BB: is this right? */
 			ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
 #else /* ! CONFIG_CIFS_UPCALL */
-		cERROR(1, "Kerberos negotiated but upcall support disabled!");
+		cifs_vfs_err("Kerberos negotiated but upcall support disabled!");
 		rc = -ENOSYS;
 		goto ssetup_exit;
 #endif /* CONFIG_CIFS_UPCALL */
 	} else if (type == RawNTLMSSP) {
 		if ((pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) == 0) {
-			cERROR(1, "NTLMSSP requires Unicode support");
+			cifs_vfs_err("NTLMSSP requires Unicode support");
 			rc = -ENOSYS;
 			goto ssetup_exit;
 		}
@@ -824,7 +823,6 @@ ssetup_ntlmssp_authenticate:
 				5*sizeof(struct _AUTHENTICATE_MESSAGE),
 				GFP_KERNEL);
 			if (!ntlmsspblob) {
-				cERROR(1, "Can't allocate NTLMSSP blob");
 				rc = -ENOMEM;
 				goto ssetup_exit;
 			}
@@ -844,7 +842,7 @@ ssetup_ntlmssp_authenticate:
 			smb_buf->Uid = ses->Suid;
 			break;
 		default:
-			cERROR(1, "invalid phase %d", phase);
+			cifs_vfs_err("invalid phase %d", phase);
 			rc = -ENOSYS;
 			goto ssetup_exit;
 		}
@@ -855,7 +853,7 @@ ssetup_ntlmssp_authenticate:
 		}
 		unicode_oslm_strings(&bcc_ptr, nls_cp);
 	} else {
-		cERROR(1, "secType %d not supported!", type);
+		cifs_vfs_err("secType %d not supported!", type);
 		rc = -ENOSYS;
 		goto ssetup_exit;
 	}
@@ -880,7 +878,7 @@ ssetup_ntlmssp_authenticate:
 	    (smb_buf->Status.CifsError ==
 			cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED))) {
 		if (phase != NtLmNegotiate) {
-			cERROR(1, "Unexpected more processing error");
+			cifs_vfs_err("Unexpected more processing error");
 			goto ssetup_exit;
 		}
 		/* NTLMSSP Negotiate sent now processing challenge (response) */
@@ -892,7 +890,7 @@ ssetup_ntlmssp_authenticate:
 
 	if ((smb_buf->WordCount != 3) && (smb_buf->WordCount != 4)) {
 		rc = -EIO;
-		cERROR(1, "bad word count %d", smb_buf->WordCount);
+		cifs_vfs_err("bad word count %d", smb_buf->WordCount);
 		goto ssetup_exit;
 	}
 	action = le16_to_cpu(pSMB->resp.Action);
@@ -908,7 +906,7 @@ ssetup_ntlmssp_authenticate:
 	if (smb_buf->WordCount == 4) {
 		blob_len = le16_to_cpu(pSMB->resp.SecurityBlobLength);
 		if (blob_len > bytes_remaining) {
-			cERROR(1, "bad security blob length %d", blob_len);
+			cifs_vfs_err("bad security blob length %d", blob_len);
 			rc = -EINVAL;
 			goto ssetup_exit;
 		}
fs/cifs/smb1ops.c +3 -3
index 47bc5a8..0a44086 100644
@@ -271,8 +271,8 @@ check2ndT2(char *buf)
 	cFYI(1, "missing %d bytes from transact2, check next response",
 		remaining);
 	if (total_data_size > CIFSMaxBufSize) {
-		cERROR(1, "TotalDataSize %d is over maximum buffer %d",
-			total_data_size, CIFSMaxBufSize);
+		cifs_vfs_err("TotalDataSize %d is over maximum buffer %d",
+			     total_data_size, CIFSMaxBufSize);
 		return -EINVAL;
 	}
 	return remaining;
@@ -388,7 +388,7 @@ cifs_check_trans2(struct mid_q_entry *mid, struct TCP_Server_Info *server,
 	}
 	if (!server->large_buf) {
 		/*FIXME: switch to already allocated largebuf?*/
-		cERROR(1, "1st trans2 resp needs bigbuf");
+		cifs_vfs_err("1st trans2 resp needs bigbuf");
 	} else {
 		/* Have first buffer */
 		mid->resp_buf = buf;
fs/cifs/smb2inode.c +1 -1
index 7064824..46247ac 100644
@@ -92,7 +92,7 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
 				      (FILE_BASIC_INFO *)data);
 		break;
 	default:
-		cERROR(1, "Invalid command");
+		cifs_vfs_err("Invalid command");
 		break;
 	}
 
fs/cifs/smb2misc.c +27 -27

134 lines not on this page · raw message

fs/cifs/smb2ops.c +7 -7
index bceffe7..4f0539c 100644
@@ -38,7 +38,7 @@ change_conf(struct TCP_Server_Info *server)
 	case 1:
 		server->echoes = false;
 		server->oplocks = false;
-		cERROR(1, "disabling echoes and oplocks");
+		cifs_vfs_err("disabling echoes and oplocks");
 		break;
 	case 2:
 		server->echoes = true;
@@ -147,10 +147,10 @@ smb2_dump_detail(void *buf)
 #ifdef CONFIG_CIFS_DEBUG2
 	struct smb2_hdr *smb = (struct smb2_hdr *)buf;
 
-	cERROR(1, "Cmd: %d Err: 0x%x Flags: 0x%x Mid: %llu Pid: %d",
-		  smb->Command, smb->Status, smb->Flags, smb->MessageId,
-		  smb->ProcessId);
-	cERROR(1, "smb buf %p len %u", smb, smb2_calc_size(smb));
+	cifs_vfs_err("Cmd: %d Err: 0x%x Flags: 0x%x Mid: %llu Pid: %d",
+		     smb->Command, smb->Status, smb->Flags, smb->MessageId,
+		     smb->ProcessId);
+	cifs_vfs_err("smb buf %p len %u", smb, smb2_calc_size(smb));
 #endif
 }
 
@@ -436,7 +436,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
 		       &oplock, NULL);
 	kfree(utf16_path);
 	if (rc) {
-		cERROR(1, "open dir failed");
+		cifs_vfs_err("open dir failed");
 		return rc;
 	}
 
@@ -448,7 +448,7 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
 	rc = SMB2_query_directory(xid, tcon, persistent_fid, volatile_fid, 0,
 				  srch_inf);
 	if (rc) {
-		cERROR(1, "query directory failed");
+		cifs_vfs_err("query directory failed");
 		SMB2_close(xid, tcon, persistent_fid, volatile_fid);
 	}
 	return rc;
fs/cifs/smb2pdu.c +29 -31

192 lines not on this page · raw message

fs/cifs/smb2transport.c +9 -9
index 8dd73e6..1dcf6e7 100644
@@ -55,13 +55,13 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
 	rc = crypto_shash_setkey(server->secmech.hmacsha256,
 		server->session_key.response, SMB2_NTLMV2_SESSKEY_SIZE);
 	if (rc) {
-		cERROR(1, "%s: Could not update with response\n", __func__);
+		cifs_vfs_err("%s: Could not update with response", __func__);
 		return rc;
 	}
 
 	rc = crypto_shash_init(&server->secmech.sdeschmacsha256->shash);
 	if (rc) {
-		cERROR(1, "%s: Could not init md5\n", __func__);
+		cifs_vfs_err("%s: Could not init md5", __func__);
 		return rc;
 	}
 
@@ -69,7 +69,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
 		if (iov[i].iov_len == 0)
 			continue;
 		if (iov[i].iov_base == NULL) {
-			cERROR(1, "null iovec entry");
+			cifs_vfs_err("null iovec entry");
 			return -EIO;
 		}
 		/*
@@ -90,8 +90,8 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
 				iov[i].iov_base, iov[i].iov_len);
 		}
 		if (rc) {
-			cERROR(1, "%s: Could not update with payload\n",
-							__func__);
+			cifs_vfs_err("%s: Could not update with payload",
+				     __func__);
 			return rc;
 		}
 	}
@@ -109,7 +109,7 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
 	rc = crypto_shash_final(&server->secmech.sdeschmacsha256->shash,
 				sigptr);
 	if (rc)
-		cERROR(1, "%s: Could not generate sha256 hash\n", __func__);
+		cifs_vfs_err("%s: Could not generate sha256 hash", __func__);
 
 	memcpy(smb2_pdu->Signature, sigptr, SMB2_SIGNATURE_SIZE);
 
@@ -205,7 +205,7 @@ smb2_mid_entry_alloc(const struct smb2_hdr *smb_buffer,
 	struct mid_q_entry *temp;
 
 	if (server == NULL) {
-		cERROR(1, "Null TCP session in smb2_mid_entry_alloc");
+		cifs_vfs_err("Null TCP session in smb2_mid_entry_alloc");
 		return NULL;
 	}
 
@@ -281,8 +281,8 @@ smb2_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server,
 
 		rc = smb2_verify_signature(&rqst, server);
 		if (rc)
-			cERROR(1, "SMB signature verification returned error = "
-			       "%d", rc);
+			cifs_vfs_err("SMB signature verification returned error = %d",
+				     rc);
 	}
 
 	return map_smb2_to_linux_error(mid->resp_buf, log_error);
fs/cifs/smbencrypt.c +7 -7
index a0a58fb..e65b788 100644
@@ -78,7 +78,7 @@ smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)
 	tfm_des = crypto_alloc_blkcipher("ecb(des)", 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(tfm_des)) {
 		rc = PTR_ERR(tfm_des);
-		cERROR(1, "could not allocate des crypto API");
+		cifs_vfs_err("could not allocate des crypto API");
 		goto smbhash_err;
 	}
 
@@ -91,7 +91,7 @@ smbhash(unsigned char *out, const unsigned char *in, unsigned char *key)
 
 	rc = crypto_blkcipher_encrypt(&desc, &sgout, &sgin, 8);
 	if (rc)
-		cERROR(1, "could not encrypt crypt key rc: %d", rc);
+		cifs_vfs_err("could not encrypt crypt key rc: %d", rc);
 
 	crypto_free_blkcipher(tfm_des);
 smbhash_err:
@@ -139,14 +139,14 @@ mdfour(unsigned char *md4_hash, unsigned char *link_str, int link_len)
 	md4 = crypto_alloc_shash("md4", 0, 0);
 	if (IS_ERR(md4)) {
 		rc = PTR_ERR(md4);
-		cERROR(1, "%s: Crypto md4 allocation error %d", __func__, rc);
+		cifs_vfs_err("%s: Crypto md4 allocation error %d",
+			     __func__, rc);
 		return rc;
 	}
 	size = sizeof(struct shash_desc) + crypto_shash_descsize(md4);
 	sdescmd4 = kmalloc(size, GFP_KERNEL);
 	if (!sdescmd4) {
 		rc = -ENOMEM;
-		cERROR(1, "%s: Memory allocation failure", __func__);
 		goto mdfour_err;
 	}
 	sdescmd4->shash.tfm = md4;
@@ -154,17 +154,17 @@ mdfour(unsigned char *md4_hash, unsigned char *link_str, int link_len)
 
 	rc = crypto_shash_init(&sdescmd4->shash);
 	if (rc) {
-		cERROR(1, "%s: Could not init md4 shash", __func__);
+		cifs_vfs_err("%s: Could not init md4 shash", __func__);
 		goto mdfour_err;
 	}
 	rc = crypto_shash_update(&sdescmd4->shash, link_str, link_len);
 	if (rc) {
-		cERROR(1, "%s: Could not update with link_str", __func__);
+		cifs_vfs_err("%s: Could not update with link_str", __func__);
 		goto mdfour_err;
 	}
 	rc = crypto_shash_final(&sdescmd4->shash, md4_hash);
 	if (rc)
-		cERROR(1, "%s: Could not genereate md4 hash", __func__);
+		cifs_vfs_err("%s: Could not generate md4 hash", __func__);
 
 mdfour_err:
 	crypto_free_shash(md4);
fs/cifs/transport.c +21 -21

134 lines not on this page · raw message

fs/cifs/xattr.c +2 -2
index 5142f2c..01d7de0 100644
@@ -319,8 +319,8 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
 						full_path, &acllen);
 			if (IS_ERR(pacl)) {
 				rc = PTR_ERR(pacl);
-				cERROR(1, "%s: error %zd getting sec desc",
-						__func__, rc);
+				cifs_vfs_err("%s: error %zd getting sec desc",
+					     __func__, rc);
 			} else {
 				if (ea_value) {
 					if (acllen > buf_size)
#1 lore raw
Quoted 7 lines · Joe Perches

The cERROR macro is always used as cERROR(1, and cifserror is just a printk(KERN_ERR "CIFS VFS: ".

Make a cifs_vfs_err function that uses the vsprintf %pV extension to avoid duplicating the "CIFS VFS: " prefix.

Remove the cERROR macro and use cifs_vfs_err directly.

Perhaps a better idea than this patch is to change both the cERROR and cFYI macros to a new use of cifs_dbg(type, fmt, ...)

cERROR(set, fmt, ...) -> cifs_dbg(VFS, fmt, ...)
cFYI(set, fmt, ...) -> cifs_dbg(FYI, fmt, ...)

This conversion would mark both these macros as debug stataments as they are only enabled with CONFIG_CIFS_DEBUG.

Also CONFIG_CIFS_DEBUG2 use of DBG could also be integrated with the same style.

cFYI(DBG2, fmt, ...) -> cifs_dbg(NOISY, fmt, ...)

The reduced object size would still apply.

This would also enable an easier conversion to dynamic debugging of these debug macros.

I'd prefer to move the newline from the macro to the format as that is more consistent with the rest of the kernel.

Thoughts?

#2 lore raw
Quoted 27 lines · On Wed, 13 Mar 2013 04:36:54 -0700 Joe Perches…
Quoted 7 lines · Joe Perches

The cERROR macro is always used as cERROR(1, and cifserror is just a printk(KERN_ERR "CIFS VFS: ".

Make a cifs_vfs_err function that uses the vsprintf %pV extension to avoid duplicating the "CIFS VFS: " prefix.

Remove the cERROR macro and use cifs_vfs_err directly.

Perhaps a better idea than this patch is to change both the cERROR and cFYI macros to a new use of cifs_dbg(type, fmt, ...)

cERROR(set, fmt, ...) -> cifs_dbg(VFS, fmt, ...)
cFYI(set, fmt, ...) -> cifs_dbg(FYI, fmt, ...)

This conversion would mark both these macros as debug stataments as they are only enabled with CONFIG_CIFS_DEBUG.

Also CONFIG_CIFS_DEBUG2 use of DBG could also be integrated with the same style.

cFYI(DBG2, fmt, ...) -> cifs_dbg(NOISY, fmt, ...)

The reduced object size would still apply.

Quoted 9 lines

This would also enable an easier conversion to dynamic debugging of these debug macros.

I'd prefer to move the newline from the macro to the format as that is more consistent with the rest of the kernel.

Thoughts?

I like this change overall, but the size of the patch is pretty daunting. If you could change the code that underlies cERROR() and cFYI() without needing to touch all of their call sites, it might be a simpler initial step.

OTOH, I would also prefer to move the newline into the format and that's impossible without touching most of these call sites.

Signature · 1 line
Jeff Layton <[email protected]>
#3 lore raw
Quoted 6 lines · Jeff Layton
Quoted 4 lines · On Wed, 13 Mar 2013 04:36:54 -0700 Joe Perches…

Perhaps a better idea than this patch is to change both the cERROR and cFYI macros to a new use of cifs_dbg(type, fmt, ...)

Quoted 6 lines
Quoted 6 lines

cERROR(set, fmt, ...) -> cifs_dbg(VFS, fmt, ...)
cFYI(set, fmt, ...) -> cifs_dbg(FYI, fmt, ...)

This conversion would mark both these macros as debug stataments as they are only enabled with CONFIG_CIFS_DEBUG.

[]

Quoted 6 lines
Quoted 6 lines

This would also enable an easier conversion to dynamic debugging of these debug macros.

I'd prefer to move the newline from the macro to the format as that is more consistent with the rest of the kernel.

[]

Quoted 2 lines

I like this change overall, but the size of the patch is pretty daunting.

I'd characterize it as more mechanically dull than daunting, but it is awfully large (~300 KB).

Quoted 3 lines

If you could change the code that underlies cERROR() and cFYI() without needing to touch all of their call sites, it might be a simpler initial step.

I think that would not help.

Quoted 2 lines

OTOH, I would also prefer to move the newline into the format and that's impossible without touching most of these call sites.

Well, all but the ones that already have a defective newline. I think there are 4 or 5.

The .ko size increases a few hundred bytes when the newlines are moved to the format, though it's still about a 1% overall size reduction.

There would be:

264 uses of cifs_dbg(VFS, ...)
622 uses of cifs_dbg(FYI, ...)
15 uses of cifs_dbg(NOISY, ...)

to verify. Using strings on the .ko simplifies that.

$ size fs/cifs/cifs.ko*
   text	   data	    bss	    dec	    hex	filename
 265891	   2525	    132	 268548	  41904	fs/cifs/cifs.ko.new
 268359	   2525	    132	 271016	  422a8	fs/cifs/cifs.ko.old

The core of it is to cifs_debug.h

---
 fs/cifs/cifs_debug.h | 70 +++++++++++++++++-----------------------------------
 1 file changed, 23 insertions(+), 47 deletions(-)
fs/cifs/cifs_debug.h +23 -47
index 69ae3d3..c99b40f 100644
@@ -25,18 +25,20 @@
 void cifs_dump_mem(char *label, void *data, int length);
 void cifs_dump_detail(void *);
 void cifs_dump_mids(struct TCP_Server_Info *);
-#ifdef CONFIG_CIFS_DEBUG2
-#define DBG2 2
-#else
-#define DBG2 0
-#endif
 extern int traceSMB;		/* flag which enables the function below */
 void dump_smb(void *, int);
 #define CIFS_INFO	0x01
 #define CIFS_RC		0x02
 #define CIFS_TIMER	0x04
 
+#define VFS 1
+#define FYI 2
 extern int cifsFYI;
+#ifdef CONFIG_CIFS_DEBUG2
+#define NOISY 4
+#else
+#define NOISY 0
+#endif
 
 /*
  *	debug ON
@@ -44,31 +46,21 @@ extern int cifsFYI;
  */
 #ifdef CONFIG_CIFS_DEBUG
 
-/* information message: e.g., configuration, major event */
-#define cifsfyi(fmt, ...)						\
-do {									\
-	if (cifsFYI & CIFS_INFO)					\
-		printk(KERN_DEBUG "%s: " fmt "\n",			\
-		       __FILE__, ##__VA_ARGS__);			\
-} while (0)
-
-#define cFYI(set, fmt, ...)						\
-do {									\
-	if (set)							\
-		cifsfyi(fmt, ##__VA_ARGS__);				\
-} while (0)
+__printf(1, 2) void cifs_vfs_err(const char *fmt, ...);
 
-#define cifswarn(fmt, ...)						\
-	printk(KERN_WARNING fmt "\n", ##__VA_ARGS__)
-
-/* error event message: e.g., i/o error */
-#define cifserror(fmt, ...)						\
-	printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__);		\
-
-#define cERROR(set, fmt, ...)						\
+/* information message: e.g., configuration, major event */
+#define cifs_dbg(type, fmt, ...)					\
 do {									\
-	if (set)							\
-		cifserror(fmt, ##__VA_ARGS__);				\
+	if (type == FYI) {						\
+		if (cifsFYI & CIFS_INFO) {				\
+			printk(KERN_DEBUG "%s: " fmt,			\
+			       __FILE__, ##__VA_ARGS__);		\
+		}							\
+	} else if (type == VFS) {					\
+		cifs_vfs_err(fmt, ##__VA_ARGS__);			\
+	} else if (type == NOISY && type != 0) {			\
+		printk(KERN_DEBUG fmt, ##__VA_ARGS__);			\
+	}								\
 } while (0)
 
 /*
@@ -76,27 +68,11 @@ do {									\
  *	---------
  */
 #else		/* _CIFS_DEBUG */
-#define cifsfyi(fmt, ...)						\
+#define cifs_dbg(type, fmt, ...)					\
 do {									\
 	if (0)								\
-		printk(KERN_DEBUG "%s: " fmt "\n",			\
-		       __FILE__, ##__VA_ARGS__);			\
+		printk(KERN_DEBUG fmt, ##__VA_ARGS__);			\
 } while (0)
-#define cFYI(set, fmt, ...)						\
-do {									\
-	if (0 && set)							\
-		cifsfyi(fmt, ##__VA_ARGS__);				\
-} while (0)
-#define cifserror(fmt, ...)						\
-do {									\
-	if (0)								\
-		printk(KERN_ERR "CIFS VFS: " fmt "\n", ##__VA_ARGS__);	\
-} while (0)
-#define cERROR(set, fmt, ...)						\
-do {									\
-	if (0 && set)							\
-		cifserror(fmt, ##__VA_ARGS__);				\
-} while (0)
-#endif		/* _CIFS_DEBUG */
+#endif
 
 #endif				/* _H_CIFS_DEBUG */
#4 lore raw

Re: [PATCH] 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

---
 fs/cifs/asn1.c          |  68 +++----
 fs/cifs/cache.c         |   6 +-
 fs/cifs/cifs_debug.c    |  67 ++++---
 fs/cifs/cifs_debug.h    |  70 +++----
 fs/cifs/cifs_dfs_ref.c  |  41 ++--
 fs/cifs/cifs_spnego.c   |   2 +-
 fs/cifs/cifs_unicode.c  |   4 +-
 fs/cifs/cifsacl.c       | 127 ++++++-------
 fs/cifs/cifsencrypt.c   | 102 +++++-----
 fs/cifs/cifsfs.c        |  36 ++--
 fs/cifs/cifsproto.h     |  10 +-
 fs/cifs/cifssmb.c       | 483 ++++++++++++++++++++++++------------------------
 fs/cifs/connect.c       | 310 +++++++++++++++----------------
 fs/cifs/dir.c           |  44 ++---
 fs/cifs/dns_resolve.c   |  17 +-
 fs/cifs/export.c        |   2 +-
 fs/cifs/file.c          | 166 ++++++++---------
 fs/cifs/fscache.c       |  58 +++---
 fs/cifs/inode.c         | 109 +++++------
 fs/cifs/ioctl.c         |   6 +-
 fs/cifs/link.c          |  24 +--
 fs/cifs/misc.c          |  78 ++++----
 fs/cifs/netmisc.c       |  16 +-
 fs/cifs/readdir.c       |  77 ++++----
 fs/cifs/sess.c          |  73 ++++----
 fs/cifs/smb1ops.c       |  47 ++---
 fs/cifs/smb2file.c      |   8 +-
 fs/cifs/smb2inode.c     |   2 +-
 fs/cifs/smb2maperror.c  |   2 +-
 fs/cifs/smb2misc.c      |  96 +++++-----
 fs/cifs/smb2ops.c       |  16 +-
 fs/cifs/smb2pdu.c       | 157 ++++++++--------
 fs/cifs/smb2transport.c |  26 +--
 fs/cifs/smbencrypt.c    |  17 +-
 fs/cifs/transport.c     |  61 +++---
 fs/cifs/xattr.c         |  54 +++---
 36 files changed, 1237 insertions(+), 1245 deletions(-)
fs/cifs/asn1.c +34 -34
index cfd1ce3..ea5bb2e 100644
@@ -506,11 +506,11 @@ decode_negTokenInit(unsigned char *security_blob, int length,
 
 	/* GSSAPI header */
 	if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
-		cFYI(1, "Error decoding negTokenInit header");
+		cifs_dbg(FYI, "Error decoding negTokenInit header\n");
 		return 0;
 	} else if ((cls != ASN1_APL) || (con != ASN1_CON)
 		   || (tag != ASN1_EOC)) {
-		cFYI(1, "cls = %d con = %d tag = %d", cls, con, tag);
+		cifs_dbg(FYI, "cls = %d con = %d tag = %d\n", cls, con, tag);
 		return 0;
 	}
 
@@ -531,52 +531,52 @@ decode_negTokenInit(unsigned char *security_blob, int length,
 
 	/* SPNEGO OID not present or garbled -- bail out */
 	if (!rc) {
-		cFYI(1, "Error decoding negTokenInit header");
+		cifs_dbg(FYI, "Error decoding negTokenInit header\n");
 		return 0;
 	}
 
 	/* SPNEGO */
 	if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
-		cFYI(1, "Error decoding negTokenInit");
+		cifs_dbg(FYI, "Error decoding negTokenInit\n");
 		return 0;
 	} else if ((cls != ASN1_CTX) || (con != ASN1_CON)
 		   || (tag != ASN1_EOC)) {
-		cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 0",
-		     cls, con, tag, end, *end);
+		cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 0\n",
+			 cls, con, tag, end, *end);
 		return 0;
 	}
 
 	/* negTokenInit */
 	if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
-		cFYI(1, "Error decoding negTokenInit");
+		cifs_dbg(FYI, "Error decoding negTokenInit\n");
 		return 0;
 	} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
 		   || (tag != ASN1_SEQ)) {
-		cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 1",
-		     cls, con, tag, end, *end);
+		cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 1\n",
+			 cls, con, tag, end, *end);
 		return 0;
 	}
 
 	/* sequence */
 	if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
-		cFYI(1, "Error decoding 2nd part of negTokenInit");
+		cifs_dbg(FYI, "Error decoding 2nd part of negTokenInit\n");
 		return 0;
 	} else if ((cls != ASN1_CTX) || (con != ASN1_CON)
 		   || (tag != ASN1_EOC)) {
-		cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 0",
-		     cls, con, tag, end, *end);
+		cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 0\n",
+			 cls, con, tag, end, *end);
 		return 0;
 	}
 
 	/* sequence of */
 	if (asn1_header_decode
 	    (&ctx, &sequence_end, &cls, &con, &tag) == 0) {
-		cFYI(1, "Error decoding 2nd part of negTokenInit");
+		cifs_dbg(FYI, "Error decoding 2nd part of negTokenInit\n");
 		return 0;
 	} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
 		   || (tag != ASN1_SEQ)) {
-		cFYI(1, "cls = %d con = %d tag = %d end = %p (%d) exit 1",
-		     cls, con, tag, end, *end);
+		cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 1\n",
+			 cls, con, tag, end, *end);
 		return 0;
 	}
 
@@ -584,15 +584,15 @@ decode_negTokenInit(unsigned char *security_blob, int length,
 	while (!asn1_eoc_decode(&ctx, sequence_end)) {
 		rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
 		if (!rc) {
-			cFYI(1, "Error decoding negTokenInit hdr exit2");
+			cifs_dbg(FYI, "Error decoding negTokenInit hdr exit2\n");
 			return 0;
 		}
 		if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
 			if (asn1_oid_decode(&ctx, end, &oid, &oidlen)) {
 
-				cFYI(1, "OID len = %d oid = 0x%lx 0x%lx "
-					"0x%lx 0x%lx", oidlen, *oid,
-					*(oid + 1), *(oid + 2), *(oid + 3));
+				cifs_dbg(FYI, "OID len = %d oid = 0x%lx 0x%lx 0x%lx 0x%lx\n",
+					 oidlen, *oid, *(oid + 1), *(oid + 2),
+					 *(oid + 3));
 
 				if (compare_oid(oid, oidlen, MSKRB5_OID,
 						MSKRB5_OID_LEN))
@@ -610,7 +610,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
 				kfree(oid);
 			}
 		} else {
-			cFYI(1, "Should be an oid what is going on?");
+			cifs_dbg(FYI, "Should be an oid what is going on?\n");
 		}
 	}
 
@@ -620,47 +620,47 @@ decode_negTokenInit(unsigned char *security_blob, int length,
 		   no mechListMic (e.g. NTLMSSP instead of KRB5) */
 		if (ctx.error == ASN1_ERR_DEC_EMPTY)
 			goto decode_negtoken_exit;
-		cFYI(1, "Error decoding last part negTokenInit exit3");
+		cifs_dbg(FYI, "Error decoding last part negTokenInit exit3\n");
 		return 0;
 	} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
 		/* tag = 3 indicating mechListMIC */
-		cFYI(1, "Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
-			cls, con, tag, end, *end);
+		cifs_dbg(FYI, "Exit 4 cls = %d con = %d tag = %d end = %p (%d)\n",
+			 cls, con, tag, end, *end);
 		return 0;
 	}
 
 	/* sequence */
 	if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
-		cFYI(1, "Error decoding last part negTokenInit exit5");
+		cifs_dbg(FYI, "Error decoding last part negTokenInit exit5\n");
 		return 0;
 	} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
 		   || (tag != ASN1_SEQ)) {
-		cFYI(1, "cls = %d con = %d tag = %d end = %p (%d)",
-			cls, con, tag, end, *end);
+		cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d)\n",
+			 cls, con, tag, end, *end);
 	}
 
 	/* sequence of */
 	if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
-		cFYI(1, "Error decoding last part negTokenInit exit 7");
+		cifs_dbg(FYI, "Error decoding last part negTokenInit exit7\n");
 		return 0;
 	} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
-		cFYI(1, "Exit 8 cls = %d con = %d tag = %d end = %p (%d)",
-			cls, con, tag, end, *end);
+		cifs_dbg(FYI, "Exit 8 cls = %d con = %d tag = %d end = %p (%d)\n",
+			 cls, con, tag, end, *end);
 		return 0;
 	}
 
 	/* general string */
 	if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
-		cFYI(1, "Error decoding last part negTokenInit exit9");
+		cifs_dbg(FYI, "Error decoding last part negTokenInit exit9\n");
 		return 0;
 	} else if ((cls != ASN1_UNI) || (con != ASN1_PRI)
 		   || (tag != ASN1_GENSTR)) {
-		cFYI(1, "Exit10 cls = %d con = %d tag = %d end = %p (%d)",
-			cls, con, tag, end, *end);
+		cifs_dbg(FYI, "Exit10 cls = %d con = %d tag = %d end = %p (%d)\n",
+			 cls, con, tag, end, *end);
 		return 0;
 	}
-	cFYI(1, "Need to call asn1_octets_decode() function for %s",
-		ctx.pointer);	/* is this UTF-8 or ASCII? */
+	cifs_dbg(FYI, "Need to call asn1_octets_decode() function for %s\n",
+		 ctx.pointer);	/* is this UTF-8 or ASCII? */
 decode_negtoken_exit:
 	return 1;
 }
fs/cifs/cache.c +3 -3
index 282d6de..6c665bf 100644
@@ -92,7 +92,7 @@ static uint16_t cifs_server_get_key(const void *cookie_netfs_data,
 		break;
 
 	default:
-		cERROR(1, "Unknown network family '%d'", sa->sa_family);
+		cifs_dbg(VFS, "Unknown network family '%d'\n", sa->sa_family);
 		key_len = 0;
 		break;
 	}
@@ -152,7 +152,7 @@ static uint16_t cifs_super_get_key(const void *cookie_netfs_data, void *buffer,
 
 	sharename = extract_sharename(tcon->treeName);
 	if (IS_ERR(sharename)) {
-		cFYI(1, "%s: couldn't extract sharename", __func__);
+		cifs_dbg(FYI, "%s: couldn't extract sharename\n", __func__);
 		sharename = NULL;
 		return 0;
 	}
@@ -302,7 +302,7 @@ static void cifs_fscache_inode_now_uncached(void *cookie_netfs_data)
 	pagevec_init(&pvec, 0);
 	first = 0;
 
-	cFYI(1, "%s: cifs inode 0x%p now uncached", __func__, cifsi);
+	cifs_dbg(FYI, "%s: cifs inode 0x%p now uncached\n", __func__, cifsi);
 
 	for (;;) {
 		nr_pages = pagevec_lookup(&pvec,
fs/cifs/cifs_debug.c +42 -25

114 lines not on this page · raw message

fs/cifs/cifs_debug.h +23 -47

99 lines not on this page · raw message

fs/cifs/cifs_dfs_ref.c +21 -20

103 lines not on this page · raw message

fs/cifs/cifs_spnego.c +1 -1
index 10e7747..c557bf1 100644
@@ -164,7 +164,7 @@ cifs_get_spnego_key(struct cifs_ses *sesInfo)
 	dp = description + strlen(description);
 	sprintf(dp, ";pid=0x%x", current->pid);
 
-	cFYI(1, "key description = %s", description);
+	cifs_dbg(FYI, "key description = %s\n", description);
 	spnego_key = request_key(&cifs_spnego_key_type, description, "");
 
 #ifdef CONFIG_CIFS_DEBUG2
fs/cifs/cifs_unicode.c +2 -2
index 71d5d0a..0227b45 100644
@@ -227,8 +227,8 @@ cifs_strtoUTF16(__le16 *to, const char *from, int len,
 	for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
 		charlen = codepage->char2uni(from, len, &wchar_to);
 		if (charlen < 1) {
-			cERROR(1, "strtoUTF16: char2uni of 0x%x returned %d",
-				*from, charlen);
+			cifs_dbg(VFS, "strtoUTF16: char2uni of 0x%x returned %d\n",
+				 *from, charlen);
 			/* A question mark */
 			wchar_to = 0x003f;
 			charlen = 1;
fs/cifs/cifsacl.c +64 -63

361 lines not on this page · raw message

fs/cifs/cifsencrypt.c +49 -53

365 lines not on this page · raw message

fs/cifs/cifsfs.c +21 -15
index 1a052c0..a3adf7a 100644
@@ -137,7 +137,7 @@ cifs_read_super(struct super_block *sb)
 
 #ifdef CONFIG_CIFS_NFSD_EXPORT
 	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
-		cFYI(1, "export ops supported");
+		cifs_dbg(FYI, "export ops supported\n");
 		sb->s_export_op = &cifs_export_ops;
 	}
 #endif /* CONFIG_CIFS_NFSD_EXPORT */
@@ -145,7 +145,7 @@ cifs_read_super(struct super_block *sb)
 	return 0;
 
 out_no_root:
-	cERROR(1, "cifs_read_super: get root inode failed");
+	cifs_dbg(VFS, "%s: get root inode failed\n", __func__);
 	return rc;
 }
 
@@ -478,7 +478,7 @@ static void cifs_umount_begin(struct super_block *sb)
 	/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
 	/* cancel_notify_requests(tcon); */
 	if (tcon->ses && tcon->ses->server) {
-		cFYI(1, "wake up tasks now - umount begin not complete");
+		cifs_dbg(FYI, "wake up tasks now - umount begin not complete\n");
 		wake_up_all(&tcon->ses->server->request_q);
 		wake_up_all(&tcon->ses->server->response_q);
 		msleep(1); /* yield */
@@ -549,7 +549,7 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
 	if (full_path == NULL)
 		return ERR_PTR(-ENOMEM);
 
-	cFYI(1, "Get root dentry for %s", full_path);
+	cifs_dbg(FYI, "Get root dentry for %s\n", full_path);
 
 	sep = CIFS_DIR_SEP(cifs_sb);
 	dentry = dget(sb->s_root);
@@ -608,7 +608,7 @@ cifs_do_mount(struct file_system_type *fs_type,
 	struct cifs_mnt_data mnt_data;
 	struct dentry *root;
 
-	cFYI(1, "Devname: %s flags: %d ", dev_name, flags);
+	cifs_dbg(FYI, "Devname: %s flags: %d\n", dev_name, flags);
 
 	volume_info = cifs_get_volume_info((char *)data, dev_name);
 	if (IS_ERR(volume_info))
@@ -631,7 +631,8 @@ cifs_do_mount(struct file_system_type *fs_type,
 	rc = cifs_mount(cifs_sb, volume_info);
 	if (rc) {
 		if (!(flags & MS_SILENT))
-			cERROR(1, "cifs_mount failed w/return code = %d", rc);
+			cifs_dbg(VFS, "cifs_mount failed w/return code = %d\n",
+				 rc);
 		root = ERR_PTR(rc);
 		goto out_mountdata;
 	}
@@ -651,7 +652,7 @@ cifs_do_mount(struct file_system_type *fs_type,
 	}
 
 	if (sb->s_root) {
-		cFYI(1, "Use existing superblock");
+		cifs_dbg(FYI, "Use existing superblock\n");
 		cifs_umount(cifs_sb);
 	} else {
 		rc = cifs_read_super(sb);
@@ -667,7 +668,7 @@ cifs_do_mount(struct file_system_type *fs_type,
 	if (IS_ERR(root))
 		goto out_super;
 
-	cFYI(1, "dentry root is: %p", root);
+	cifs_dbg(FYI, "dentry root is: %p\n", root);
 	goto out;
 
 out_super:
@@ -699,7 +700,8 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
 
 	rc = filemap_fdatawrite(inode->i_mapping);
 	if (rc)
-		cFYI(1, "cifs_file_aio_write: %d rc on %p inode", rc, inode);
+		cifs_dbg(FYI, "cifs_file_aio_write: %d rc on %p inode\n",
+			 rc, inode);
 
 	return written;
 }
@@ -1005,7 +1007,10 @@ cifs_init_request_bufs(void)
 	} else {
 		CIFSMaxBufSize &= 0x1FE00; /* Round size to even 512 byte mult*/
 	}
-/*	cERROR(1, "CIFSMaxBufSize %d 0x%x",CIFSMaxBufSize,CIFSMaxBufSize); */
+/*
+	cifs_dbg(VFS, "CIFSMaxBufSize %d 0x%x\n",
+		 CIFSMaxBufSize, CIFSMaxBufSize);
+*/
 	cifs_req_cachep = kmem_cache_create("cifs_request",
 					    CIFSMaxBufSize + max_hdr_size, 0,
 					    SLAB_HWCACHE_ALIGN, NULL);
@@ -1016,7 +1021,7 @@ cifs_init_request_bufs(void)
 		cifs_min_rcv = 1;
 	else if (cifs_min_rcv > 64) {
 		cifs_min_rcv = 64;
-		cERROR(1, "cifs_min_rcv set to maximum (64)");
+		cifs_dbg(VFS, "cifs_min_rcv set to maximum (64)\n");
 	}
 
 	cifs_req_poolp = mempool_create_slab_pool(cifs_min_rcv,
@@ -1047,7 +1052,7 @@ cifs_init_request_bufs(void)
 		cifs_min_small = 2;
 	else if (cifs_min_small > 256) {
 		cifs_min_small = 256;
-		cFYI(1, "cifs_min_small set to maximum (256)");
+		cifs_dbg(FYI, "cifs_min_small set to maximum (256)\n");
 	}
 
 	cifs_sm_req_poolp = mempool_create_slab_pool(cifs_min_small,
@@ -1138,10 +1143,11 @@ init_cifs(void)
 
 	if (cifs_max_pending < 2) {
 		cifs_max_pending = 2;
-		cFYI(1, "cifs_max_pending set to min of 2");
+		cifs_dbg(FYI, "cifs_max_pending set to min of 2\n");
 	} else if (cifs_max_pending > CIFS_MAX_REQ) {
 		cifs_max_pending = CIFS_MAX_REQ;
-		cFYI(1, "cifs_max_pending set to max of %u", CIFS_MAX_REQ);
+		cifs_dbg(FYI, "cifs_max_pending set to max of %u\n",
+			 CIFS_MAX_REQ);
 	}
 
 	cifsiod_wq = alloc_workqueue("cifsiod", WQ_FREEZABLE|WQ_MEM_RECLAIM, 0);
@@ -1210,7 +1216,7 @@ out_clean_proc:
 static void __exit
 exit_cifs(void)
 {
-	cFYI(DBG2, "exit_cifs");
+	cifs_dbg(NOISY, "exit_cifs\n");
 	unregister_filesystem(&cifs_fs_type);
 	cifs_dfs_release_automount_timer();
 #ifdef CONFIG_CIFS_ACL
fs/cifs/cifsproto.h +5 -5
index f450f06..dda188a 100644
@@ -45,17 +45,17 @@ extern void _free_xid(unsigned int);
 #define get_xid()						\
 ({								\
 	unsigned int __xid = _get_xid();				\
-	cFYI(1, "CIFS VFS: in %s as Xid: %u with uid: %d",	\
-	     __func__, __xid,					\
-	     from_kuid(&init_user_ns, current_fsuid()));	\
+	cifs_dbg(FYI, "CIFS VFS: in %s as Xid: %u with uid: %d\n",	\
+		 __func__, __xid,					\
+		 from_kuid(&init_user_ns, current_fsuid()));		\
 	__xid;							\
 })
 
 #define free_xid(curr_xid)					\
 do {								\
 	_free_xid(curr_xid);					\
-	cFYI(1, "CIFS VFS: leaving %s (xid = %u) rc = %d",	\
-	     __func__, curr_xid, (int)rc);			\
+	cifs_dbg(FYI, "CIFS VFS: leaving %s (xid = %u) rc = %d\n",	\
+		 __func__, curr_xid, (int)rc);				\
 } while (0)
 extern int init_cifs_idmap(void);
 extern void exit_cifs_idmap(void);
fs/cifs/cifssmb.c +244 -239

1,556 lines not on this page · raw message

fs/cifs/connect.c +149 -161

50 lines not on this page · raw message

fs/cifs/dir.c +23 -21

44 lines not on this page · raw message

fs/cifs/dns_resolve.c +9 -8
index 1d2d91d..e7512e4 100644

Lines of this file are not shown. View the raw message.

fs/cifs/export.c +1 -1
index 9c7ecdc..ce8b7f6 100644

Lines of this file are not shown. View the raw message.

fs/cifs/file.c +81 -85

166 lines not on this page · raw message

fs/cifs/fscache.c +29 -29

58 lines not on this page · raw message

fs/cifs/inode.c +57 -52

109 lines not on this page · raw message

fs/cifs/ioctl.c +3 -3
index 6c9f121..3e08455 100644

Lines of this file are not shown. View the raw message.

fs/cifs/link.c +12 -12
index 9f6c4c4..b83c3f5 100644

Lines of this file are not shown. View the raw message.

fs/cifs/misc.c +37 -41

78 lines not on this page · raw message

fs/cifs/netmisc.c +8 -8
index a82bc51..aefe8b4 100644

Lines of this file are not shown. View the raw message.

fs/cifs/readdir.c +38 -39

77 lines not on this page · raw message

fs/cifs/sess.c +37 -36

73 lines not on this page · raw message

fs/cifs/smb1ops.c +24 -23

47 lines not on this page · raw message

fs/cifs/smb2file.c +4 -4
index 71e6aed..5da1b55 100644

Lines of this file are not shown. View the raw message.

fs/cifs/smb2inode.c +1 -1
index 7064824..fff6dfb 100644

Lines of this file are not shown. View the raw message.

fs/cifs/smb2maperror.c +1 -1
index 494c912..7c2f45c 100644

Lines of this file are not shown. View the raw message.

fs/cifs/smb2misc.c +48 -48

96 lines not on this page · raw message

fs/cifs/smb2ops.c +8 -8
index bceffe7..f2e76f3 100644

Lines of this file are not shown. View the raw message.

fs/cifs/smb2pdu.c +79 -78

157 lines not on this page · raw message

fs/cifs/smb2transport.c +13 -13
index 8dd73e6..01f0ac8 100644

Lines of this file are not shown. View the raw message.

fs/cifs/smbencrypt.c +9 -8
index a0a58fb..43eb136 100644

Lines of this file are not shown. View the raw message.

fs/cifs/transport.c +31 -30

61 lines not on this page · raw message

fs/cifs/xattr.c +26 -28

54 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.8.1.2.459.gbcd45b4.dirty

Part of the diff is not shown here. View the raw message.

#5 lore raw

Re: [PATCH] cifs: Rename cERROR and cFYI to cifs_dbg

Quoted 13 lines · On Thu, 14 Mar 2013 12:24:37 -0700 Joe Perches <[email protected]> wrote:

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.

Quoted 7 lines

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

This all looks like good stuff. I am a bit concerned about mashing all of these cleanups into the same patch though.

Quoted 14 lines

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

Signature · 1 line
Jeff Layton <[email protected]>
Acked-by
#6 lore raw

Re: [PATCH] cifs: Rename cERROR and cFYI to cifs_dbg

In reply to Joe Perches
Quoted 13 lines · On Thu, 14 Mar 2013 12:24:37 -0700 Joe Perches…

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.

Quoted 7 lines

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

(my apologies -- my MUA has a mind of its own sometimes)

This all looks like good stuff. I am a bit concerned about mashing all of these cleanups into the same patch though.

Quoted 12 lines

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

Quoted 1 line

o Convert kzalloc with multiply to kcalloc

	^^^

Things like this really ought to be a separate patch, even though it is a trivial change. That's a minor nit though...

Quoted 2 lines

o Remove unused cifswarn macro

I think we ought to go ahead and take this for 3.10. I do have some minor concern about having to deal with backports of later patches to kernels that don't have these changes, but hey, that's the price of dealing with old kernels.

The sooner Steve merges this into his for-next tree, the better. This bound to give us all sorts of merge conflicts for the 3.10 window, so we want to make sure that people know what to base their work on.

A message that is not in the archive (sent off-list or not yet received): CAH2r5mvW29FV+stH5CsjY5S2FdaHn48TfiSEk_beC=NzHC7-MQ@mail.gmail.com

#8 lore raw

Re: [PATCH] cifs: Rename cERROR and cFYI to cifs_dbg

Quoted 7 lines · Steve French

I would like to merge the three we have (one still has to be put in for-next - the one from Jeff) for for-next in the next three or fouir days - but I can create another temporary branch for the ones for 3.10
- but ... I would like to simplify things by merging the other cleanup patches we already have first. I agree that we are going to have to let people know to rebase everything for cifs for 3.10 on this big cleanup patch.

Another possibility is to extend the
cifs_dbg(type, fmt. ...) types from

VFS, FYI, NOISY

so that the messages could be
filtered/classified better.

Also, perhaps it'd be better to use
pr_debug instead of KERN_ERR for
the VFS messages.

#9 lore raw

Re: [PATCH] cifs: Rename cERROR and cFYI to cifs_dbg

Quoted 13 lines · Joe Perches
Quoted 7 lines · Steve French

I would like to merge the three we have (one still has to be put in for-next - the one from Jeff) for for-next in the next three or fouir days - but I can create another temporary branch for the ones for 3.10
- but ... I would like to simplify things by merging the other cleanup patches we already have first. I agree that we are going to have to let people know to rebase everything for cifs for 3.10 on this big cleanup patch.

Another possibility is to extend the
cifs_dbg(type, fmt. ...) types from

Quoted 8 lines

VFS, FYI, NOISY

so that the messages could be
filtered/classified better.

Also, perhaps it'd be better to use
pr_debug instead of KERN_ERR for
the VFS messages.

Although it required hand merging, this large patch is now merged into cifs-2.6.git (for-next branch, destined for 3.10) but ... I only merged three obvious other patches (destined for 3.10) before it

4521ba9ca4138f424769f17ae7166ff5ccf08805 fs: cifs: use kmemdup instead of kmalloc + memcpy 41057e5a5d673015fc0d0e587e993d26f1818b1c cifs: replaced kmalloc + memset with kzalloc 8f43465d17982767dd5b3f5d48216ef5c100c274 cifs: ignore the unc= and prefixpath= mount options

and I merged one so far after it that Jeff had already rebased ontop of Joe's large patch

457d2157ec2da6f9fa755e16ab740979f581e328 cifs: remove ENOSPC handling in smb_sendv

So ... going forward for 3.10 make sure to fixup subsequent new cifs patches ontop Joe's large "cifs: Rename cERROR and cFYI to cifs_dbg" patch or else it will make merging a mess since Joe's patch changes just about very cifs file due to the macro renaming.

Signature · 3 lines
Thanks,

Steve
#10 lore raw

PATCH 1/1 cifs: Rename cERROR and cFYI to cifs_dbg

In reply to a message not in the archive
Quoted 50 lines · Jeff Layton
Quoted 13 lines · On Thu, 14 Mar 2013 12:24:37 -0700 Joe Perches…

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.

Quoted 7 lines

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

(my apologies -- my MUA has a mind of its own sometimes)

This all looks like good stuff. I am a bit concerned about mashing all of these cleanups into the same patch though.

Quoted 12 lines

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

Quoted 1 line

o Convert kzalloc with multiply to kcalloc

        ^^^

Things like this really ought to be a separate patch, even though it is a trivial change. That's a minor nit though...

Quoted 2 lines

o Remove unused cifswarn macro

Quoted 8 lines

I think we ought to go ahead and take this for 3.10. I do have some minor concern about having to deal with backports of later patches to kernels that don't have these changes, but hey, that's the price of dealing with old kernels.

The sooner Steve merges this into his for-next tree, the better. This bound to give us all sorts of merge conflicts for the 3.10 window, so we want to make sure that people know what to base their work on.

I would like to merge the three we have (one still has to be put in for-next
- the one from Jeff) for for-next in the next three or fouir days - but I can create another temporary branch for the ones for 3.10 - but ... I would like to simplify things by merging the other cleanup patches we already have first. I agree that we are going to have to let people know to rebase everything for cifs for 3.10 on this big cleanup patch.

--
Thanks,

Steve

--
Thanks,

Steve