Skip to content

Commit

Permalink
ocfs2: Compile-time disabling of ocfs2 debugging output.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joel Becker authored and Mark Fasheh committed Jun 29, 2006
1 parent e7515d0 commit 2b388c6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
10 changes: 10 additions & 0 deletions fs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 21 additions & 1 deletion fs/ocfs2/cluster/masklog.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@
#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 {
Expand Down Expand Up @@ -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); \
Expand All @@ -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)
Expand Down Expand Up @@ -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) { \
Expand Down
6 changes: 2 additions & 4 deletions fs/ocfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions fs/ocfs2/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2b388c6

Please sign in to comment.