[Ocfs2-commits] jlbec commits r960 - in trunk/src: . inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Jun 1 16:56:32 CDT 2004


Author: jlbec
Date: 2004-06-01 15:56:30 -0500 (Tue, 01 Jun 2004)
New Revision: 960

Added:
   trunk/src/inc/ocfs_log.h
Modified:
   trunk/src/
   trunk/src/alloc.c
   trunk/src/bitmap.c
   trunk/src/dcache.c
   trunk/src/dir.c
   trunk/src/dlm.c
   trunk/src/extmap.c
   trunk/src/file.c
   trunk/src/hash.c
   trunk/src/heartbeat.c
   trunk/src/inc/ocfs.h
   trunk/src/inode.c
   trunk/src/io.c
   trunk/src/ioctl.c
   trunk/src/journal.c
   trunk/src/lockres.c
   trunk/src/namei.c
   trunk/src/nm.c
   trunk/src/proc.c
   trunk/src/super.c
   trunk/src/symlink.c
   trunk/src/sysfile.c
   trunk/src/util.c
   trunk/src/ver.c
   trunk/src/volcfg.c
   trunk/src/vote.c
Log:

Moved logging functionality to ocfs_log.h (where it belongs).
Fixed up C files to reflect this.




Property changes on: trunk/src
___________________________________________________________________
Name: svn:ignore
   - cscope*
.*.sw?
stamp-md5

   + cscope*
stamp-md5
.*.sw?
.*.cmd
*.ko
ocfs2.mod.c
.tmp_versions


Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/alloc.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -25,6 +25,9 @@
  */
 
 #ifdef __KERNEL__
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 #else
 #include <debugocfs.h>

Modified: trunk/src/bitmap.c
===================================================================
--- trunk/src/bitmap.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/bitmap.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -25,6 +25,9 @@
  */
 
 #if defined(__KERNEL__)
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 #else
 #include  <asm/bitops.h>

Modified: trunk/src/dcache.c
===================================================================
--- trunk/src/dcache.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/dcache.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_DCACHE

Modified: trunk/src/dir.c
===================================================================
--- trunk/src/dir.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/dir.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_DIR

Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/dlm.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 extern __u32 comm_voting;

Modified: trunk/src/extmap.c
===================================================================
--- trunk/src/extmap.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/extmap.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_EXTMAP

Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/file.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_FILE
 

Modified: trunk/src/hash.c
===================================================================
--- trunk/src/hash.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/hash.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 

Modified: trunk/src/heartbeat.c
===================================================================
--- trunk/src/heartbeat.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/heartbeat.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -25,6 +25,9 @@
  */
 
 #if !defined(USERSPACE_TOOL)
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 #endif
 

Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/inc/ocfs.h	2004-06-01 20:56:30 UTC (rev 960)
@@ -822,290 +822,6 @@
 #endif
 #define OCFS_SB(sb)	    ((ocfs_super *)OCFS_GENERIC_SB_MEMBER(sb))
 
-extern __u32 debug_context;
-extern __u32 debug_level;
-extern __u32 debug_exclude;
-
-
-
-/* Tracing Levels */
-#define OCFS_DEBUG_LEVEL_ERROR         0x00000001
-#define OCFS_DEBUG_LEVEL_TRACE         0x00000002
-
-#define OCFS_DEBUG_LEVEL_ENTRY         0x00000010
-#define OCFS_DEBUG_LEVEL_EXIT          0x00000020
-
-#define OCFS_DEBUG_LEVEL_TIMING        0x00000100
-#define OCFS_DEBUG_LEVEL_STACK         0x00000200
-
-#define OCFS_DEBUG_LEVEL_PRINTK        0x00001000
-#define OCFS_DEBUG_LEVEL_MALLOC        0x00002000
-
-/* Tracing Contexts */
-#define OCFS_DEBUG_CONTEXT_ALLOC       0x00000001	/* alloc.c    */
-#define OCFS_DEBUG_CONTEXT_DIR         0x00000002	/* dir.c      */
-#define OCFS_DEBUG_CONTEXT_EXTMAP      0x00000004	/* extmap.c   */
-#define OCFS_DEBUG_CONTEXT_HEARTBEAT   0x00000008	/* hearbeat.c */
-#define OCFS_DEBUG_CONTEXT_IOCTL       0x00000010	/* ioctl.c    */
-#define OCFS_DEBUG_CONTEXT_NM          0x00000020	/* nm.c       */
-#define OCFS_DEBUG_CONTEXT_PROC        0x00000040	/* proc.c     */
-#define OCFS_DEBUG_CONTEXT_SYMLINK     0x00000080	/* symlink.c  */
-#define OCFS_DEBUG_CONTEXT_BITMAP      0x00000100	/* bitmap.c   */
-#define OCFS_DEBUG_CONTEXT_FILE        0x00000200	/* file.c     */
-#define OCFS_DEBUG_CONTEXT_INODE       0x00000400	/* inode.c    */
-#define OCFS_DEBUG_CONTEXT_JOURNAL     0x00000800	/* journal.c  */
-#define OCFS_DEBUG_CONTEXT_UNUSED1     0x00001000	/*            */
-#define OCFS_DEBUG_CONTEXT_UNUSED2     0x00002000	/*            */
-#define OCFS_DEBUG_CONTEXT_SYSFILE     0x00004000	/* sysfile.c  */
-#define OCFS_DEBUG_CONTEXT_VOLCFG      0x00008000	/* volcfg.c   */
-#define OCFS_DEBUG_CONTEXT_DCACHE      0x00010000	/* dcache.c   */
-#define OCFS_DEBUG_CONTEXT_DLM         0x00020000	/* dlm.c      */
-#define OCFS_DEBUG_CONTEXT_HASH        0x00040000	/* hash.c     */
-#define OCFS_DEBUG_CONTEXT_IO          0x00080000	/* io.c       */
-#define OCFS_DEBUG_CONTEXT_NAMEI       0x00100000	/* namei.c    */
-#define OCFS_DEBUG_CONTEXT_OSB         0x00200000	/* osb.c      */
-#define OCFS_DEBUG_CONTEXT_SUPER       0x00400000	/* super.c    */
-#define OCFS_DEBUG_CONTEXT_UTIL        0x00800000	/* util.c     */
-#define OCFS_DEBUG_CONTEXT_VOTE        0x01000000	/* vote.c     */
-#define OCFS_DEBUG_CONTEXT_LOCKRES     0x02000000	/* lockres.c  */
-
-
-#ifdef OCFS_DBG_TIMING
-typedef union _my_timing_t
-{
-	__u64 q;
-	__u32 lohi[2];
-} my_timing_t;
-
-#define IO_FUNC_TIMING_DECL	my_timing_t begin, end;	rdtsc (begin.lohi[0], begin.lohi[1]); 
-
-#define IO_FUNC_TIMING_PRINT(_fn,_ret)					      \
-	do {								      \
-		rdtsc (end.lohi[0], end.lohi[1]);			      \
-		IF_LEVEL_NO_CONTEXT(OCFS_DEBUG_LEVEL_TIMING)		      \
-			printk("(%d) EXIT : %s() = %d  => [%llu]\n",	      \
-				ocfs_getpid(), _fn, _ret,		      \
-				end.q-begin.q);			      \
-	} while(0)		      
-#else
-#define IO_FUNC_TIMING_DECL
-#define IO_FUNC_TIMING_PRINT(_fn,_ret)
-#endif
-
-
-#ifndef OCFS_DBG_TIMING
-#define DECL_U8_ARRAY(__t, __s)
-#define INIT_U8_ARRAY(__s)
-#define PRINT_STRING(__t)		printk("\n");
-#define PRINT_ENTRY(__t)		printk("(%d) ENTRY: %s", ocfs_getpid (), __FUNCTION__)
-#else
-#define DECL_U8_ARRAY(__t, __s)		__u8 (__t)[(__s)]
-#define INIT_U8_ARRAY(__s)		*(__s) = '\0'
-#define PRINT_STRING(__t)		printk("%s\n", (__t))
-#define PRINT_ENTRY(__t)		printk("(%d) %sENTRY: %s", ocfs_getpid (), (__t), __FUNCTION__)
-#endif
-
-
-#ifndef OCFS_DBG_TIMING
-# define GET_STACK(s)
-#else
-# define GET_STACK(s)							\
-	IF_LEVEL(OCFS_DEBUG_LEVEL_STACK) {				\
-		__s32 esp;						\
-		__asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : 	\
-				     "0" (8191));			\
-		esp -= sizeof(struct task_struct);			\
-		sprintf((s), "[%ld] ", esp);				\
-	}
-#endif
-
-/* privately used macros */
-# define IF_LEVEL(level)	\
-	if ((debug_context & OCFS_DEBUG_CONTEXT) && (debug_level & level) && \
-	    ocfs_getpid()!=debug_exclude)
-# define IF_LEVEL_NO_CONTEXT(level)	\
-	if ((debug_level & level) &&  ocfs_getpid()!=debug_exclude)
-	
-#ifndef OCFS_DBG_TIMING
-# define ENTRY_TIMING_DECLS
-# define GET_TIMING(s, hi, lo)
-#else
-# define ENTRY_TIMING_DECLS    __u32 _HI = 0, _LO = 0
-# define GET_TIMING(s, hi, lo)					\
-	do {							\
-		IF_LEVEL(OCFS_DEBUG_LEVEL_TIMING) {		\
-			__u32 _lo, _hi;				\
-			rdtsc (_lo, _hi);			\
-			if ((s) == NULL) {			\
-				(hi) = _hi; (lo) = _lo;		\
-			} else {				\
-				__u64 _b, _e;			\
-				_b = hi; _b <<= 32; _b |= lo;	\
-				_e = _hi; _e <<= 32; _e |= _lo;	\
-				_e -= _b; 			\
-				sprintf((s), " => [%llu]", _e);	\
-			}					\
-		}						\
-	} while (0)
-#endif
-
-/* IF macro */
-#define IF_TRACE(func)						\
-	do {							\
-		if ((debug_context & OCFS_DEBUG_CONTEXT) &&	\
-		    (debug_level & OCFS_DEBUG_LEVEL_TRACE))	\
-			func;					\
-	} while (0)
-
-#define IF_LEVEL_PID()						\
-	if ((debug_level & OCFS_DEBUG_LEVEL_PRINTK) && 		\
-	    (ocfs_getpid()!=debug_exclude))
-
-static inline void eat_value_int(int val)
-{
-	return;
-}
-
-static inline void eat_value_uint(unsigned int val)
-{
-	return;
-}
-
-static inline void eat_value_long(long val)
-{
-	return;
-}
-
-static inline void eat_value_ulong(unsigned long val)
-{
-	return;
-}
-
-static inline void eat_value_ptr(void *val)
-{
-	return;
-}
-
-/* TRACE disabled. ERROR macros are never disabled. */
-#if !defined(TRACE)
-# define  LOG_ENTRY()
-# define  LOG_EXIT()
-# define  LOG_EXIT_STATUS(val)                  eat_value_int(val)
-# define  LOG_EXIT_INT(val)                    eat_value_int(val)
-# define  LOG_EXIT_UINT(val)                   eat_value_uint(val)
-# define  LOG_EXIT_LONG(val)                    eat_value_long(val)
-# define  LOG_EXIT_ULONG(val)                   eat_value_ulong(val)
-# define  LOG_EXIT_PTR(val)                     eat_value_ptr(val)
-# define  LOG_TRACE_STR(str)
-# define  LOG_TRACE_STATUS(val)                 eat_value_int(val)
-# define  LOG_ENTRY_ARGS(fmt, arg...)
-# define  LOG_EXIT_ARGS(fmt, arg...)
-# define  LOG_TRACE_ARGS(fmt, arg...)
-# define  LOG_PID_PRINTK(fmt, arg...)
-# define  LOG_PID_STR(str)
-#endif                          /* !defined(TRACE) */
-
-	
-
-/* TRACE enabled */
-#if defined(TRACE)
-
-#define LOG_PID_PRINTK(fmt, arg...) 					\
-	do {								\
-		IF_LEVEL_PID() {					\
-			printk("(%d) %s(): ", ocfs_getpid(), 		\
-			       __FUNCTION__); 				\
-			printk(fmt, ## arg);				\
-		}							\
-	} while (0)
-
-#define LOG_PID_STR(str) LOG_PID_PRINTK("%s\n", str)
-
-/* ENTRY macros */
-/* LOG_ENTRY_ARGS()
- *
- * Note: The macro expects the args to be terminated by a newline.
- */
-#define LOG_ENTRY_ARGS(fmt, arg...)					\
-	ENTRY_TIMING_DECLS;						\
-	do {								\
-		DECL_U8_ARRAY(_t, 16);                                  \
-		INIT_U8_ARRAY(_t);                                      \
-		GET_STACK(_t);						\
-		GET_TIMING(NULL, _HI, _LO);				\
-		IF_LEVEL(OCFS_DEBUG_LEVEL_ENTRY) {			\
-			PRINT_ENTRY(_t);				\
-			printk(fmt, ##arg);			\
-		}							\
-	} while (0)
-
-#define LOG_ENTRY()            LOG_ENTRY_ARGS("() \n")
-
-
-
-/* EXIT macros */
-/* LOG_EXIT_ARGS()
- *
- */
-#define LOG_EXIT_ARGS(fmt, arg...)					\
-	do {								\
-		IF_LEVEL(OCFS_DEBUG_LEVEL_EXIT) {			\
-			DECL_U8_ARRAY(_t, 50);				\
-			INIT_U8_ARRAY(_t);				\
-			GET_TIMING(_t, _HI, _LO);			\
-			printk("(%d) EXIT : %s() %s", 			\
-			       ocfs_getpid (), __FUNCTION__, 		\
-			       (*fmt == '\n' ? "" : "= "));		\
-			if (*fmt != '\n')					\
-				printk(fmt, ## arg);			\
-			PRINT_STRING(_t);				\
-		}							\
-	}  while (0)
-
-#define LOG_EXIT()             LOG_EXIT_ARGS("\n") /* I hate you Sunil */
-#define LOG_EXIT_STATUS(val)   LOG_EXIT_ARGS("%d ", val)
-#define LOG_EXIT_INT(val)      LOG_EXIT_ARGS("%d ", val)
-#define LOG_EXIT_UINT(val)     LOG_EXIT_ARGS("%u ", val)
-#define LOG_EXIT_LONG(val)     LOG_EXIT_ARGS("%ld ", val)
-#define LOG_EXIT_ULONG(val)    LOG_EXIT_ARGS("%lu ", val)
-#define LOG_EXIT_PTR(val)      LOG_EXIT_ARGS("0x%p ", val)
-
-
-/* TRACE macros */
-/* LOG_TRACE_ARGS()
- *
- * Note: The macro expects the args to be terminated by a newline.
- */
-#define LOG_TRACE_ARGS(fmt, arg...)					\
-	do {								\
-		IF_LEVEL(OCFS_DEBUG_LEVEL_TRACE) {			\
-			printk("(%d) TRACE: %s() ", ocfs_getpid (),	\
-			       __FUNCTION__);				\
-			printk(fmt, ## arg);				\
-		}							\
-	} while (0)
-
-#define LOG_TRACE_STR(str)     LOG_TRACE_ARGS("%s\n", str)
-#define LOG_TRACE_STATUS(val)  LOG_TRACE_ARGS("%d\n", val);
-
-#endif				/* TRACE */
-
-
-
-/* ERROR macros are not compiled out */
-/* LOG_ERROR_ARGS()
- *
- * Note: The macro expects the args to be terminated by a newline.
- */
-#define LOG_ERROR_ARGS(fmt, arg...)					\
-	do {								\
-		printk(KERN_ERR "(%d) ERROR at %s, %d: ", ocfs_getpid (), __FILE__, __LINE__);        \
-		printk(fmt, ## arg);					\
-	} while (0)
-
-#define LOG_ERROR_STR(str)     LOG_ERROR_ARGS("%s\n", str)
-#define LOG_ERROR_STATUS(st)   LOG_ERROR_ARGS("status = %d\n", st)
-
 #define  LOG_TYPE_DISK_ALLOC      1
 #define  LOG_TYPE_RECOVERY        3
 #define  LOG_DELETE_ENTRY         8

Added: trunk/src/inc/ocfs_log.h
===================================================================
--- trunk/src/inc/ocfs_log.h	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/inc/ocfs_log.h	2004-06-01 20:56:30 UTC (rev 960)
@@ -0,0 +1,314 @@
+/*
+ * ocfs_log.h
+ *
+ * Defines macros and flags used for logging.
+ *
+ * Copyright (C) 2004 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version
+ * 2 of the License.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ *
+ * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
+ *	    Manish Singh, Neeraj Goyal, Suchit Kaura
+ */
+
+#ifndef OCFS_LOG_H
+#define OCFS_LOG_H
+
+extern __u32 debug_context;
+extern __u32 debug_level;
+extern __u32 debug_exclude;
+
+
+
+/* Tracing Levels */
+#define OCFS_DEBUG_LEVEL_ERROR         0x00000001
+#define OCFS_DEBUG_LEVEL_TRACE         0x00000002
+
+#define OCFS_DEBUG_LEVEL_ENTRY         0x00000010
+#define OCFS_DEBUG_LEVEL_EXIT          0x00000020
+
+#define OCFS_DEBUG_LEVEL_TIMING        0x00000100
+#define OCFS_DEBUG_LEVEL_STACK         0x00000200
+
+#define OCFS_DEBUG_LEVEL_PRINTK        0x00001000
+#define OCFS_DEBUG_LEVEL_MALLOC        0x00002000
+
+/* Tracing Contexts */
+#define OCFS_DEBUG_CONTEXT_ALLOC       0x00000001	/* alloc.c    */
+#define OCFS_DEBUG_CONTEXT_DIR         0x00000002	/* dir.c      */
+#define OCFS_DEBUG_CONTEXT_EXTMAP      0x00000004	/* extmap.c   */
+#define OCFS_DEBUG_CONTEXT_HEARTBEAT   0x00000008	/* hearbeat.c */
+#define OCFS_DEBUG_CONTEXT_IOCTL       0x00000010	/* ioctl.c    */
+#define OCFS_DEBUG_CONTEXT_NM          0x00000020	/* nm.c       */
+#define OCFS_DEBUG_CONTEXT_PROC        0x00000040	/* proc.c     */
+#define OCFS_DEBUG_CONTEXT_SYMLINK     0x00000080	/* symlink.c  */
+#define OCFS_DEBUG_CONTEXT_BITMAP      0x00000100	/* bitmap.c   */
+#define OCFS_DEBUG_CONTEXT_FILE        0x00000200	/* file.c     */
+#define OCFS_DEBUG_CONTEXT_INODE       0x00000400	/* inode.c    */
+#define OCFS_DEBUG_CONTEXT_JOURNAL     0x00000800	/* journal.c  */
+#define OCFS_DEBUG_CONTEXT_UNUSED1     0x00001000	/*            */
+#define OCFS_DEBUG_CONTEXT_UNUSED2     0x00002000	/*            */
+#define OCFS_DEBUG_CONTEXT_SYSFILE     0x00004000	/* sysfile.c  */
+#define OCFS_DEBUG_CONTEXT_VOLCFG      0x00008000	/* volcfg.c   */
+#define OCFS_DEBUG_CONTEXT_DCACHE      0x00010000	/* dcache.c   */
+#define OCFS_DEBUG_CONTEXT_DLM         0x00020000	/* dlm.c      */
+#define OCFS_DEBUG_CONTEXT_HASH        0x00040000	/* hash.c     */
+#define OCFS_DEBUG_CONTEXT_IO          0x00080000	/* io.c       */
+#define OCFS_DEBUG_CONTEXT_NAMEI       0x00100000	/* namei.c    */
+#define OCFS_DEBUG_CONTEXT_OSB         0x00200000	/* osb.c      */
+#define OCFS_DEBUG_CONTEXT_SUPER       0x00400000	/* super.c    */
+#define OCFS_DEBUG_CONTEXT_UTIL        0x00800000	/* util.c     */
+#define OCFS_DEBUG_CONTEXT_VOTE        0x01000000	/* vote.c     */
+#define OCFS_DEBUG_CONTEXT_LOCKRES     0x02000000	/* lockres.c  */
+
+
+#ifdef OCFS_DBG_TIMING
+typedef union _my_timing_t
+{
+	__u64 q;
+	__u32 lohi[2];
+} my_timing_t;
+
+#define IO_FUNC_TIMING_DECL	my_timing_t begin, end;	rdtsc (begin.lohi[0], begin.lohi[1]); 
+
+#define IO_FUNC_TIMING_PRINT(_fn,_ret)					      \
+	do {								      \
+		rdtsc (end.lohi[0], end.lohi[1]);			      \
+		IF_LEVEL_NO_CONTEXT(OCFS_DEBUG_LEVEL_TIMING)		      \
+			printk("(%d) EXIT : %s() = %d  => [%llu]\n",	      \
+				ocfs_getpid(), _fn, _ret,		      \
+				end.q-begin.q);			      \
+	} while(0)		      
+#else
+#define IO_FUNC_TIMING_DECL
+#define IO_FUNC_TIMING_PRINT(_fn,_ret)
+#endif
+
+
+#ifndef OCFS_DBG_TIMING
+#define DECL_U8_ARRAY(__t, __s)
+#define INIT_U8_ARRAY(__s)
+#define PRINT_STRING(__t)		printk("\n");
+#define PRINT_ENTRY(__t)		printk("(%d) ENTRY: %s", ocfs_getpid (), __FUNCTION__)
+#else
+#define DECL_U8_ARRAY(__t, __s)		__u8 (__t)[(__s)]
+#define INIT_U8_ARRAY(__s)		*(__s) = '\0'
+#define PRINT_STRING(__t)		printk("%s\n", (__t))
+#define PRINT_ENTRY(__t)		printk("(%d) %sENTRY: %s", ocfs_getpid (), (__t), __FUNCTION__)
+#endif
+
+
+#ifndef OCFS_DBG_TIMING
+# define GET_STACK(s)
+#else
+# define GET_STACK(s)							\
+	IF_LEVEL(OCFS_DEBUG_LEVEL_STACK) {				\
+		__s32 esp;						\
+		__asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : 	\
+				     "0" (8191));			\
+		esp -= sizeof(struct task_struct);			\
+		sprintf((s), "[%ld] ", esp);				\
+	}
+#endif
+
+/* privately used macros */
+# define IF_LEVEL(level)	\
+	if ((debug_context & OCFS_DEBUG_CONTEXT) && (debug_level & level) && \
+	    ocfs_getpid()!=debug_exclude)
+# define IF_LEVEL_NO_CONTEXT(level)	\
+	if ((debug_level & level) &&  ocfs_getpid()!=debug_exclude)
+	
+#ifndef OCFS_DBG_TIMING
+# define ENTRY_TIMING_DECLS
+# define GET_TIMING(s, hi, lo)
+#else
+# define ENTRY_TIMING_DECLS    __u32 _HI = 0, _LO = 0
+# define GET_TIMING(s, hi, lo)					\
+	do {							\
+		IF_LEVEL(OCFS_DEBUG_LEVEL_TIMING) {		\
+			__u32 _lo, _hi;				\
+			rdtsc (_lo, _hi);			\
+			if ((s) == NULL) {			\
+				(hi) = _hi; (lo) = _lo;		\
+			} else {				\
+				__u64 _b, _e;			\
+				_b = hi; _b <<= 32; _b |= lo;	\
+				_e = _hi; _e <<= 32; _e |= _lo;	\
+				_e -= _b; 			\
+				sprintf((s), " => [%llu]", _e);	\
+			}					\
+		}						\
+	} while (0)
+#endif
+
+/* IF macro */
+#define IF_TRACE(func)						\
+	do {							\
+		if ((debug_context & OCFS_DEBUG_CONTEXT) &&	\
+		    (debug_level & OCFS_DEBUG_LEVEL_TRACE))	\
+			func;					\
+	} while (0)
+
+#define IF_LEVEL_PID()						\
+	if ((debug_level & OCFS_DEBUG_LEVEL_PRINTK) && 		\
+	    (ocfs_getpid()!=debug_exclude))
+
+static inline void eat_value_int(int val)
+{
+	return;
+}
+
+static inline void eat_value_uint(unsigned int val)
+{
+	return;
+}
+
+static inline void eat_value_long(long val)
+{
+	return;
+}
+
+static inline void eat_value_ulong(unsigned long val)
+{
+	return;
+}
+
+static inline void eat_value_ptr(void *val)
+{
+	return;
+}
+
+/* TRACE disabled. ERROR macros are never disabled. */
+#if !defined(TRACE)
+# define  LOG_ENTRY()
+# define  LOG_EXIT()
+# define  LOG_EXIT_STATUS(val)                  eat_value_int(val)
+# define  LOG_EXIT_INT(val)                    eat_value_int(val)
+# define  LOG_EXIT_UINT(val)                   eat_value_uint(val)
+# define  LOG_EXIT_LONG(val)                    eat_value_long(val)
+# define  LOG_EXIT_ULONG(val)                   eat_value_ulong(val)
+# define  LOG_EXIT_PTR(val)                     eat_value_ptr(val)
+# define  LOG_TRACE_STR(str)
+# define  LOG_TRACE_STATUS(val)                 eat_value_int(val)
+# define  LOG_ENTRY_ARGS(fmt, arg...)
+# define  LOG_EXIT_ARGS(fmt, arg...)
+# define  LOG_TRACE_ARGS(fmt, arg...)
+# define  LOG_PID_PRINTK(fmt, arg...)
+# define  LOG_PID_STR(str)
+#endif                          /* !defined(TRACE) */
+
+	
+
+/* TRACE enabled */
+#if defined(TRACE)
+
+#define LOG_PID_PRINTK(fmt, arg...) 					\
+	do {								\
+		IF_LEVEL_PID() {					\
+			printk("(%d) %s(): ", ocfs_getpid(), 		\
+			       __FUNCTION__); 				\
+			printk(fmt, ## arg);				\
+		}							\
+	} while (0)
+
+#define LOG_PID_STR(str) LOG_PID_PRINTK("%s\n", str)
+
+/* ENTRY macros */
+/* LOG_ENTRY_ARGS()
+ *
+ * Note: The macro expects the args to be terminated by a newline.
+ */
+#define LOG_ENTRY_ARGS(fmt, arg...)					\
+	ENTRY_TIMING_DECLS;						\
+	do {								\
+		DECL_U8_ARRAY(_t, 16);                                  \
+		INIT_U8_ARRAY(_t);                                      \
+		GET_STACK(_t);						\
+		GET_TIMING(NULL, _HI, _LO);				\
+		IF_LEVEL(OCFS_DEBUG_LEVEL_ENTRY) {			\
+			PRINT_ENTRY(_t);				\
+			printk(fmt, ##arg);			\
+		}							\
+	} while (0)
+
+#define LOG_ENTRY()            LOG_ENTRY_ARGS("() \n")
+
+
+
+/* EXIT macros */
+/* LOG_EXIT_ARGS()
+ *
+ */
+#define LOG_EXIT_ARGS(fmt, arg...)					\
+	do {								\
+		IF_LEVEL(OCFS_DEBUG_LEVEL_EXIT) {			\
+			DECL_U8_ARRAY(_t, 50);				\
+			INIT_U8_ARRAY(_t);				\
+			GET_TIMING(_t, _HI, _LO);			\
+			printk("(%d) EXIT : %s() %s", 			\
+			       ocfs_getpid (), __FUNCTION__, 		\
+			       (*fmt == '\n' ? "" : "= "));		\
+			if (*fmt != '\n')					\
+				printk(fmt, ## arg);			\
+			PRINT_STRING(_t);				\
+		}							\
+	}  while (0)
+
+#define LOG_EXIT()             LOG_EXIT_ARGS("\n") /* I hate you Sunil */
+#define LOG_EXIT_STATUS(val)   LOG_EXIT_ARGS("%d ", val)
+#define LOG_EXIT_INT(val)      LOG_EXIT_ARGS("%d ", val)
+#define LOG_EXIT_UINT(val)     LOG_EXIT_ARGS("%u ", val)
+#define LOG_EXIT_LONG(val)     LOG_EXIT_ARGS("%ld ", val)
+#define LOG_EXIT_ULONG(val)    LOG_EXIT_ARGS("%lu ", val)
+#define LOG_EXIT_PTR(val)      LOG_EXIT_ARGS("0x%p ", val)
+
+
+/* TRACE macros */
+/* LOG_TRACE_ARGS()
+ *
+ * Note: The macro expects the args to be terminated by a newline.
+ */
+#define LOG_TRACE_ARGS(fmt, arg...)					\
+	do {								\
+		IF_LEVEL(OCFS_DEBUG_LEVEL_TRACE) {			\
+			printk("(%d) TRACE: %s() ", ocfs_getpid (),	\
+			       __FUNCTION__);				\
+			printk(fmt, ## arg);				\
+		}							\
+	} while (0)
+
+#define LOG_TRACE_STR(str)     LOG_TRACE_ARGS("%s\n", str)
+#define LOG_TRACE_STATUS(val)  LOG_TRACE_ARGS("%d\n", val);
+
+#endif				/* TRACE */
+
+
+
+/* ERROR macros are not compiled out */
+/* LOG_ERROR_ARGS()
+ *
+ * Note: The macro expects the args to be terminated by a newline.
+ */
+#define LOG_ERROR_ARGS(fmt, arg...)					\
+	do {								\
+		printk(KERN_ERR "(%d) ERROR at %s, %d: ", ocfs_getpid (), __FILE__, __LINE__);        \
+		printk(fmt, ## arg);					\
+	} while (0)
+
+#define LOG_ERROR_STR(str)     LOG_ERROR_ARGS("%s\n", str)
+#define LOG_ERROR_STATUS(st)   LOG_ERROR_ARGS("status = %d\n", st)
+
+#endif  /* OCFS_LOG_H */

Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/inode.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_INODE

Modified: trunk/src/io.c
===================================================================
--- trunk/src/io.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/io.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_IO

Modified: trunk/src/ioctl.c
===================================================================
--- trunk/src/ioctl.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/ioctl.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 /* Tracing */

Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/journal.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Joel Becker
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_JOURNAL

Modified: trunk/src/lockres.c
===================================================================
--- trunk/src/lockres.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/lockres.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 /* Tracing */

Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/namei.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_NAMEI

Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/nm.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 /* Tracing */

Modified: trunk/src/proc.c
===================================================================
--- trunk/src/proc.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/proc.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -26,6 +26,9 @@
 
 #define OCFSPROC_PRIVATE_DECLS
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 extern __u32 comm_voting;
 

Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/super.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,9 +24,12 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
-#include "inc/ocfs.h"
 #include <linux/utsname.h>
+#include <linux/types.h>
 
+#include "inc/ocfs_log.h"
+#include "inc/ocfs.h"
+
 #define OCFS_DEBUG_CONTEXT  OCFS_DEBUG_CONTEXT_SUPER
 
 /*

Modified: trunk/src/symlink.c
===================================================================
--- trunk/src/symlink.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/symlink.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -30,6 +30,9 @@
  *  for CDSL support
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 #include <linux/utsname.h>
 

Modified: trunk/src/sysfile.c
===================================================================
--- trunk/src/sysfile.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/sysfile.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -25,6 +25,9 @@
  */
 
 #ifdef __KERNEL__
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 #else
 #include <dummy.h>

Modified: trunk/src/util.c
===================================================================
--- trunk/src/util.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/util.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -25,6 +25,9 @@
  */
 
 #ifdef __KERNEL__
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 #else
 #include <debugocfs.h>

Modified: trunk/src/ver.c
===================================================================
--- trunk/src/ver.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/ver.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 #include <linux/kernel.h>
 

Modified: trunk/src/volcfg.c
===================================================================
--- trunk/src/volcfg.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/volcfg.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh, Neeraj Goyal, Suchit Kaura
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 /* Tracing */

Modified: trunk/src/vote.c
===================================================================
--- trunk/src/vote.c	2004-05-30 17:08:26 UTC (rev 959)
+++ trunk/src/vote.c	2004-06-01 20:56:30 UTC (rev 960)
@@ -24,6 +24,9 @@
  *	    Manish Singh
  */
 
+#include <linux/types.h>
+
+#include "inc/ocfs_log.h"
 #include "inc/ocfs.h"
 
 /* Tracing */



More information about the Ocfs2-commits mailing list