Commit b2f6b759 authored by Jan Kara's avatar Jan Kara Committed by Kleber Sacilotto de Souza

jbd2: Fix statistics for the number of logged blocks

BugLink: https://bugs.launchpad.net/bugs/1858462

[ Upstream commit 015c6033 ]

jbd2 statistics counting number of blocks logged in a transaction was
wrong. It didn't count the commit block and more importantly it didn't
count revoke descriptor blocks. Make sure these get properly counted.
Reviewed-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20191105164437.32602-13-jack@suse.czSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 570e08eb
...@@ -740,7 +740,6 @@ void jbd2_journal_commit_transaction(journal_t *journal) ...@@ -740,7 +740,6 @@ void jbd2_journal_commit_transaction(journal_t *journal)
submit_bh(WRITE_SYNC, bh); submit_bh(WRITE_SYNC, bh);
} }
cond_resched(); cond_resched();
stats.run.rs_blocks_logged += bufs;
/* Force a new descriptor to be generated next /* Force a new descriptor to be generated next
time round the loop. */ time round the loop. */
...@@ -827,6 +826,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) ...@@ -827,6 +826,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
if (unlikely(!buffer_uptodate(bh))) if (unlikely(!buffer_uptodate(bh)))
err = -EIO; err = -EIO;
jbd2_unfile_log_bh(bh); jbd2_unfile_log_bh(bh);
stats.run.rs_blocks_logged++;
/* /*
* The list contains temporary buffer heads created by * The list contains temporary buffer heads created by
...@@ -872,6 +872,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) ...@@ -872,6 +872,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile"); BUFFER_TRACE(bh, "ph5: control buffer writeout done: unfile");
clear_buffer_jwrite(bh); clear_buffer_jwrite(bh);
jbd2_unfile_log_bh(bh); jbd2_unfile_log_bh(bh);
stats.run.rs_blocks_logged++;
__brelse(bh); /* One for getblk */ __brelse(bh); /* One for getblk */
/* AKPM: bforget here */ /* AKPM: bforget here */
} }
...@@ -893,6 +894,7 @@ void jbd2_journal_commit_transaction(journal_t *journal) ...@@ -893,6 +894,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
} }
if (cbh) if (cbh)
err = journal_wait_on_commit_record(journal, cbh); err = journal_wait_on_commit_record(journal, cbh);
stats.run.rs_blocks_logged++;
if (jbd2_has_feature_async_commit(journal) && if (jbd2_has_feature_async_commit(journal) &&
journal->j_flags & JBD2_BARRIER) { journal->j_flags & JBD2_BARRIER) {
blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL); blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment