Hi, This patch changes the log_flush kernel trace point so that it actually gives you meaningful statistics about the journal:
Output looks like this: gfs2_logd-10580 [009] .... 1390.398627: gfs2_log_flush: 253,8 log flush start 8532 r:0 cr:0 v:0 f:5002 n:6153 h:5570/5570 t:2380 a1:2 a2:0 o:1 l:0 i:1 r: sd_log_blks_reserved cr: sd_log_commited_revoke v: sd_log_num_revoke f: sd_log_blks_free n: sd_log_blks_needed h: sd_log_head / sd_log_flush_head t: sd_log_tail a1: count of items on the sd_ail1_list a2: count of items on the sd_ail2_list o: count of items on the sd_log_le_ordered list l: sd_log_in_flight i: sd_log_idle Signed-off-by: Bob Peterson <rpete...@redhat.com> --- diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h index 49ac55d..cdecd1c 100644 --- a/fs/gfs2/trace_gfs2.h +++ b/fs/gfs2/trace_gfs2.h @@ -73,6 +73,16 @@ static inline u8 glock_trace_state(unsigned int state) } return DLM_LOCK_NL; } + +static inline const unsigned int list_count(const struct list_head *head) +{ + const struct list_head *tmp; + unsigned int count = 0; + list_for_each(tmp, head) + count++; + return count; +} + #endif /* Section 1 - Locking @@ -359,18 +369,58 @@ TRACE_EVENT(gfs2_log_flush, __field( dev_t, dev ) __field( int, start ) __field( u64, log_seq ) + __field( unsigned int, sd_log_blks_reserved ) + __field( int, sd_log_commited_revoke ) + __field( unsigned int, sd_log_num_revoke ) + __field( int, sd_log_blks_free ) + __field( int, sd_log_blks_needed ) + __field( unsigned int, sd_log_head ) + __field( unsigned int, sd_log_flush_head ) + __field( unsigned int, sd_log_tail ) + __field( unsigned int, ail1_count ) + __field( unsigned int, ail2_count ) + __field( unsigned int, ordered_count ) + __field( int, sd_log_in_flight ) + __field( int, sd_log_idle ) ), TP_fast_assign( __entry->dev = sdp->sd_vfs->s_dev; __entry->start = start; __entry->log_seq = sdp->sd_log_sequence; + __entry->sd_log_blks_reserved = sdp->sd_log_blks_reserved; + __entry->sd_log_commited_revoke = sdp->sd_log_commited_revoke; + __entry->sd_log_num_revoke = sdp->sd_log_num_revoke; + __entry->sd_log_blks_free = atomic_read(&sdp->sd_log_blks_free); + __entry->sd_log_blks_needed = atomic_read(&sdp->sd_log_blks_needed); + __entry->sd_log_head = sdp->sd_log_head; + __entry->sd_log_flush_head = sdp->sd_log_flush_head; + __entry->sd_log_tail = sdp->sd_log_tail; + __entry->ail1_count = list_count(&sdp->sd_ail1_list); + __entry->ail2_count = list_count(&sdp->sd_ail2_list); + __entry->ordered_count = list_count(&sdp->sd_log_le_ordered); + __entry->sd_log_in_flight = atomic_read(&sdp->sd_log_in_flight); + __entry->sd_log_idle = sdp->sd_log_idle; ), - TP_printk("%u,%u log flush %s %llu", + TP_printk("%u,%u log flush %s %llu r:%u cr:%d v:%u " + "f:%d n:%d h:%u/%u t:%u a1:%u a2:%u o:%u l:%d i:%d", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->start ? "start" : "end", - (unsigned long long)__entry->log_seq) + (unsigned long long)__entry->log_seq, + __entry->sd_log_blks_reserved, + __entry->sd_log_commited_revoke, + __entry->sd_log_num_revoke, + __entry->sd_log_blks_free, + __entry->sd_log_blks_needed, + __entry->sd_log_head, + __entry->sd_log_flush_head, + __entry->sd_log_tail, + __entry->ail1_count, + __entry->ail2_count, + __entry->ordered_count, + __entry->sd_log_in_flight, + __entry->sd_log_idle) ); /* Reserving/releasing blocks in the log */