diff options
author | zhangyi (F) <yi.zhang@huawei.com> | 2019-02-21 11:24:09 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2019-02-21 11:24:09 -0500 |
commit | 01215d3edb0f384ddeaa5e4a22c1ae5ff634149f (patch) | |
tree | 8b7ff6039bd2b19023a8d6370dd591b0ed6b79ae /fs/jbd2 | |
parent | 7159a986b4202343f6cca3bb8079ecace5816fd6 (diff) |
jbd2: fix compile warning when using JBUFFER_TRACE
The jh pointer may be used uninitialized in the two cases below and the
compiler complain about it when enabling JBUFFER_TRACE macro, fix them.
In file included from fs/jbd2/transaction.c:19:0:
fs/jbd2/transaction.c: In function ‘jbd2_journal_get_undo_access’:
./include/linux/jbd2.h:1637:38: warning: ‘jh’ is used uninitialized in this function [-Wuninitialized]
#define JBUFFER_TRACE(jh, info) do { printk("%s: %d\n", __func__, jh->b_jcount);} while (0)
^
fs/jbd2/transaction.c:1219:23: note: ‘jh’ was declared here
struct journal_head *jh;
^
In file included from fs/jbd2/transaction.c:19:0:
fs/jbd2/transaction.c: In function ‘jbd2_journal_dirty_metadata’:
./include/linux/jbd2.h:1637:38: warning: ‘jh’ may be used uninitialized in this function [-Wmaybe-uninitialized]
#define JBUFFER_TRACE(jh, info) do { printk("%s: %d\n", __func__, jh->b_jcount);} while (0)
^
fs/jbd2/transaction.c:1332:23: note: ‘jh’ was declared here
struct journal_head *jh;
^
Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
Reviewed-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/jbd2')
-rw-r--r-- | fs/jbd2/transaction.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 135f0a10f557..a43b63051355 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c | |||
@@ -1252,11 +1252,12 @@ int jbd2_journal_get_undo_access(handle_t *handle, struct buffer_head *bh) | |||
1252 | struct journal_head *jh; | 1252 | struct journal_head *jh; |
1253 | char *committed_data = NULL; | 1253 | char *committed_data = NULL; |
1254 | 1254 | ||
1255 | JBUFFER_TRACE(jh, "entry"); | ||
1256 | if (jbd2_write_access_granted(handle, bh, true)) | 1255 | if (jbd2_write_access_granted(handle, bh, true)) |
1257 | return 0; | 1256 | return 0; |
1258 | 1257 | ||
1259 | jh = jbd2_journal_add_journal_head(bh); | 1258 | jh = jbd2_journal_add_journal_head(bh); |
1259 | JBUFFER_TRACE(jh, "entry"); | ||
1260 | |||
1260 | /* | 1261 | /* |
1261 | * Do this first --- it can drop the journal lock, so we want to | 1262 | * Do this first --- it can drop the journal lock, so we want to |
1262 | * make sure that obtaining the committed_data is done | 1263 | * make sure that obtaining the committed_data is done |
@@ -1367,15 +1368,17 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) | |||
1367 | 1368 | ||
1368 | if (is_handle_aborted(handle)) | 1369 | if (is_handle_aborted(handle)) |
1369 | return -EROFS; | 1370 | return -EROFS; |
1370 | if (!buffer_jbd(bh)) { | 1371 | if (!buffer_jbd(bh)) |
1371 | ret = -EUCLEAN; | 1372 | return -EUCLEAN; |
1372 | goto out; | 1373 | |
1373 | } | ||
1374 | /* | 1374 | /* |
1375 | * We don't grab jh reference here since the buffer must be part | 1375 | * We don't grab jh reference here since the buffer must be part |
1376 | * of the running transaction. | 1376 | * of the running transaction. |
1377 | */ | 1377 | */ |
1378 | jh = bh2jh(bh); | 1378 | jh = bh2jh(bh); |
1379 | jbd_debug(5, "journal_head %p\n", jh); | ||
1380 | JBUFFER_TRACE(jh, "entry"); | ||
1381 | |||
1379 | /* | 1382 | /* |
1380 | * This and the following assertions are unreliable since we may see jh | 1383 | * This and the following assertions are unreliable since we may see jh |
1381 | * in inconsistent state unless we grab bh_state lock. But this is | 1384 | * in inconsistent state unless we grab bh_state lock. But this is |
@@ -1409,9 +1412,6 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh) | |||
1409 | } | 1412 | } |
1410 | 1413 | ||
1411 | journal = transaction->t_journal; | 1414 | journal = transaction->t_journal; |
1412 | jbd_debug(5, "journal_head %p\n", jh); | ||
1413 | JBUFFER_TRACE(jh, "entry"); | ||
1414 | |||
1415 | jbd_lock_bh_state(bh); | 1415 | jbd_lock_bh_state(bh); |
1416 | 1416 | ||
1417 | if (jh->b_modified == 0) { | 1417 | if (jh->b_modified == 0) { |