linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] xfs: enums don't work with __print_symbolic
@ 2018-11-21 22:59 Dave Chinner
  2018-11-21 22:59 ` [PATCH 1/3] xfs: make iomap type tracing work Dave Chinner
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Dave Chinner @ 2018-11-21 22:59 UTC (permalink / raw)
  To: linux-xfs

Hi folks,

When trying to read traces from fsx failurs, I kept coming across
fields in the traces that had no output what-so-ever. The common
theme was that they all were tables that were parsed by
__print_symbolic() and the value definitions were enums.

Unfortunately, __print_symbolic() does some crazy stuff involving
stringification of the table that is passed to it, which means
the enums are turned into strings and so their never get treated as
enums after pre-processing. The result is a format string that looks
like:

# cat /sys/kernel/debug/tracing/events/xfs/xfs_iomap_alloc/format
.....
print fmt: ..... __print_symbolic(REC->type, { XFS_IO_INVALID, "invalid" }, { XFS_IO_DELALLOC, "delalloc" }, { XFS_IO_UNWRITTEN, "unwritten" }, { XFS_IO_OVERWRITE, "overwrite" }, { XFS_IO_COW, "CoW" }, { XFS_IO_HOLE, "hole" }), ....
#

And, well, XFS_IO_OVERWRITE is a string, not an integer value of 3.
Hence __print_symbolic never prints out the correct value.

The way to fix this is to turn all the enums into defined macros,
that way the preprocessor still substitutes the value for the
stringified table as the it does string matches. The result is:

__print_symbolic(REC->type, { 0, "hole" }, { 1, "delalloc" }, { 2, "unwritten" }, { 3, "overwrite" }, { 4, "CoW" })

And the trace events now print the type correctly in the trace.

This series fixes the cases I noticed by removing the various enums
that end up in trace format tables.

Cheers,

Dave.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-22 13:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-21 22:59 [PATCH 0/3] xfs: enums don't work with __print_symbolic Dave Chinner
2018-11-21 22:59 ` [PATCH 1/3] xfs: make iomap type tracing work Dave Chinner
2018-11-21 22:59 ` [PATCH 2/3] xfs: remove xfs_lookup_t enum because tracing Dave Chinner
2018-11-21 22:59 ` [PATCH 3/3] xfs: remove xfs_extst_t " Dave Chinner
2018-11-21 23:42 ` [PATCH 0/3] xfs: enums don't work with __print_symbolic Darrick J. Wong
2018-11-22  2:29   ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).