]> git.karo-electronics.de Git - linux-beck.git/commitdiff
xfs: add tracepoints to AGF/AGI read operations
authorDave Chinner <dchinner@redhat.com>
Fri, 1 Nov 2013 04:27:19 +0000 (15:27 +1100)
committerBen Myers <bpm@sgi.com>
Wed, 6 Nov 2013 18:42:52 +0000 (12:42 -0600)
To help track down AGI/AGF lock ordering issues, I added these
tracepoints to tell us when an AGI or AGF is read and locked.  With
these we can now determine if the lock ordering goes wrong from
tracing captures.

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_alloc.c
fs/xfs/xfs_ialloc.c
fs/xfs/xfs_trace.h

index bcf16528bac5dc87302294e0008557827978269a..9eab2dfdcbb54cc1337f4d6f248c808fcb2cc426 100644 (file)
@@ -2294,6 +2294,8 @@ xfs_read_agf(
 {
        int             error;
 
+       trace_xfs_read_agf(mp, agno);
+
        ASSERT(agno != NULLAGNUMBER);
        error = xfs_trans_read_buf(
                        mp, tp, mp->m_ddev_targp,
@@ -2324,8 +2326,9 @@ xfs_alloc_read_agf(
        struct xfs_perag        *pag;           /* per allocation group data */
        int                     error;
 
-       ASSERT(agno != NULLAGNUMBER);
+       trace_xfs_alloc_read_agf(mp, agno);
 
+       ASSERT(agno != NULLAGNUMBER);
        error = xfs_read_agf(mp, tp, agno,
                        (flags & XFS_ALLOC_FLAG_TRYLOCK) ? XBF_TRYLOCK : 0,
                        bpp);
index 14d732f61a410317442004f234a2e642399dd62b..e87719c5bebe128988a0993c4dc0f703cd3733ca 100644 (file)
@@ -40,6 +40,7 @@
 #include "xfs_icreate_item.h"
 #include "xfs_icache.h"
 #include "xfs_dinode.h"
+#include "xfs_trace.h"
 
 
 /*
@@ -1627,8 +1628,9 @@ xfs_read_agi(
 {
        int                     error;
 
-       ASSERT(agno != NULLAGNUMBER);
+       trace_xfs_read_agi(mp, agno);
 
+       ASSERT(agno != NULLAGNUMBER);
        error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
                        XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
                        XFS_FSS_TO_BB(mp, 1), 0, bpp, &xfs_agi_buf_ops);
@@ -1651,6 +1653,8 @@ xfs_ialloc_read_agi(
        struct xfs_perag        *pag;   /* per allocation group data */
        int                     error;
 
+       trace_xfs_ialloc_read_agi(mp, agno);
+
        error = xfs_read_agi(mp, tp, agno, bpp);
        if (error)
                return error;
index f195476a037c81de7a8f3464934553e9c6c9a324..425dfa45b9a087472676cf4f832138316d4b0fa4 100644 (file)
@@ -135,6 +135,31 @@ DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
 DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
 DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
 
+DECLARE_EVENT_CLASS(xfs_ag_class,
+       TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
+       TP_ARGS(mp, agno),
+       TP_STRUCT__entry(
+               __field(dev_t, dev)
+               __field(xfs_agnumber_t, agno)
+       ),
+       TP_fast_assign(
+               __entry->dev = mp->m_super->s_dev;
+               __entry->agno = agno;
+       ),
+       TP_printk("dev %d:%d agno %u",
+                 MAJOR(__entry->dev), MINOR(__entry->dev),
+                 __entry->agno)
+);
+#define DEFINE_AG_EVENT(name)  \
+DEFINE_EVENT(xfs_ag_class, name,       \
+       TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),    \
+       TP_ARGS(mp, agno))
+
+DEFINE_AG_EVENT(xfs_read_agf);
+DEFINE_AG_EVENT(xfs_alloc_read_agf);
+DEFINE_AG_EVENT(xfs_read_agi);
+DEFINE_AG_EVENT(xfs_ialloc_read_agi);
+
 TRACE_EVENT(xfs_attr_list_node_descend,
        TP_PROTO(struct xfs_attr_list_context *ctx,
                 struct xfs_da_node_entry *btree),