aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2013-11-01 00:27:18 -0400
committerBen Myers <bpm@sgi.com>2013-11-06 13:41:51 -0500
commit750b9c90668b173a92b20e747b9736b8537eda5a (patch)
tree2927a0bd0072fc35c2436e62d4f720ea381bc5fa /fs
parent273203699f82667296e1f14344c5a5a6c4600470 (diff)
xfs: trace AIL manipulations
I debugging a log tail issue on a RHEL6 kernel, I added these trace points to trace log items being added, moved and removed in the AIL and how that affected the log tail LSN that was written to the log. They were very helpful in that they immediately identified the cause of the problem being seen. Hence I'd like to always have them available for use. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_log.c1
-rw-r--r--fs/xfs/xfs_trace.h59
-rw-r--r--fs/xfs/xfs_trans_ail.c3
3 files changed, 62 insertions, 1 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 49dd41e6a2dc..8497a00e399d 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1076,6 +1076,7 @@ xlog_assign_tail_lsn_locked(
1076 tail_lsn = lip->li_lsn; 1076 tail_lsn = lip->li_lsn;
1077 else 1077 else
1078 tail_lsn = atomic64_read(&log->l_last_sync_lsn); 1078 tail_lsn = atomic64_read(&log->l_last_sync_lsn);
1079 trace_xfs_log_assign_tail_lsn(log, tail_lsn);
1079 atomic64_set(&log->l_tail_lsn, tail_lsn); 1080 atomic64_set(&log->l_tail_lsn, tail_lsn);
1080 return tail_lsn; 1081 return tail_lsn;
1081} 1082}
diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
index 47910e638c18..f195476a037c 100644
--- a/fs/xfs/xfs_trace.h
+++ b/fs/xfs/xfs_trace.h
@@ -31,8 +31,8 @@ struct xfs_da_args;
31struct xfs_da_node_entry; 31struct xfs_da_node_entry;
32struct xfs_dquot; 32struct xfs_dquot;
33struct xfs_log_item; 33struct xfs_log_item;
34struct xlog_ticket;
35struct xlog; 34struct xlog;
35struct xlog_ticket;
36struct xlog_recover; 36struct xlog_recover;
37struct xlog_recover_item; 37struct xlog_recover_item;
38struct xfs_buf_log_format; 38struct xfs_buf_log_format;
@@ -938,6 +938,63 @@ DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
938DEFINE_LOG_ITEM_EVENT(xfs_ail_locked); 938DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
939DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing); 939DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
940 940
941DECLARE_EVENT_CLASS(xfs_ail_class,
942 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
943 TP_ARGS(lip, old_lsn, new_lsn),
944 TP_STRUCT__entry(
945 __field(dev_t, dev)
946 __field(void *, lip)
947 __field(uint, type)
948 __field(uint, flags)
949 __field(xfs_lsn_t, old_lsn)
950 __field(xfs_lsn_t, new_lsn)
951 ),
952 TP_fast_assign(
953 __entry->dev = lip->li_mountp->m_super->s_dev;
954 __entry->lip = lip;
955 __entry->type = lip->li_type;
956 __entry->flags = lip->li_flags;
957 __entry->old_lsn = old_lsn;
958 __entry->new_lsn = new_lsn;
959 ),
960 TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
961 MAJOR(__entry->dev), MINOR(__entry->dev),
962 __entry->lip,
963 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
964 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
965 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
966 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
967)
968
969#define DEFINE_AIL_EVENT(name) \
970DEFINE_EVENT(xfs_ail_class, name, \
971 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
972 TP_ARGS(lip, old_lsn, new_lsn))
973DEFINE_AIL_EVENT(xfs_ail_insert);
974DEFINE_AIL_EVENT(xfs_ail_move);
975DEFINE_AIL_EVENT(xfs_ail_delete);
976
977TRACE_EVENT(xfs_log_assign_tail_lsn,
978 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
979 TP_ARGS(log, new_lsn),
980 TP_STRUCT__entry(
981 __field(dev_t, dev)
982 __field(xfs_lsn_t, new_lsn)
983 __field(xfs_lsn_t, old_lsn)
984 __field(xfs_lsn_t, last_sync_lsn)
985 ),
986 TP_fast_assign(
987 __entry->dev = log->l_mp->m_super->s_dev;
988 __entry->new_lsn = new_lsn;
989 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
990 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
991 ),
992 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
993 MAJOR(__entry->dev), MINOR(__entry->dev),
994 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
995 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
996 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
997)
941 998
942DECLARE_EVENT_CLASS(xfs_file_class, 999DECLARE_EVENT_CLASS(xfs_file_class,
943 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), 1000 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
index 4b47cfebd25b..a7287354e535 100644
--- a/fs/xfs/xfs_trans_ail.c
+++ b/fs/xfs/xfs_trans_ail.c
@@ -659,11 +659,13 @@ xfs_trans_ail_update_bulk(
659 if (XFS_LSN_CMP(lsn, lip->li_lsn) <= 0) 659 if (XFS_LSN_CMP(lsn, lip->li_lsn) <= 0)
660 continue; 660 continue;
661 661
662 trace_xfs_ail_move(lip, lip->li_lsn, lsn);
662 xfs_ail_delete(ailp, lip); 663 xfs_ail_delete(ailp, lip);
663 if (mlip == lip) 664 if (mlip == lip)
664 mlip_changed = 1; 665 mlip_changed = 1;
665 } else { 666 } else {
666 lip->li_flags |= XFS_LI_IN_AIL; 667 lip->li_flags |= XFS_LI_IN_AIL;
668 trace_xfs_ail_insert(lip, 0, lsn);
667 } 669 }
668 lip->li_lsn = lsn; 670 lip->li_lsn = lsn;
669 list_add(&lip->li_ail, &tmp); 671 list_add(&lip->li_ail, &tmp);
@@ -732,6 +734,7 @@ xfs_trans_ail_delete_bulk(
732 return; 734 return;
733 } 735 }
734 736
737 trace_xfs_ail_delete(lip, mlip->li_lsn, lip->li_lsn);
735 xfs_ail_delete(ailp, lip); 738 xfs_ail_delete(ailp, lip);
736 lip->li_flags &= ~XFS_LI_IN_AIL; 739 lip->li_flags &= ~XFS_LI_IN_AIL;
737 lip->li_lsn = 0; 740 lip->li_lsn = 0;