aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/jbd2.h
diff options
context:
space:
mode:
authorJohann Lombardi <johann.lombardi@bull.net>2008-01-28 23:58:27 -0500
committerTheodore Ts'o <tytso@mit.edu>2008-01-28 23:58:27 -0500
commit8e85fb3f305b24b79c6d9cb7a56d22b062335ad3 (patch)
tree9b037c1b1649bce1338911fd8ca3980229c1548a /include/linux/jbd2.h
parent4df3d265bf8f3762e1d77f554ee279c39dedb020 (diff)
jbd2: jbd2 stats through procfs
The patch below updates the jbd stats patch to 2.6.20/jbd2. The initial patch was posted by Alex Tomas in December 2005 (http://marc.info/?l=linux-ext4&m=113538565128617&w=2). It provides statistics via procfs such as transaction lifetime and size. Sometimes, investigating performance problems, i find useful to have stats from jbd about transaction's lifetime, size, etc. here is a patch for review and inclusion probably. for example, stats after creation of 3M files in htree directory: [root@bob ~]# cat /proc/fs/jbd/sda/history R/C tid wait run lock flush log hndls block inlog ctime write drop close R 261 8260 2720 0 0 750 9892 8170 8187 C 259 750 0 4885 1 R 262 20 2200 10 0 770 9836 8170 8187 R 263 30 2200 10 0 3070 9812 8170 8187 R 264 0 5000 10 0 1340 0 0 0 C 261 8240 3212 4957 0 R 265 8260 1470 0 0 4640 9854 8170 8187 R 266 0 5000 10 0 1460 0 0 0 C 262 8210 2989 4868 0 R 267 8230 1490 10 0 4440 9875 8171 8188 R 268 0 5000 10 0 1260 0 0 0 C 263 7710 2937 4908 0 R 269 7730 1470 10 0 3330 9841 8170 8187 R 270 0 5000 10 0 830 0 0 0 C 265 8140 3234 4898 0 C 267 720 0 4849 1 R 271 8630 2740 20 0 740 9819 8170 8187 C 269 800 0 4214 1 R 272 40 2170 10 0 830 9716 8170 8187 R 273 40 2280 0 0 3530 9799 8170 8187 R 274 0 5000 10 0 990 0 0 0 where, R - line for transaction's life from T_RUNNING to T_FINISHED C - line for transaction's checkpointing tid - transaction's id wait - for how long we were waiting for new transaction to start (the longest period journal_start() took in this transaction) run - real transaction's lifetime (from T_RUNNING to T_LOCKED lock - how long we were waiting for all handles to close (time the transaction was in T_LOCKED) flush - how long it took to flush all data (data=ordered) log - how long it took to write the transaction to the log hndls - how many handles got to the transaction block - how many blocks got to the transaction inlog - how many blocks are written to the log (block + descriptors) ctime - how long it took to checkpoint the transaction write - how many blocks have been written during checkpointing drop - how many blocks have been dropped during checkpointing close - how many running transactions have been closed to checkpoint this one all times are in msec. [root@bob ~]# cat /proc/fs/jbd/sda/info 280 transaction, each upto 8192 blocks average: 1633ms waiting for transaction 3616ms running transaction 5ms transaction was being locked 1ms flushing data (in ordered mode) 1799ms logging transaction 11781 handles per transaction 5629 blocks per transaction 5641 logged blocks per transaction Signed-off-by: Johann Lombardi <johann.lombardi@bull.net> Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'include/linux/jbd2.h')
-rw-r--r--include/linux/jbd2.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index d861ffd49821..685640036e81 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -395,6 +395,16 @@ struct handle_s
395}; 395};
396 396
397 397
398/*
399 * Some stats for checkpoint phase
400 */
401struct transaction_chp_stats_s {
402 unsigned long cs_chp_time;
403 unsigned long cs_forced_to_close;
404 unsigned long cs_written;
405 unsigned long cs_dropped;
406};
407
398/* The transaction_t type is the guts of the journaling mechanism. It 408/* The transaction_t type is the guts of the journaling mechanism. It
399 * tracks a compound transaction through its various states: 409 * tracks a compound transaction through its various states:
400 * 410 *
@@ -532,6 +542,21 @@ struct transaction_s
532 spinlock_t t_handle_lock; 542 spinlock_t t_handle_lock;
533 543
534 /* 544 /*
545 * Longest time some handle had to wait for running transaction
546 */
547 unsigned long t_max_wait;
548
549 /*
550 * When transaction started
551 */
552 unsigned long t_start;
553
554 /*
555 * Checkpointing stats [j_checkpoint_sem]
556 */
557 struct transaction_chp_stats_s t_chp_stats;
558
559 /*
535 * Number of outstanding updates running on this transaction 560 * Number of outstanding updates running on this transaction
536 * [t_handle_lock] 561 * [t_handle_lock]
537 */ 562 */
@@ -562,6 +587,39 @@ struct transaction_s
562 587
563}; 588};
564 589
590struct transaction_run_stats_s {
591 unsigned long rs_wait;
592 unsigned long rs_running;
593 unsigned long rs_locked;
594 unsigned long rs_flushing;
595 unsigned long rs_logging;
596
597 unsigned long rs_handle_count;
598 unsigned long rs_blocks;
599 unsigned long rs_blocks_logged;
600};
601
602struct transaction_stats_s {
603 int ts_type;
604 unsigned long ts_tid;
605 union {
606 struct transaction_run_stats_s run;
607 struct transaction_chp_stats_s chp;
608 } u;
609};
610
611#define JBD2_STATS_RUN 1
612#define JBD2_STATS_CHECKPOINT 2
613
614static inline unsigned long
615jbd2_time_diff(unsigned long start, unsigned long end)
616{
617 if (end >= start)
618 return end - start;
619
620 return end + (MAX_JIFFY_OFFSET - start);
621}
622
565/** 623/**
566 * struct journal_s - The journal_s type is the concrete type associated with 624 * struct journal_s - The journal_s type is the concrete type associated with
567 * journal_t. 625 * journal_t.
@@ -623,6 +681,12 @@ struct transaction_s
623 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the 681 * @j_wbufsize: maximum number of buffer_heads allowed in j_wbuf, the
624 * number that will fit in j_blocksize 682 * number that will fit in j_blocksize
625 * @j_last_sync_writer: most recent pid which did a synchronous write 683 * @j_last_sync_writer: most recent pid which did a synchronous write
684 * @j_history: Buffer storing the transactions statistics history
685 * @j_history_max: Maximum number of transactions in the statistics history
686 * @j_history_cur: Current number of transactions in the statistics history
687 * @j_history_lock: Protect the transactions statistics history
688 * @j_proc_entry: procfs entry for the jbd statistics directory
689 * @j_stats: Overall statistics
626 * @j_private: An opaque pointer to fs-private information. 690 * @j_private: An opaque pointer to fs-private information.
627 */ 691 */
628 692
@@ -815,6 +879,19 @@ struct journal_s
815 pid_t j_last_sync_writer; 879 pid_t j_last_sync_writer;
816 880
817 /* 881 /*
882 * Journal statistics
883 */
884 struct transaction_stats_s *j_history;
885 int j_history_max;
886 int j_history_cur;
887 /*
888 * Protect the transactions statistics history
889 */
890 spinlock_t j_history_lock;
891 struct proc_dir_entry *j_proc_entry;
892 struct transaction_stats_s j_stats;
893
894 /*
818 * An opaque pointer to fs-private information. ext3 puts its 895 * An opaque pointer to fs-private information. ext3 puts its
819 * superblock pointer here 896 * superblock pointer here
820 */ 897 */