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>
This commit is contained in:
Joel Becker 2006-05-10 18:28:59 -07:00 committed by Mark Fasheh
parent e7515d065d
commit 2b388c6790
4 changed files with 35 additions and 7 deletions

View File

@ -356,6 +356,16 @@ config OCFS2_FS
- POSIX ACLs - POSIX ACLs
- readpages / writepages (not user visible) - 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 config MINIX_FS
tristate "Minix fs support" tristate "Minix fs support"
help help

View File

@ -123,6 +123,17 @@
#define MLOG_MASK_PREFIX 0 #define MLOG_MASK_PREFIX 0
#endif #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 #define MLOG_MAX_BITS 64
struct mlog_bits { struct mlog_bits {
@ -187,7 +198,8 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
#define mlog(mask, fmt, args...) do { \ #define mlog(mask, fmt, args...) do { \
u64 __m = MLOG_MASK_PREFIX | (mask); \ 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)) { \ !__mlog_test_u64(__m, mlog_not_bits)) { \
if (__m & ML_ERROR) \ if (__m & ML_ERROR) \
__mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ __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); \ mlog(ML_ERROR, "status = %lld\n", (long long)_st); \
} while (0) } while (0)
#if defined(CONFIG_OCFS2_DEBUG_MASKLOG)
#define mlog_entry(fmt, args...) do { \ #define mlog_entry(fmt, args...) do { \
mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \
} while (0) } while (0)
@ -247,6 +260,13 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
#define mlog_exit_void() do { \ #define mlog_exit_void() do { \
mlog(ML_EXIT, "EXIT\n"); \ mlog(ML_EXIT, "EXIT\n"); \
} while (0) } 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 { \ #define mlog_bug_on_msg(cond, fmt, args...) do { \
if (cond) { \ if (cond) { \

View File

@ -213,11 +213,9 @@ int ocfs2_find_files_on_disk(const char *name,
struct ocfs2_dir_entry **dirent) struct ocfs2_dir_entry **dirent)
{ {
int status = -ENOENT; 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", mlog_entry("(name=%.*s, blkno=%p, inode=%p, dirent_bh=%p, dirent=%p)\n",
osb, (unsigned long long)OCFS2_I(inode)->ip_blkno, namelen, name, blkno, inode, dirent_bh, dirent);
namelen, name, blkno, inode);
*dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent); *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent);
if (!*dirent_bh || !*dirent) { if (!*dirent_bh || !*dirent) {

View File

@ -46,12 +46,12 @@ static struct page *ocfs2_nopage(struct vm_area_struct * area,
unsigned long address, unsigned long address,
int *type) int *type)
{ {
struct inode *inode = area->vm_file->f_dentry->d_inode;
struct page *page = NOPAGE_SIGBUS; struct page *page = NOPAGE_SIGBUS;
sigset_t blocked, oldset; sigset_t blocked, oldset;
int ret; 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 /* The best way to deal with signals in this path is
* to block them upfront, rather than allowing the * to block them upfront, rather than allowing the