diff options
author | Mingming Cao <cmm@us.ibm.com> | 2007-07-19 04:48:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:47 -0400 |
commit | b38bd33a6bf5095736620ca8e85fe61820c2d312 (patch) | |
tree | 86ba1d0c28dedc87ced6d1f06c7a80d944650559 | |
parent | f0a594c1c74fedbd838402e7372030311be8cc6e (diff) |
fix ext4/JBD2 build warnings
Looking at the current linus-git tree jbd_debug() define in
include/linux/jbd2.h
extern u8 journal_enable_debug;
#define jbd_debug(n, f, a...) \
do { \
if ((n) <= journal_enable_debug) { \
printk (KERN_DEBUG "(%s, %d): %s: ", \
__FILE__, __LINE__, __FUNCTION__); \
printk (f, ## a); \
} \
} while (0)
> fs/ext4/inode.c: In function âext4_write_inodeâ:
> fs/ext4/inode.c:2906: warning: comparison is always true due to limited
> range of data type
>
> fs/jbd2/recovery.c: In function âjbd2_journal_recoverâ:
> fs/jbd2/recovery.c:254: warning: comparison is always true due to
> limited range of data type
> fs/jbd2/recovery.c:257: warning: comparison is always true due to
> limited range of data type
>
> fs/jbd2/recovery.c: In function âjbd2_journal_skip_recoveryâ:
> fs/jbd2/recovery.c:301: warning: comparison is always true due to
> limited range of data type
>
Noticed all warnings are occurs when the debug level is 0. Then found
the "jbd2: Move jbd2-debug file to debugfs" patch
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0f49d5d019afa4e94253bfc92f0daca3badb990b
changed the jbd2_journal_enable_debug from int type to u8, makes the
jbd_debug comparision is always true when the debugging level is 0. Thus
the compile warning occurs.
Thought about changing the jbd2_journal_enable_debug data type back to
int, but can't, because the jbd2-debug is moved to debug fs, where
calling debugfs_create_u8() to create the debugfs entry needs the value
to be u8 type.
Even if we changed the data type back to int, the code is still buggy,
kernel should not print jbd2 debug message if the
jbd2_journal_enable_debug is set to 0. But this is not the case.
The fix is change the level of debugging to 1. The same should fixed in
ext3/JBD, but currently ext3 jbd-debug via /proc fs is broken, so we
probably should fix it all together.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Theodore Tso <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ext4/inode.c | 2 | ||||
-rw-r--r-- | fs/jbd2/recovery.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index de26c25d6a18..a4848e04a5ed 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2903,7 +2903,7 @@ int ext4_write_inode(struct inode *inode, int wait) | |||
2903 | return 0; | 2903 | return 0; |
2904 | 2904 | ||
2905 | if (ext4_journal_current_handle()) { | 2905 | if (ext4_journal_current_handle()) { |
2906 | jbd_debug(0, "called recursively, non-PF_MEMALLOC!\n"); | 2906 | jbd_debug(1, "called recursively, non-PF_MEMALLOC!\n"); |
2907 | dump_stack(); | 2907 | dump_stack(); |
2908 | return -EIO; | 2908 | return -EIO; |
2909 | } | 2909 | } |
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index e7730a045b93..b50be8a044eb 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c | |||
@@ -251,10 +251,10 @@ int jbd2_journal_recover(journal_t *journal) | |||
251 | if (!err) | 251 | if (!err) |
252 | err = do_one_pass(journal, &info, PASS_REPLAY); | 252 | err = do_one_pass(journal, &info, PASS_REPLAY); |
253 | 253 | ||
254 | jbd_debug(0, "JBD: recovery, exit status %d, " | 254 | jbd_debug(1, "JBD: recovery, exit status %d, " |
255 | "recovered transactions %u to %u\n", | 255 | "recovered transactions %u to %u\n", |
256 | err, info.start_transaction, info.end_transaction); | 256 | err, info.start_transaction, info.end_transaction); |
257 | jbd_debug(0, "JBD: Replayed %d and revoked %d/%d blocks\n", | 257 | jbd_debug(1, "JBD: Replayed %d and revoked %d/%d blocks\n", |
258 | info.nr_replays, info.nr_revoke_hits, info.nr_revokes); | 258 | info.nr_replays, info.nr_revoke_hits, info.nr_revokes); |
259 | 259 | ||
260 | /* Restart the log at the next transaction ID, thus invalidating | 260 | /* Restart the log at the next transaction ID, thus invalidating |
@@ -298,7 +298,7 @@ int jbd2_journal_skip_recovery(journal_t *journal) | |||
298 | #ifdef CONFIG_JBD2_DEBUG | 298 | #ifdef CONFIG_JBD2_DEBUG |
299 | int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence); | 299 | int dropped = info.end_transaction - be32_to_cpu(sb->s_sequence); |
300 | #endif | 300 | #endif |
301 | jbd_debug(0, | 301 | jbd_debug(1, |
302 | "JBD: ignoring %d transaction%s from the journal.\n", | 302 | "JBD: ignoring %d transaction%s from the journal.\n", |
303 | dropped, (dropped == 1) ? "" : "s"); | 303 | dropped, (dropped == 1) ? "" : "s"); |
304 | journal->j_transaction_sequence = ++info.end_transaction; | 304 | journal->j_transaction_sequence = ++info.end_transaction; |