ocfs2: Compile-time disabling of ocfs2 debugging output.

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>

authored by Joel Becker and committed by Mark Fasheh 2b388c67 e7515d06

+35 -7
+10
fs/Kconfig
··· 356 356 - POSIX ACLs 357 357 - readpages / writepages (not user visible) 358 358 359 + config OCFS2_DEBUG_MASKLOG 360 + bool "OCFS2 logging support" 361 + depends on OCFS2_FS 362 + default y 363 + help 364 + The ocfs2 filesystem has an extensive logging system. The system 365 + allows selection of events to log via files in /sys/o2cb/logmask/. 366 + This option will enlarge your kernel, but it allows debugging of 367 + ocfs2 filesystem issues. 368 + 359 369 config MINIX_FS 360 370 tristate "Minix fs support" 361 371 help
+21 -1
fs/ocfs2/cluster/masklog.h
··· 123 123 #define MLOG_MASK_PREFIX 0 124 124 #endif 125 125 126 + /* 127 + * When logging is disabled, force the bit test to 0 for anything other 128 + * than errors and notices, allowing gcc to remove the code completely. 129 + * When enabled, allow all masks. 130 + */ 131 + #if defined(CONFIG_OCFS2_DEBUG_MASKLOG) 132 + #define ML_ALLOWED_BITS ~0 133 + #else 134 + #define ML_ALLOWED_BITS (ML_ERROR|ML_NOTICE) 135 + #endif 136 + 126 137 #define MLOG_MAX_BITS 64 127 138 128 139 struct mlog_bits { ··· 198 187 199 188 #define mlog(mask, fmt, args...) do { \ 200 189 u64 __m = MLOG_MASK_PREFIX | (mask); \ 201 - if (__mlog_test_u64(__m, mlog_and_bits) && \ 190 + if ((__m & ML_ALLOWED_BITS) && \ 191 + __mlog_test_u64(__m, mlog_and_bits) && \ 202 192 !__mlog_test_u64(__m, mlog_not_bits)) { \ 203 193 if (__m & ML_ERROR) \ 204 194 __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ ··· 216 204 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ 217 205 } while (0) 218 206 207 + #if defined(CONFIG_OCFS2_DEBUG_MASKLOG) 219 208 #define mlog_entry(fmt, args...) do { \ 220 209 mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ 221 210 } while (0) ··· 260 247 #define mlog_exit_void() do { \ 261 248 mlog(ML_EXIT, "EXIT\n"); \ 262 249 } while (0) 250 + #else 251 + #define mlog_entry(...) do { } while (0) 252 + #define mlog_entry_void(...) do { } while (0) 253 + #define mlog_exit(...) do { } while (0) 254 + #define mlog_exit_ptr(...) do { } while (0) 255 + #define mlog_exit_void(...) do { } while (0) 256 + #endif /* defined(CONFIG_OCFS2_DEBUG_MASKLOG) */ 263 257 264 258 #define mlog_bug_on_msg(cond, fmt, args...) do { \ 265 259 if (cond) { \
+2 -4
fs/ocfs2/dir.c
··· 213 213 struct ocfs2_dir_entry **dirent) 214 214 { 215 215 int status = -ENOENT; 216 - struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 217 216 218 - mlog_entry("(osb=%p, parent=%llu, name='%.*s', blkno=%p, inode=%p)\n", 219 - osb, (unsigned long long)OCFS2_I(inode)->ip_blkno, 220 - namelen, name, blkno, inode); 217 + mlog_entry("(name=%.*s, blkno=%p, inode=%p, dirent_bh=%p, dirent=%p)\n", 218 + namelen, name, blkno, inode, dirent_bh, dirent); 221 219 222 220 *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent); 223 221 if (!*dirent_bh || !*dirent) {
+2 -2
fs/ocfs2/mmap.c
··· 46 46 unsigned long address, 47 47 int *type) 48 48 { 49 - struct inode *inode = area->vm_file->f_dentry->d_inode; 50 49 struct page *page = NOPAGE_SIGBUS; 51 50 sigset_t blocked, oldset; 52 51 int ret; 53 52 54 - mlog_entry("(inode %lu, address %lu)\n", inode->i_ino, address); 53 + mlog_entry("(area=%p, address=%lu, type=%p)\n", area, address, 54 + type); 55 55 56 56 /* The best way to deal with signals in this path is 57 57 * to block them upfront, rather than allowing the