Skip to contentSkip to conversation

xfs: record whichfork in iext tracepoints

PATCH In review Darrick J. Wong 2 participants 3 messages Jan 10, 2018 – Jan 11, 2018 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: record whichfork in iext tracepoints

From: Darrick J. Wong <[email protected]>

Record the whichfork number of the fork being operated on in iext tracepoints. This makes it easier to trace our way through complex remapping operations like copy on write.

---
 fs/xfs/xfs_trace.h |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
fs/xfs/xfs_trace.h +12 -3
index cd87985..1c38b79 100644
@@ -233,6 +233,7 @@ DECLARE_EVENT_CLASS(xfs_bmap_class,
 		__field(xfs_exntst_t, state)
 		__field(int, bmap_state)
 		__field(unsigned long, caller_ip)
+		__field(int, whichfork)
 	),
 	TP_fast_assign(
 		struct xfs_ifork	*ifp;
@@ -250,11 +251,19 @@ DECLARE_EVENT_CLASS(xfs_bmap_class,
 		__entry->state = r.br_state;
 		__entry->bmap_state = state;
 		__entry->caller_ip = caller_ip;
-	),
-	TP_printk("dev %d:%d ino 0x%llx state %s cur 0x%p/%d "
+		if (ifp == XFS_IFORK_PTR(ip, XFS_DATA_FORK))
+			__entry->whichfork = XFS_DATA_FORK;
+		else if (ifp == XFS_IFORK_PTR(ip, XFS_ATTR_FORK))
+			__entry->whichfork = XFS_ATTR_FORK;
+		else if (ifp == XFS_IFORK_PTR(ip, XFS_COW_FORK))
+			__entry->whichfork = XFS_COW_FORK;
+		else
+			__entry->whichfork = -1;
+	),
+	TP_printk("dev %d:%d ino 0x%llx fork %d state %s cur 0x%p/%d "
 		  "offset %lld block %lld count %lld flag %d caller %ps",
 		  MAJOR(__entry->dev), MINOR(__entry->dev),
-		  __entry->ino,
+		  __entry->ino, __entry->whichfork,
 		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
 		  __entry->leaf,
 		  __entry->pos,
#1 lore raw
Quoted 34 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Record the whichfork number of the fork being operated on in iext tracepoints. This makes it easier to trace our way through complex remapping operations like copy on write.

---
 fs/xfs/xfs_trace.h |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
fs/xfs/xfs_trace.h +6 -2
index cd87985..1c38b79 100644
@@ -233,6 +233,7 @@ DECLARE_EVENT_CLASS(xfs_bmap_class,
 		__field(xfs_exntst_t, state)
 		__field(int, bmap_state)
 		__field(unsigned long, caller_ip)
+		__field(int, whichfork)
 	),
 	TP_fast_assign(
 		struct xfs_ifork	*ifp;
@@ -250,11 +251,19 @@ DECLARE_EVENT_CLASS(xfs_bmap_class,
 		__entry->state = r.br_state;
 		__entry->bmap_state = state;
 		__entry->caller_ip = caller_ip;
-	),
-	TP_printk("dev %d:%d ino 0x%llx state %s cur 0x%p/%d "
+		if (ifp == XFS_IFORK_PTR(ip, XFS_DATA_FORK))
+			__entry->whichfork = XFS_DATA_FORK;
+		else if (ifp == XFS_IFORK_PTR(ip, XFS_ATTR_FORK))
+			__entry->whichfork = XFS_ATTR_FORK;
+		else if (ifp == XFS_IFORK_PTR(ip, XFS_COW_FORK))

fs/xfs/xfs_trace.h DECLARE_EVENT_CLASS(xfs_bmap_class, · line 267

Quoted 10 lines
fs/xfs/xfs_trace.h +6 -1
+			__entry->whichfork = XFS_COW_FORK;
+		else
+			__entry->whichfork = -1;
+	),
+	TP_printk("dev %d:%d ino 0x%llx fork %d state %s cur 0x%p/%d "
 		  "offset %lld block %lld count %lld flag %d caller %ps",
 		  MAJOR(__entry->dev), MINOR(__entry->dev),
-		  __entry->ino,
+		  __entry->ino, __entry->whichfork,
 		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),

Doesn't ->bmap_state include this information? Looks like attr/cow strings are included in the EXT_FLAGS list as well.

Brian

Quoted 6 lines
fs/xfs/xfs_trace.h +0 -1
 		  __entry->leaf,
 		  __entry->pos,
--

To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 40 lines · Brian Foster
Quoted 39 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Record the whichfork number of the fork being operated on in iext tracepoints. This makes it easier to trace our way through complex remapping operations like copy on write.

---
 fs/xfs/xfs_trace.h |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
fs/xfs/xfs_trace.h +11 -2
index cd87985..1c38b79 100644
@@ -233,6 +233,7 @@ DECLARE_EVENT_CLASS(xfs_bmap_class,
 		__field(xfs_exntst_t, state)
 		__field(int, bmap_state)
 		__field(unsigned long, caller_ip)
+		__field(int, whichfork)
 	),
 	TP_fast_assign(
 		struct xfs_ifork	*ifp;
@@ -250,11 +251,19 @@ DECLARE_EVENT_CLASS(xfs_bmap_class,
 		__entry->state = r.br_state;
 		__entry->bmap_state = state;
 		__entry->caller_ip = caller_ip;
-	),
-	TP_printk("dev %d:%d ino 0x%llx state %s cur 0x%p/%d "
+		if (ifp == XFS_IFORK_PTR(ip, XFS_DATA_FORK))
+			__entry->whichfork = XFS_DATA_FORK;
+		else if (ifp == XFS_IFORK_PTR(ip, XFS_ATTR_FORK))
+			__entry->whichfork = XFS_ATTR_FORK;
+		else if (ifp == XFS_IFORK_PTR(ip, XFS_COW_FORK))
+			__entry->whichfork = XFS_COW_FORK;
+		else
+			__entry->whichfork = -1;
+	),
+	TP_printk("dev %d:%d ino 0x%llx fork %d state %s cur 0x%p/%d "
Quoted 8 lines

fs/xfs/xfs_trace.h DECLARE_EVENT_CLASS(xfs_bmap_class, · line 267

Quoted 5 lines
fs/xfs/xfs_trace.h +1 -1
 		  "offset %lld block %lld count %lld flag %d caller %ps",
 		  MAJOR(__entry->dev), MINOR(__entry->dev),
-		  __entry->ino,
+		  __entry->ino, __entry->whichfork,
 		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),

Doesn't ->bmap_state include this information? Looks like attr/cow strings are included in the EXT_FLAGS list as well.

Aha, that's why it wasn't printing DATA for data fork updates. Silly me. Sorry for the noise. :/

--D

Quoted 12 lines

Brian

Quoted 6 lines
fs/xfs/xfs_trace.h +0 -1
 		  __entry->leaf,
 		  __entry->pos,
--

To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html