diff mbox series

[15/15] xfs: decode scrub flags in ftrace output

Message ID 162924381463.761813.16823449335256904439.stgit@magnolia (mailing list archive)
State Accepted, archived
Headers show
Series xfs: clean up ftrace field tags and formats | expand

Commit Message

Darrick J. Wong Aug. 17, 2021, 11:43 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

When using pretty-printed scrub tracepoints, decode the meaning of the
scrub flags as strings for easier reading.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/scrub/trace.h |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

Comments

Dave Chinner Aug. 19, 2021, 3:20 a.m. UTC | #1
On Tue, Aug 17, 2021 at 04:43:34PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> When using pretty-printed scrub tracepoints, decode the meaning of the
> scrub flags as strings for easier reading.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/xfs/scrub/trace.h |   14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)

Looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
Carlos Maiolino Aug. 19, 2021, 1:04 p.m. UTC | #2
On Tue, Aug 17, 2021 at 04:43:34PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> When using pretty-printed scrub tracepoints, decode the meaning of the
> scrub flags as strings for easier reading.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/xfs/scrub/trace.h |   14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>


> 
> 
> diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h
> index 2777d882819d..e9b81b7645c1 100644
> --- a/fs/xfs/scrub/trace.h
> +++ b/fs/xfs/scrub/trace.h
> @@ -79,6 +79,16 @@ TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FSCOUNTERS);
>  	{ XFS_SCRUB_TYPE_PQUOTA,	"prjquota" }, \
>  	{ XFS_SCRUB_TYPE_FSCOUNTERS,	"fscounters" }
>  
> +#define XFS_SCRUB_FLAG_STRINGS \
> +	{ XFS_SCRUB_IFLAG_REPAIR,		"repair" }, \
> +	{ XFS_SCRUB_OFLAG_CORRUPT,		"corrupt" }, \
> +	{ XFS_SCRUB_OFLAG_PREEN,		"preen" }, \
> +	{ XFS_SCRUB_OFLAG_XFAIL,		"xfail" }, \
> +	{ XFS_SCRUB_OFLAG_XCORRUPT,		"xcorrupt" }, \
> +	{ XFS_SCRUB_OFLAG_INCOMPLETE,		"incomplete" }, \
> +	{ XFS_SCRUB_OFLAG_WARNING,		"warning" }, \
> +	{ XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED,	"norepair" }
> +
>  DECLARE_EVENT_CLASS(xchk_class,
>  	TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm,
>  		 int error),
> @@ -103,14 +113,14 @@ DECLARE_EVENT_CLASS(xchk_class,
>  		__entry->flags = sm->sm_flags;
>  		__entry->error = error;
>  	),
> -	TP_printk("dev %d:%d ino 0x%llx type %s agno 0x%x inum 0x%llx gen 0x%x flags 0x%x error %d",
> +	TP_printk("dev %d:%d ino 0x%llx type %s agno 0x%x inum 0x%llx gen 0x%x flags (%s) error %d",
>  		  MAJOR(__entry->dev), MINOR(__entry->dev),
>  		  __entry->ino,
>  		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
>  		  __entry->agno,
>  		  __entry->inum,
>  		  __entry->gen,
> -		  __entry->flags,
> +		  __print_flags(__entry->flags, "|", XFS_SCRUB_FLAG_STRINGS),
>  		  __entry->error)
>  )
>  #define DEFINE_SCRUB_EVENT(name) \
>
diff mbox series

Patch

diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h
index 2777d882819d..e9b81b7645c1 100644
--- a/fs/xfs/scrub/trace.h
+++ b/fs/xfs/scrub/trace.h
@@ -79,6 +79,16 @@  TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FSCOUNTERS);
 	{ XFS_SCRUB_TYPE_PQUOTA,	"prjquota" }, \
 	{ XFS_SCRUB_TYPE_FSCOUNTERS,	"fscounters" }
 
+#define XFS_SCRUB_FLAG_STRINGS \
+	{ XFS_SCRUB_IFLAG_REPAIR,		"repair" }, \
+	{ XFS_SCRUB_OFLAG_CORRUPT,		"corrupt" }, \
+	{ XFS_SCRUB_OFLAG_PREEN,		"preen" }, \
+	{ XFS_SCRUB_OFLAG_XFAIL,		"xfail" }, \
+	{ XFS_SCRUB_OFLAG_XCORRUPT,		"xcorrupt" }, \
+	{ XFS_SCRUB_OFLAG_INCOMPLETE,		"incomplete" }, \
+	{ XFS_SCRUB_OFLAG_WARNING,		"warning" }, \
+	{ XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED,	"norepair" }
+
 DECLARE_EVENT_CLASS(xchk_class,
 	TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm,
 		 int error),
@@ -103,14 +113,14 @@  DECLARE_EVENT_CLASS(xchk_class,
 		__entry->flags = sm->sm_flags;
 		__entry->error = error;
 	),
-	TP_printk("dev %d:%d ino 0x%llx type %s agno 0x%x inum 0x%llx gen 0x%x flags 0x%x error %d",
+	TP_printk("dev %d:%d ino 0x%llx type %s agno 0x%x inum 0x%llx gen 0x%x flags (%s) error %d",
 		  MAJOR(__entry->dev), MINOR(__entry->dev),
 		  __entry->ino,
 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
 		  __entry->agno,
 		  __entry->inum,
 		  __entry->gen,
-		  __entry->flags,
+		  __print_flags(__entry->flags, "|", XFS_SCRUB_FLAG_STRINGS),
 		  __entry->error)
 )
 #define DEFINE_SCRUB_EVENT(name) \