]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ocfs2: Compile-time disabling of ocfs2 debugging output.
authorJoel Becker <joel.becker@oracle.com>
Thu, 11 May 2006 01:28:59 +0000 (18:28 -0700)
committerMark Fasheh <mark.fasheh@oracle.com>
Thu, 29 Jun 2006 21:48:30 +0000 (14:48 -0700)
Give gcc the chance to compile out the debug logging code in ocfs2.
This saves some size at the expense of being able to debug the code.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
fs/Kconfig
fs/ocfs2/cluster/masklog.h
fs/ocfs2/dir.c
fs/ocfs2/mmap.c

index 6dc8cfd6d80cf7e57a73e1be4828b945667894d4..be870db242b368b3a49c9d25f10b300be7968851 100644 (file)
@@ -356,6 +356,16 @@ config OCFS2_FS
                  - POSIX ACLs
                  - readpages / writepages (not user visible)
 
+config OCFS2_DEBUG_MASKLOG
+       bool "OCFS2 logging support"
+       depends on OCFS2_FS
+       default y
+       help
+         The ocfs2 filesystem has an extensive logging system.  The system
+         allows selection of events to log via files in /sys/o2cb/logmask/.
+         This option will enlarge your kernel, but it allows debugging of
+         ocfs2 filesystem issues.
+
 config MINIX_FS
        tristate "Minix fs support"
        help
index 73edad782537d0458681751461fd0902c5a96dbd..a42628ba9ddf493a0b8b484f6765810dfb59f612 100644 (file)
 #define MLOG_MASK_PREFIX 0
 #endif
 
+/*
+ * When logging is disabled, force the bit test to 0 for anything other
+ * than errors and notices, allowing gcc to remove the code completely.
+ * When enabled, allow all masks.
+ */
+#if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
+#define ML_ALLOWED_BITS ~0
+#else
+#define ML_ALLOWED_BITS (ML_ERROR|ML_NOTICE)
+#endif
+
 #define MLOG_MAX_BITS 64
 
 struct mlog_bits {
@@ -187,7 +198,8 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
 
 #define mlog(mask, fmt, args...) do {                                  \
        u64 __m = MLOG_MASK_PREFIX | (mask);                            \
-       if (__mlog_test_u64(__m, mlog_and_bits) &&                      \
+       if ((__m & ML_ALLOWED_BITS) &&                                  \
+           __mlog_test_u64(__m, mlog_and_bits) &&                      \
            !__mlog_test_u64(__m, mlog_not_bits)) {                     \
                if (__m & ML_ERROR)                                     \
                        __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \
@@ -204,6 +216,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
                mlog(ML_ERROR, "status = %lld\n", (long long)_st);      \
 } while (0)
 
+#if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
 #define mlog_entry(fmt, args...) do {                                  \
        mlog(ML_ENTRY, "ENTRY:" fmt , ##args);                          \
 } while (0)
@@ -247,6 +260,13 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
 #define mlog_exit_void() do {                                          \
        mlog(ML_EXIT, "EXIT\n");                                        \
 } while (0)
+#else
+#define mlog_entry(...)  do { } while (0)
+#define mlog_entry_void(...)  do { } while (0)
+#define mlog_exit(...)  do { } while (0)
+#define mlog_exit_ptr(...)  do { } while (0)
+#define mlog_exit_void(...)  do { } while (0)
+#endif  /* defined(CONFIG_OCFS2_DEBUG_MASKLOG) */
 
 #define mlog_bug_on_msg(cond, fmt, args...) do {                       \
        if (cond) {                                                     \
index ae47f450792f81f745d9a6a571b9b4f898adda3a..3d494d1a5f36360bd2f90983c05fff5b9b2f88a5 100644 (file)
@@ -213,11 +213,9 @@ int ocfs2_find_files_on_disk(const char *name,
                             struct ocfs2_dir_entry **dirent)
 {
        int status = -ENOENT;
-       struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 
-       mlog_entry("(osb=%p, parent=%llu, name='%.*s', blkno=%p, inode=%p)\n",
-                  osb, (unsigned long long)OCFS2_I(inode)->ip_blkno,
-                  namelen, name, blkno, inode);
+       mlog_entry("(name=%.*s, blkno=%p, inode=%p, dirent_bh=%p, dirent=%p)\n",
+                  namelen, name, blkno, inode, dirent_bh, dirent);
 
        *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent);
        if (!*dirent_bh || !*dirent) {
index 843cf9ddefe8aa659b09c23138da2184717074b2..83934e33e5b06de784e108672e552a4eb507feaf 100644 (file)
@@ -46,12 +46,12 @@ static struct page *ocfs2_nopage(struct vm_area_struct * area,
                                 unsigned long address,
                                 int *type)
 {
-       struct inode *inode = area->vm_file->f_dentry->d_inode;
        struct page *page = NOPAGE_SIGBUS;
        sigset_t blocked, oldset;
        int ret;
 
-       mlog_entry("(inode %lu, address %lu)\n", inode->i_ino, address);
+       mlog_entry("(area=%p, address=%lu, type=%p)\n", area, address,
+                  type);
 
        /* The best way to deal with signals in this path is
         * to block them upfront, rather than allowing the