diff options
author | Joel Becker <joel.becker@oracle.com> | 2006-05-10 21:28:59 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-06-29 17:48:30 -0400 |
commit | 2b388c67906ee8cd3bf1a600a7023cd0807d414f (patch) | |
tree | 9c03bb07a2a6e467fb9219e8c98fea1a5cec71de /fs | |
parent | e7515d065d09f6450c996a8fa206ad66569e183c (diff) |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/Kconfig | 10 | ||||
-rw-r--r-- | fs/ocfs2/cluster/masklog.h | 22 | ||||
-rw-r--r-- | fs/ocfs2/dir.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/mmap.c | 4 |
4 files changed, 35 insertions, 7 deletions
diff --git a/fs/Kconfig b/fs/Kconfig index 6dc8cfd6d80c..be870db242b3 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -356,6 +356,16 @@ config OCFS2_FS | |||
356 | - POSIX ACLs | 356 | - POSIX ACLs |
357 | - readpages / writepages (not user visible) | 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 | config MINIX_FS | 369 | config MINIX_FS |
360 | tristate "Minix fs support" | 370 | tristate "Minix fs support" |
361 | help | 371 | help |
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h index 73edad782537..a42628ba9ddf 100644 --- a/fs/ocfs2/cluster/masklog.h +++ b/fs/ocfs2/cluster/masklog.h | |||
@@ -123,6 +123,17 @@ | |||
123 | #define MLOG_MASK_PREFIX 0 | 123 | #define MLOG_MASK_PREFIX 0 |
124 | #endif | 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 | #define MLOG_MAX_BITS 64 | 137 | #define MLOG_MAX_BITS 64 |
127 | 138 | ||
128 | struct mlog_bits { | 139 | struct mlog_bits { |
@@ -187,7 +198,8 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits; | |||
187 | 198 | ||
188 | #define mlog(mask, fmt, args...) do { \ | 199 | #define mlog(mask, fmt, args...) do { \ |
189 | u64 __m = MLOG_MASK_PREFIX | (mask); \ | 200 | u64 __m = MLOG_MASK_PREFIX | (mask); \ |
190 | if (__mlog_test_u64(__m, mlog_and_bits) && \ | 201 | if ((__m & ML_ALLOWED_BITS) && \ |
202 | __mlog_test_u64(__m, mlog_and_bits) && \ | ||
191 | !__mlog_test_u64(__m, mlog_not_bits)) { \ | 203 | !__mlog_test_u64(__m, mlog_not_bits)) { \ |
192 | if (__m & ML_ERROR) \ | 204 | if (__m & ML_ERROR) \ |
193 | __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ | 205 | __mlog_printk(KERN_ERR, "ERROR: "fmt , ##args); \ |
@@ -204,6 +216,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits; | |||
204 | mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ | 216 | mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ |
205 | } while (0) | 217 | } while (0) |
206 | 218 | ||
219 | #if defined(CONFIG_OCFS2_DEBUG_MASKLOG) | ||
207 | #define mlog_entry(fmt, args...) do { \ | 220 | #define mlog_entry(fmt, args...) do { \ |
208 | mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ | 221 | mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ |
209 | } while (0) | 222 | } while (0) |
@@ -247,6 +260,13 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits; | |||
247 | #define mlog_exit_void() do { \ | 260 | #define mlog_exit_void() do { \ |
248 | mlog(ML_EXIT, "EXIT\n"); \ | 261 | mlog(ML_EXIT, "EXIT\n"); \ |
249 | } while (0) | 262 | } while (0) |
263 | #else | ||
264 | #define mlog_entry(...) do { } while (0) | ||
265 | #define mlog_entry_void(...) do { } while (0) | ||
266 | #define mlog_exit(...) do { } while (0) | ||
267 | #define mlog_exit_ptr(...) do { } while (0) | ||
268 | #define mlog_exit_void(...) do { } while (0) | ||
269 | #endif /* defined(CONFIG_OCFS2_DEBUG_MASKLOG) */ | ||
250 | 270 | ||
251 | #define mlog_bug_on_msg(cond, fmt, args...) do { \ | 271 | #define mlog_bug_on_msg(cond, fmt, args...) do { \ |
252 | if (cond) { \ | 272 | if (cond) { \ |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index ae47f450792f..3d494d1a5f36 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -213,11 +213,9 @@ int ocfs2_find_files_on_disk(const char *name, | |||
213 | struct ocfs2_dir_entry **dirent) | 213 | struct ocfs2_dir_entry **dirent) |
214 | { | 214 | { |
215 | int status = -ENOENT; | 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", | 217 | mlog_entry("(name=%.*s, blkno=%p, inode=%p, dirent_bh=%p, dirent=%p)\n", |
219 | osb, (unsigned long long)OCFS2_I(inode)->ip_blkno, | 218 | namelen, name, blkno, inode, dirent_bh, dirent); |
220 | namelen, name, blkno, inode); | ||
221 | 219 | ||
222 | *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent); | 220 | *dirent_bh = ocfs2_find_entry(name, namelen, inode, dirent); |
223 | if (!*dirent_bh || !*dirent) { | 221 | if (!*dirent_bh || !*dirent) { |
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 843cf9ddefe8..83934e33e5b0 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
@@ -46,12 +46,12 @@ static struct page *ocfs2_nopage(struct vm_area_struct * area, | |||
46 | unsigned long address, | 46 | unsigned long address, |
47 | int *type) | 47 | int *type) |
48 | { | 48 | { |
49 | struct inode *inode = area->vm_file->f_dentry->d_inode; | ||
50 | struct page *page = NOPAGE_SIGBUS; | 49 | struct page *page = NOPAGE_SIGBUS; |
51 | sigset_t blocked, oldset; | 50 | sigset_t blocked, oldset; |
52 | int ret; | 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 | /* The best way to deal with signals in this path is | 56 | /* The best way to deal with signals in this path is |
57 | * to block them upfront, rather than allowing the | 57 | * to block them upfront, rather than allowing the |