Skip to content

Commit 1209d36

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: pass the iunlink item to the xfs_iunlink_update_dinode trace point
So that decoding is only done when tracing is actually enabled and the call site look a lot neater. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 487092c commit 1209d36

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

fs/xfs/xfs_iunlink_item.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ xfs_iunlink_log_dinode(
5252
struct xfs_trans *tp,
5353
struct xfs_iunlink_item *iup)
5454
{
55-
struct xfs_mount *mp = tp->t_mountp;
5655
struct xfs_inode *ip = iup->ip;
5756
struct xfs_dinode *dip;
5857
struct xfs_buf *ibp;
58+
xfs_agino_t old_ptr;
5959
int offset;
6060
int error;
6161

62-
error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &ibp);
62+
error = xfs_imap_to_bp(tp->t_mountp, tp, &ip->i_imap, &ibp);
6363
if (error)
6464
return error;
6565
/*
@@ -73,22 +73,21 @@ xfs_iunlink_log_dinode(
7373
dip = xfs_buf_offset(ibp, ip->i_imap.im_boffset);
7474

7575
/* Make sure the old pointer isn't garbage. */
76-
if (be32_to_cpu(dip->di_next_unlinked) != iup->old_agino) {
76+
old_ptr = be32_to_cpu(dip->di_next_unlinked);
77+
if (old_ptr != iup->old_agino) {
7778
xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, dip,
7879
sizeof(*dip), __this_address);
7980
error = -EFSCORRUPTED;
8081
goto out;
8182
}
8283

83-
trace_xfs_iunlink_update_dinode(mp, iup->pag->pag_agno,
84-
XFS_INO_TO_AGINO(mp, ip->i_ino),
85-
be32_to_cpu(dip->di_next_unlinked), iup->next_agino);
84+
trace_xfs_iunlink_update_dinode(iup, old_ptr);
8685

8786
dip->di_next_unlinked = cpu_to_be32(iup->next_agino);
8887
offset = ip->i_imap.im_boffset +
8988
offsetof(struct xfs_dinode, di_next_unlinked);
9089

91-
xfs_dinode_calc_crc(mp, dip);
90+
xfs_dinode_calc_crc(tp->t_mountp, dip);
9291
xfs_trans_inode_buf(tp, ibp);
9392
xfs_trans_log_buf(tp, ibp, offset, offset + sizeof(xfs_agino_t) - 1);
9493
return 0;

fs/xfs/xfs_trace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "xfs_fsmap.h"
3333
#include "xfs_btree_staging.h"
3434
#include "xfs_icache.h"
35+
#include "xfs_iunlink_item.h"
3536
#include "xfs_ag.h"
3637
#include "xfs_ag_resv.h"
3738
#include "xfs_error.h"

fs/xfs/xfs_trace.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ struct xfs_refcount_irec;
7474
struct xfs_fsmap;
7575
struct xfs_rmap_irec;
7676
struct xfs_icreate_log;
77+
struct xfs_iunlink_item;
7778
struct xfs_owner_info;
7879
struct xfs_trans_res;
7980
struct xfs_inobt_rec_incore;
@@ -4055,9 +4056,8 @@ TRACE_EVENT(xfs_iunlink_update_bucket,
40554056
);
40564057

40574058
TRACE_EVENT(xfs_iunlink_update_dinode,
4058-
TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
4059-
xfs_agino_t old_ptr, xfs_agino_t new_ptr),
4060-
TP_ARGS(mp, agno, agino, old_ptr, new_ptr),
4059+
TP_PROTO(const struct xfs_iunlink_item *iup, xfs_agino_t old_ptr),
4060+
TP_ARGS(iup, old_ptr),
40614061
TP_STRUCT__entry(
40624062
__field(dev_t, dev)
40634063
__field(xfs_agnumber_t, agno)
@@ -4066,11 +4066,12 @@ TRACE_EVENT(xfs_iunlink_update_dinode,
40664066
__field(xfs_agino_t, new_ptr)
40674067
),
40684068
TP_fast_assign(
4069-
__entry->dev = mp->m_super->s_dev;
4070-
__entry->agno = agno;
4071-
__entry->agino = agino;
4069+
__entry->dev = iup->pag->pag_mount->m_super->s_dev;
4070+
__entry->agno = iup->pag->pag_agno;
4071+
__entry->agino =
4072+
XFS_INO_TO_AGINO(iup->ip->i_mount, iup->ip->i_ino);
40724073
__entry->old_ptr = old_ptr;
4073-
__entry->new_ptr = new_ptr;
4074+
__entry->new_ptr = iup->next_agino;
40744075
),
40754076
TP_printk("dev %d:%d agno 0x%x agino 0x%x old 0x%x new 0x%x",
40764077
MAJOR(__entry->dev), MINOR(__entry->dev),

0 commit comments

Comments
 (0)