aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jbd2/transaction.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-02-08 13:00:22 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-02-08 13:00:22 -0500
commit343d9c283c9847da043fda3e76e3197f27b667dd (patch)
tree6c37b7cd1d9eeb711fa1aeffee1930e446c406f8 /fs/jbd2/transaction.c
parent078d5039a13dedbd2ed14153a6d764fd75baae07 (diff)
jbd2: add tracepoints which provide per-handle statistics
Handles which stay open a long time are problematic when it comes time to close down a transaction so it can be committed. These tracepoints will help us determine which ones are the problematic ones, and to validate whether changes makes things better or worse. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/jbd2/transaction.c')
-rw-r--r--fs/jbd2/transaction.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 735609e2d636..b7e2385c6e92 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -30,6 +30,8 @@
30#include <linux/bug.h> 30#include <linux/bug.h>
31#include <linux/module.h> 31#include <linux/module.h>
32 32
33#include <trace/events/jbd2.h>
34
33static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh); 35static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh);
34static void __jbd2_journal_unfile_buffer(struct journal_head *jh); 36static void __jbd2_journal_unfile_buffer(struct journal_head *jh);
35 37
@@ -307,6 +309,8 @@ repeat:
307 */ 309 */
308 update_t_max_wait(transaction, ts); 310 update_t_max_wait(transaction, ts);
309 handle->h_transaction = transaction; 311 handle->h_transaction = transaction;
312 handle->h_requested_credits = nblocks;
313 handle->h_start_jiffies = jiffies;
310 atomic_inc(&transaction->t_updates); 314 atomic_inc(&transaction->t_updates);
311 atomic_inc(&transaction->t_handle_count); 315 atomic_inc(&transaction->t_handle_count);
312 jbd_debug(4, "Handle %p given %d credits (total %d, free %d)\n", 316 jbd_debug(4, "Handle %p given %d credits (total %d, free %d)\n",
@@ -353,7 +357,8 @@ static handle_t *new_handle(int nblocks)
353 * Return a pointer to a newly allocated handle, or an ERR_PTR() value 357 * Return a pointer to a newly allocated handle, or an ERR_PTR() value
354 * on failure. 358 * on failure.
355 */ 359 */
356handle_t *jbd2__journal_start(journal_t *journal, int nblocks, gfp_t gfp_mask) 360handle_t *jbd2__journal_start(journal_t *journal, int nblocks, gfp_t gfp_mask,
361 unsigned int type, unsigned int line_no)
357{ 362{
358 handle_t *handle = journal_current_handle(); 363 handle_t *handle = journal_current_handle();
359 int err; 364 int err;
@@ -379,6 +384,11 @@ handle_t *jbd2__journal_start(journal_t *journal, int nblocks, gfp_t gfp_mask)
379 current->journal_info = NULL; 384 current->journal_info = NULL;
380 handle = ERR_PTR(err); 385 handle = ERR_PTR(err);
381 } 386 }
387 handle->h_type = type;
388 handle->h_line_no = line_no;
389 trace_jbd2_handle_start(journal->j_fs_dev->bd_dev,
390 handle->h_transaction->t_tid, type,
391 line_no, nblocks);
382 return handle; 392 return handle;
383} 393}
384EXPORT_SYMBOL(jbd2__journal_start); 394EXPORT_SYMBOL(jbd2__journal_start);
@@ -386,7 +396,7 @@ EXPORT_SYMBOL(jbd2__journal_start);
386 396
387handle_t *jbd2_journal_start(journal_t *journal, int nblocks) 397handle_t *jbd2_journal_start(journal_t *journal, int nblocks)
388{ 398{
389 return jbd2__journal_start(journal, nblocks, GFP_NOFS); 399 return jbd2__journal_start(journal, nblocks, GFP_NOFS, 0, 0);
390} 400}
391EXPORT_SYMBOL(jbd2_journal_start); 401EXPORT_SYMBOL(jbd2_journal_start);
392 402
@@ -448,7 +458,14 @@ int jbd2_journal_extend(handle_t *handle, int nblocks)
448 goto unlock; 458 goto unlock;
449 } 459 }
450 460
461 trace_jbd2_handle_extend(journal->j_fs_dev->bd_dev,
462 handle->h_transaction->t_tid,
463 handle->h_type, handle->h_line_no,
464 handle->h_buffer_credits,
465 nblocks);
466
451 handle->h_buffer_credits += nblocks; 467 handle->h_buffer_credits += nblocks;
468 handle->h_requested_credits += nblocks;
452 atomic_add(nblocks, &transaction->t_outstanding_credits); 469 atomic_add(nblocks, &transaction->t_outstanding_credits);
453 result = 0; 470 result = 0;
454 471
@@ -1377,6 +1394,13 @@ int jbd2_journal_stop(handle_t *handle)
1377 } 1394 }
1378 1395
1379 jbd_debug(4, "Handle %p going down\n", handle); 1396 jbd_debug(4, "Handle %p going down\n", handle);
1397 trace_jbd2_handle_stats(journal->j_fs_dev->bd_dev,
1398 handle->h_transaction->t_tid,
1399 handle->h_type, handle->h_line_no,
1400 jiffies - handle->h_start_jiffies,
1401 handle->h_sync, handle->h_requested_credits,
1402 (handle->h_requested_credits -
1403 handle->h_buffer_credits));
1380 1404
1381 /* 1405 /*
1382 * Implement synchronous transaction batching. If the handle 1406 * Implement synchronous transaction batching. If the handle