]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: pass the iunlink item to the xfs_iunlink_update_dinode trace point
authorChristoph Hellwig <hch@lst.de>
Sat, 31 Aug 2024 08:20:24 +0000 (11:20 +0300)
committerChristoph Hellwig <hch@lst.de>
Sun, 22 Sep 2024 05:37:28 +0000 (07:37 +0200)
So that decoding is only done when tracing is actually enabled and the
call site look a lot neater.

Signed-off-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_iunlink_item.c
fs/xfs/xfs_trace.c
fs/xfs/xfs_trace.h

index 2ddccb172fa013a90e15f4ecba88f9020e2abdcd..1fd70a7aed6347781c2373bdd401d39f23a36182 100644 (file)
@@ -52,14 +52,14 @@ xfs_iunlink_log_dinode(
        struct xfs_trans        *tp,
        struct xfs_iunlink_item *iup)
 {
-       struct xfs_mount        *mp = tp->t_mountp;
        struct xfs_inode        *ip = iup->ip;
        struct xfs_dinode       *dip;
        struct xfs_buf          *ibp;
+       xfs_agino_t             old_ptr;
        int                     offset;
        int                     error;
 
-       error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &ibp);
+       error = xfs_imap_to_bp(tp->t_mountp, tp, &ip->i_imap, &ibp);
        if (error)
                return error;
        /*
@@ -73,22 +73,21 @@ xfs_iunlink_log_dinode(
        dip = xfs_buf_offset(ibp, ip->i_imap.im_boffset);
 
        /* Make sure the old pointer isn't garbage. */
-       if (be32_to_cpu(dip->di_next_unlinked) != iup->old_agino) {
+       old_ptr = be32_to_cpu(dip->di_next_unlinked);
+       if (old_ptr != iup->old_agino) {
                xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, dip,
                                sizeof(*dip), __this_address);
                error = -EFSCORRUPTED;
                goto out;
        }
 
-       trace_xfs_iunlink_update_dinode(mp, iup->pag->pag_agno,
-                       XFS_INO_TO_AGINO(mp, ip->i_ino),
-                       be32_to_cpu(dip->di_next_unlinked), iup->next_agino);
+       trace_xfs_iunlink_update_dinode(iup, old_ptr);
 
        dip->di_next_unlinked = cpu_to_be32(iup->next_agino);
        offset = ip->i_imap.im_boffset +
                        offsetof(struct xfs_dinode, di_next_unlinked);
 
-       xfs_dinode_calc_crc(mp, dip);
+       xfs_dinode_calc_crc(tp->t_mountp, dip);
        xfs_trans_inode_buf(tp, ibp);
        xfs_trans_log_buf(tp, ibp, offset, offset + sizeof(xfs_agino_t) - 1);
        return 0;
index 2af9f274e8724e9ab081168e5b445e9c80e0f131..7ef50107224647436eb9e8bcfc1df110f0e38cea 100644 (file)
@@ -32,6 +32,7 @@
 #include "xfs_fsmap.h"
 #include "xfs_btree_staging.h"
 #include "xfs_icache.h"
+#include "xfs_iunlink_item.h"
 #include "xfs_ag.h"
 #include "xfs_ag_resv.h"
 #include "xfs_error.h"
index 43cc59bdf1c31ea6b4b9223686fec8698f30ffc6..c4a8c259428ababc58d6b77391faa843a1f90e41 100644 (file)
@@ -74,6 +74,7 @@ struct xfs_refcount_irec;
 struct xfs_fsmap;
 struct xfs_rmap_irec;
 struct xfs_icreate_log;
+struct xfs_iunlink_item;
 struct xfs_owner_info;
 struct xfs_trans_res;
 struct xfs_inobt_rec_incore;
@@ -4060,9 +4061,8 @@ TRACE_EVENT(xfs_iunlink_update_bucket,
 );
 
 TRACE_EVENT(xfs_iunlink_update_dinode,
-       TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
-                xfs_agino_t old_ptr, xfs_agino_t new_ptr),
-       TP_ARGS(mp, agno, agino, old_ptr, new_ptr),
+       TP_PROTO(const struct xfs_iunlink_item *iup, xfs_agino_t old_ptr),
+       TP_ARGS(iup, old_ptr),
        TP_STRUCT__entry(
                __field(dev_t, dev)
                __field(xfs_agnumber_t, agno)
@@ -4071,11 +4071,12 @@ TRACE_EVENT(xfs_iunlink_update_dinode,
                __field(xfs_agino_t, new_ptr)
        ),
        TP_fast_assign(
-               __entry->dev = mp->m_super->s_dev;
-               __entry->agno = agno;
-               __entry->agino = agino;
+               __entry->dev = iup->pag->pag_mount->m_super->s_dev;
+               __entry->agno = iup->pag->pag_agno;
+               __entry->agino =
+                       XFS_INO_TO_AGINO(iup->ip->i_mount, iup->ip->i_ino);
                __entry->old_ptr = old_ptr;
-               __entry->new_ptr = new_ptr;
+               __entry->new_ptr = iup->next_agino;
        ),
        TP_printk("dev %d:%d agno 0x%x agino 0x%x old 0x%x new 0x%x",
                  MAJOR(__entry->dev), MINOR(__entry->dev),