Skip to content

Commit fc48627

Browse files
Dave Chinnercmaiolino
authored andcommitted
xfs: add tracepoints for stale pinned inode state debug
I needed more insight into how stale inodes were getting stuck on the AIL after a forced shutdown when running fsstress. These are the tracepoints I added for that purpose. Signed-off-by: Dave Chinner <[email protected]> Reviewed-by: Carlos Maiolino <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent d62016b commit fc48627

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

fs/xfs/xfs_inode_item.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,11 +758,14 @@ xfs_inode_item_push(
758758
* completed and items removed from the AIL before the next push
759759
* attempt.
760760
*/
761+
trace_xfs_inode_push_stale(ip, _RET_IP_);
761762
return XFS_ITEM_PINNED;
762763
}
763764

764-
if (xfs_ipincount(ip) > 0 || xfs_buf_ispinned(bp))
765+
if (xfs_ipincount(ip) > 0 || xfs_buf_ispinned(bp)) {
766+
trace_xfs_inode_push_pinned(ip, _RET_IP_);
765767
return XFS_ITEM_PINNED;
768+
}
766769

767770
if (xfs_iflags_test(ip, XFS_IFLUSHING))
768771
return XFS_ITEM_FLUSHING;

fs/xfs/xfs_log_cil.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -793,8 +793,10 @@ xlog_cil_ail_insert(
793793
struct xfs_log_item *lip = lv->lv_item;
794794
xfs_lsn_t item_lsn;
795795

796-
if (aborted)
796+
if (aborted) {
797+
trace_xlog_ail_insert_abort(lip);
797798
set_bit(XFS_LI_ABORTED, &lip->li_flags);
799+
}
798800

799801
if (lip->li_ops->flags & XFS_ITEM_RELEASE_WHEN_COMMITTED) {
800802
lip->li_ops->iop_release(lip);

fs/xfs/xfs_trace.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1146,20 +1146,23 @@ DECLARE_EVENT_CLASS(xfs_iref_class,
11461146
__field(xfs_ino_t, ino)
11471147
__field(int, count)
11481148
__field(int, pincount)
1149+
__field(unsigned long, iflags)
11491150
__field(unsigned long, caller_ip)
11501151
),
11511152
TP_fast_assign(
11521153
__entry->dev = VFS_I(ip)->i_sb->s_dev;
11531154
__entry->ino = ip->i_ino;
11541155
__entry->count = atomic_read(&VFS_I(ip)->i_count);
11551156
__entry->pincount = atomic_read(&ip->i_pincount);
1157+
__entry->iflags = ip->i_flags;
11561158
__entry->caller_ip = caller_ip;
11571159
),
1158-
TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
1160+
TP_printk("dev %d:%d ino 0x%llx count %d pincount %d iflags 0x%lx caller %pS",
11591161
MAJOR(__entry->dev), MINOR(__entry->dev),
11601162
__entry->ino,
11611163
__entry->count,
11621164
__entry->pincount,
1165+
__entry->iflags,
11631166
(char *)__entry->caller_ip)
11641167
)
11651168

@@ -1249,6 +1252,8 @@ DEFINE_IREF_EVENT(xfs_irele);
12491252
DEFINE_IREF_EVENT(xfs_inode_pin);
12501253
DEFINE_IREF_EVENT(xfs_inode_unpin);
12511254
DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
1255+
DEFINE_IREF_EVENT(xfs_inode_push_pinned);
1256+
DEFINE_IREF_EVENT(xfs_inode_push_stale);
12521257

12531258
DECLARE_EVENT_CLASS(xfs_namespace_class,
12541259
TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name),
@@ -1653,6 +1658,8 @@ DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
16531658
DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_mark);
16541659
DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_skip);
16551660
DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_unpin);
1661+
DEFINE_LOG_ITEM_EVENT(xlog_ail_insert_abort);
1662+
DEFINE_LOG_ITEM_EVENT(xfs_trans_free_abort);
16561663

16571664
DECLARE_EVENT_CLASS(xfs_ail_class,
16581665
TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),

fs/xfs/xfs_trans.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,8 +742,10 @@ xfs_trans_free_items(
742742

743743
list_for_each_entry_safe(lip, next, &tp->t_items, li_trans) {
744744
xfs_trans_del_item(lip);
745-
if (abort)
745+
if (abort) {
746+
trace_xfs_trans_free_abort(lip);
746747
set_bit(XFS_LI_ABORTED, &lip->li_flags);
748+
}
747749
if (lip->li_ops->iop_release)
748750
lip->li_ops->iop_release(lip);
749751
}

0 commit comments

Comments
 (0)