]> git.karo-electronics.de Git - linux-beck.git/commitdiff
xfs: trace AIL manipulations
authorDave Chinner <dchinner@redhat.com>
Fri, 1 Nov 2013 04:27:18 +0000 (15:27 +1100)
committerBen Myers <bpm@sgi.com>
Wed, 6 Nov 2013 18:41:51 +0000 (12:41 -0600)
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>
fs/xfs/xfs_log.c
fs/xfs/xfs_trace.h
fs/xfs/xfs_trans_ail.c

index 49dd41e6a2dcb4fe15e022b48d73456627c81e21..8497a00e399d0ba5960117c977376ae4a23cbbb3 100644 (file)
@@ -1076,6 +1076,7 @@ xlog_assign_tail_lsn_locked(
                tail_lsn = lip->li_lsn;
        else
                tail_lsn = atomic64_read(&log->l_last_sync_lsn);
+       trace_xfs_log_assign_tail_lsn(log, tail_lsn);
        atomic64_set(&log->l_tail_lsn, tail_lsn);
        return tail_lsn;
 }
index 47910e638c187fdd46470ca2c4ca975f2d3c1334..f195476a037c81de7a8f3464934553e9c6c9a324 100644 (file)
@@ -31,8 +31,8 @@ struct xfs_da_args;
 struct xfs_da_node_entry;
 struct xfs_dquot;
 struct xfs_log_item;
-struct xlog_ticket;
 struct xlog;
+struct xlog_ticket;
 struct xlog_recover;
 struct xlog_recover_item;
 struct xfs_buf_log_format;
@@ -938,6 +938,63 @@ DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
 DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
 DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
 
+DECLARE_EVENT_CLASS(xfs_ail_class,
+       TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
+       TP_ARGS(lip, old_lsn, new_lsn),
+       TP_STRUCT__entry(
+               __field(dev_t, dev)
+               __field(void *, lip)
+               __field(uint, type)
+               __field(uint, flags)
+               __field(xfs_lsn_t, old_lsn)
+               __field(xfs_lsn_t, new_lsn)
+       ),
+       TP_fast_assign(
+               __entry->dev = lip->li_mountp->m_super->s_dev;
+               __entry->lip = lip;
+               __entry->type = lip->li_type;
+               __entry->flags = lip->li_flags;
+               __entry->old_lsn = old_lsn;
+               __entry->new_lsn = new_lsn;
+       ),
+       TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
+                 MAJOR(__entry->dev), MINOR(__entry->dev),
+                 __entry->lip,
+                 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
+                 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
+                 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
+                 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
+)
+
+#define DEFINE_AIL_EVENT(name) \
+DEFINE_EVENT(xfs_ail_class, name, \
+       TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
+       TP_ARGS(lip, old_lsn, new_lsn))
+DEFINE_AIL_EVENT(xfs_ail_insert);
+DEFINE_AIL_EVENT(xfs_ail_move);
+DEFINE_AIL_EVENT(xfs_ail_delete);
+
+TRACE_EVENT(xfs_log_assign_tail_lsn,
+       TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
+       TP_ARGS(log, new_lsn),
+       TP_STRUCT__entry(
+               __field(dev_t, dev)
+               __field(xfs_lsn_t, new_lsn)
+               __field(xfs_lsn_t, old_lsn)
+               __field(xfs_lsn_t, last_sync_lsn)
+       ),
+       TP_fast_assign(
+               __entry->dev = log->l_mp->m_super->s_dev;
+               __entry->new_lsn = new_lsn;
+               __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
+               __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
+       ),
+       TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
+                 MAJOR(__entry->dev), MINOR(__entry->dev),
+                 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
+                 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
+                 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
+)
 
 DECLARE_EVENT_CLASS(xfs_file_class,
        TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
index 4b47cfebd25b8ad34f353469281484d4a8df1295..a7287354e53534b06e1816b189633d063f9e1548 100644 (file)
@@ -659,11 +659,13 @@ xfs_trans_ail_update_bulk(
                        if (XFS_LSN_CMP(lsn, lip->li_lsn) <= 0)
                                continue;
 
+                       trace_xfs_ail_move(lip, lip->li_lsn, lsn);
                        xfs_ail_delete(ailp, lip);
                        if (mlip == lip)
                                mlip_changed = 1;
                } else {
                        lip->li_flags |= XFS_LI_IN_AIL;
+                       trace_xfs_ail_insert(lip, 0, lsn);
                }
                lip->li_lsn = lsn;
                list_add(&lip->li_ail, &tmp);
@@ -732,6 +734,7 @@ xfs_trans_ail_delete_bulk(
                        return;
                }
 
+               trace_xfs_ail_delete(lip, mlip->li_lsn, lip->li_lsn);
                xfs_ail_delete(ailp, lip);
                lip->li_flags &= ~XFS_LI_IN_AIL;
                lip->li_lsn = 0;