Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Oct 2012 21:55:38 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r241201 - in stable/8/sys/fs: nfs nfsclient
Message-ID:  <201210042155.q94LtcvO030619@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Thu Oct  4 21:55:37 2012
New Revision: 241201
URL: http://svn.freebsd.org/changeset/base/241201

Log:
  MFC: r240289
  Add a simple printf() based debug facility to the new nfs client.
  Use it for a printf() that can be harmlessly generated for mmap()'d
  files. It will be used extensively for the NFSv4.1 client.
  Debugging printf()s are enabled by setting vfs.nfs.debuglevel to
  a non-zero value. The higher the value, the more debugging printf()s.

Modified:
  stable/8/sys/fs/nfs/nfs_commonport.c
  stable/8/sys/fs/nfs/nfscl.h
  stable/8/sys/fs/nfsclient/nfs_clrpcops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/fs/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs_commonport.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonport.c	Thu Oct  4 21:08:46 2012	(r241200)
+++ stable/8/sys/fs/nfs/nfs_commonport.c	Thu Oct  4 21:55:37 2012	(r241201)
@@ -61,6 +61,7 @@ struct mount nfsv4root_mnt;
 int newnfs_numnfsd = 0;
 struct nfsstats newnfsstats;
 int nfs_numnfscbd = 0;
+int nfscl_debuglevel = 0;
 char nfsv4_callbackaddr[INET6_ADDRSTRLEN];
 struct callout newnfsd_callout;
 void (*nfsd_call_servertimer)(void) = NULL;
@@ -79,6 +80,8 @@ SYSCTL_INT(_vfs_newnfs, OID_AUTO, nfs4ac
 SYSCTL_STRING(_vfs_newnfs, OID_AUTO, callback_addr, CTLFLAG_RW,
     nfsv4_callbackaddr, sizeof(nfsv4_callbackaddr),
     "NFSv4 callback addr for server to use");
+SYSCTL_INT(_vfs_newnfs, OID_AUTO, debuglevel, CTLFLAG_RW, &nfscl_debuglevel,
+    0, "Debug level for new nfs client");
 
 /*
  * Defines for malloc

Modified: stable/8/sys/fs/nfs/nfscl.h
==============================================================================
--- stable/8/sys/fs/nfs/nfscl.h	Thu Oct  4 21:08:46 2012	(r241200)
+++ stable/8/sys/fs/nfs/nfscl.h	Thu Oct  4 21:55:37 2012	(r241201)
@@ -68,4 +68,10 @@ struct nfsv4node {
 #define	NFSSATTR_SIZENEG1	0x4
 #define	NFSSATTR_SIZERDEV	0x8
 
+/* Use this macro for debug printfs. */
+#define	NFSCL_DEBUG(level, ...)	do {					\
+		if (nfscl_debuglevel >= (level))			\
+			printf(__VA_ARGS__);				\
+	} while (0)
+
 #endif	/* _NFS_NFSCL_H */

Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Thu Oct  4 21:08:46 2012	(r241200)
+++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Thu Oct  4 21:55:37 2012	(r241201)
@@ -56,6 +56,7 @@ extern u_int32_t newnfs_false, newnfs_tr
 extern nfstype nfsv34_type[9];
 extern int nfsrv_useacl;
 extern char nfsv4_callbackaddr[INET6_ADDRSTRLEN];
+extern int nfscl_debuglevel;
 NFSCLSTATEMUTEX;
 int nfstest_outofseq = 0;
 int nfscl_assumeposixlocks = 1;
@@ -1398,7 +1399,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio
 			if (stateid.other[0] == 0 && stateid.other[1] == 0 &&
 			    stateid.other[2] == 0) {
 				nostateid = 1;
-				printf("stateid0 in write\n");
+				NFSCL_DEBUG(1, "stateid0 in write\n");
 			}
 		}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210042155.q94LtcvO030619>