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 - POSIX ACLs 357 - readpages / writepages (not user visible) 358 359 config MINIX_FS 360 tristate "Minix fs support" 361 help
··· 356 - POSIX ACLs 357 - readpages / writepages (not user visible) 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 + 369 config MINIX_FS 370 tristate "Minix fs support" 371 help
+21 -1
fs/ocfs2/cluster/masklog.h
··· 123 #define MLOG_MASK_PREFIX 0 124 #endif 125 126 #define MLOG_MAX_BITS 64 127 128 struct mlog_bits { ··· 198 199 #define mlog(mask, fmt, args...) do { \ 200 u64 __m = MLOG_MASK_PREFIX | (mask); \ 201 - if (__mlog_test_u64(__m, mlog_and_bits) && \ 202 !__mlog_test_u64(__m, mlog_not_bits)) { \ 203 if (__m & ML_ERROR) \ 204 __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ ··· 216 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ 217 } while (0) 218 219 #define mlog_entry(fmt, args...) do { \ 220 mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ 221 } while (0) ··· 260 #define mlog_exit_void() do { \ 261 mlog(ML_EXIT, "EXIT\n"); \ 262 } while (0) 263 264 #define mlog_bug_on_msg(cond, fmt, args...) do { \ 265 if (cond) { \
··· 123 #define MLOG_MASK_PREFIX 0 124 #endif 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 + 137 #define MLOG_MAX_BITS 64 138 139 struct mlog_bits { ··· 187 188 #define mlog(mask, fmt, args...) do { \ 189 u64 __m = MLOG_MASK_PREFIX | (mask); \ 190 + if ((__m & ML_ALLOWED_BITS) && \ 191 + __mlog_test_u64(__m, mlog_and_bits) && \ 192 !__mlog_test_u64(__m, mlog_not_bits)) { \ 193 if (__m & ML_ERROR) \ 194 __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ ··· 204 mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ 205 } while (0) 206 207 + #if defined(CONFIG_OCFS2_DEBUG_MASKLOG) 208 #define mlog_entry(fmt, args...) do { \ 209 mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ 210 } while (0) ··· 247 #define mlog_exit_void() do { \ 248 mlog(ML_EXIT, "EXIT\n"); \ 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) */ 257 258 #define mlog_bug_on_msg(cond, fmt, args...) do { \ 259 if (cond) { \
+2 -4
fs/ocfs2/dir.c
··· 213 struct ocfs2_dir_entry **dirent) 214 { 215 int status = -ENOENT; 216 - struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 217 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); 221 222 *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent); 223 if (!*dirent_bh || !*dirent) {
··· 213 struct ocfs2_dir_entry **dirent) 214 { 215 int status = -ENOENT; 216 217 + mlog_entry("(name=%.*s, blkno=%p, inode=%p, dirent_bh=%p, dirent=%p)\n", 218 + namelen, name, blkno, inode, dirent_bh, dirent); 219 220 *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent); 221 if (!*dirent_bh || !*dirent) {
+2 -2
fs/ocfs2/mmap.c
··· 46 unsigned long address, 47 int *type) 48 { 49 - struct inode *inode = area->vm_file->f_dentry->d_inode; 50 struct page *page = NOPAGE_SIGBUS; 51 sigset_t blocked, oldset; 52 int ret; 53 54 - mlog_entry("(inode %lu, address %lu)\n", inode->i_ino, address); 55 56 /* The best way to deal with signals in this path is 57 * to block them upfront, rather than allowing the
··· 46 unsigned long address, 47 int *type) 48 { 49 struct page *page = NOPAGE_SIGBUS; 50 sigset_t blocked, oldset; 51 int ret; 52 53 + mlog_entry("(area=%p, address=%lu, type=%p)\n", area, address, 54 + type); 55 56 /* The best way to deal with signals in this path is 57 * to block them upfront, rather than allowing the