From: Steven Rostedt <rostedt@goodmis.org>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
linux-bcache@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH RFC 2/2] tracing/block: add request operation and flags into trace events
Date: Mon, 4 May 2020 13:35:24 -0400 [thread overview]
Message-ID: <20200504133524.686c7be5@gandalf.local.home> (raw)
In-Reply-To: <158860538157.30407.6389633238674780245.stgit@buzz>
On Mon, 04 May 2020 18:16:21 +0300
Konstantin Khlebnikov <khlebnikov@yandex-team.ru> wrote:
> +/* Request operations, see enum req_opf */
> +
> +TRACE_DEFINE_ENUM(REQ_OP_READ);
> +TRACE_DEFINE_ENUM(REQ_OP_WRITE);
> +TRACE_DEFINE_ENUM(REQ_OP_FLUSH);
> +TRACE_DEFINE_ENUM(REQ_OP_DISCARD);
> +TRACE_DEFINE_ENUM(REQ_OP_SECURE_ERASE);
> +TRACE_DEFINE_ENUM(REQ_OP_ZONE_RESET);
> +TRACE_DEFINE_ENUM(REQ_OP_WRITE_SAME);
> +TRACE_DEFINE_ENUM(REQ_OP_ZONE_RESET_ALL);
> +TRACE_DEFINE_ENUM(REQ_OP_WRITE_ZEROES);
> +TRACE_DEFINE_ENUM(REQ_OP_ZONE_OPEN);
> +TRACE_DEFINE_ENUM(REQ_OP_ZONE_CLOSE);
> +TRACE_DEFINE_ENUM(REQ_OP_ZONE_FINISH);
> +TRACE_DEFINE_ENUM(REQ_OP_SCSI_IN);
> +TRACE_DEFINE_ENUM(REQ_OP_SCSI_OUT);
> +TRACE_DEFINE_ENUM(REQ_OP_DRV_IN);
> +TRACE_DEFINE_ENUM(REQ_OP_DRV_OUT);
> +
> +#define BLOCK_REQ_OP_STRINGS \
> + { REQ_OP_READ, "READ" }, \
> + { REQ_OP_WRITE, "WRITE" }, \
> + { REQ_OP_FLUSH, "FLUSH" }, \
> + { REQ_OP_DISCARD, "DISCARD" }, \
> + { REQ_OP_SECURE_ERASE, "SECURE_ERASE" }, \
> + { REQ_OP_ZONE_RESET, "ZONE_RESET" }, \
> + { REQ_OP_WRITE_SAME, "WRITE_SAME" }, \
> + { REQ_OP_ZONE_RESET_ALL,"ZONE_RESET_ALL" }, \
> + { REQ_OP_WRITE_ZEROES, "WRITE_ZEROES" }, \
> + { REQ_OP_ZONE_OPEN, "ZONE_OPEN" }, \
> + { REQ_OP_ZONE_CLOSE, "ZONE_CLOSE" }, \
> + { REQ_OP_ZONE_FINISH, "ZONE_FINISH" }, \
> + { REQ_OP_SCSI_IN, "SCSI_IN" }, \
> + { REQ_OP_SCSI_OUT, "SCSI_OUT" }, \
> + { REQ_OP_DRV_IN, "DRV_IN" }, \
> + { REQ_OP_DRV_OUT, "DRV_OUT" }
> +
> +#define show_block_req_op(req) \
> + __print_symbolic((req) & REQ_OP_MASK, BLOCK_REQ_OP_STRINGS)
> +
A common trick to avoid the duplication from above is to do this:
#define BLOCK_REQ_OP_STRINGS \
EM( REQ_OP_READ, "READ" ) \
EM( REQ_OP_WRITE, "WRITE" ) \
EM( REQ_OP_FLUSH, "FLUSH" ) \
EM( REQ_OP_DISCARD, "DISCARD" ) \
EM( REQ_OP_SECURE_ERASE, "SECURE_ERASE" ) \
EM( REQ_OP_ZONE_RESET, "ZONE_RESET" ) \
EM( REQ_OP_WRITE_SAME, "WRITE_SAME" ) \
EM( REQ_OP_ZONE_RESET_ALL,"ZONE_RESET_ALL" ) \
EM( REQ_OP_WRITE_ZEROES, "WRITE_ZEROES" ) \
EM( REQ_OP_ZONE_OPEN, "ZONE_OPEN" ) \
EM( REQ_OP_ZONE_CLOSE, "ZONE_CLOSE" ) \
EM( REQ_OP_ZONE_FINISH, "ZONE_FINISH" ) \
EM( REQ_OP_SCSI_IN, "SCSI_IN" ) \
EM( REQ_OP_SCSI_OUT, "SCSI_OUT" ) \
EM( REQ_OP_DRV_IN, "DRV_IN" ) \
EMe( REQ_OP_DRV_OUT, "DRV_OUT" )
#undef EM
#undef EMe
#define EM(a, b) TRACE_DEFINE_ENUM(a);
#define EMe(a, b) TRACE_DEFINE_ENUM(a);
BLOCK_REQ_OP_STRINGS
#undef EM
#undef EMe
#define EM(a, b) { a, b },
#define EMe(a, b) { a , b }
#define show_block_req_op(req)
__print_symbolic((req) & REQ_OP_MASK, BLOCK_REQ_OP_STRINGS)
Several other event files in include/trace/events do this.
-- Steve
next prev parent reply other threads:[~2020-05-04 17:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-04 15:16 [PATCH RFC 1/2] tracing/block: cleanup rwbs filling in trace events Konstantin Khlebnikov
2020-05-04 15:16 ` Konstantin Khlebnikov
2020-05-04 15:16 ` [PATCH RFC 2/2] tracing/block: add request operation and flags into " Konstantin Khlebnikov
2020-05-04 15:16 ` Konstantin Khlebnikov
2020-05-04 17:35 ` Steven Rostedt [this message]
2020-05-04 17:35 ` Steven Rostedt
2020-05-06 7:07 ` [PATCH RFC 1/2] tracing/block: cleanup rwbs filling in " Coly Li
2020-05-06 7:07 ` Coly Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200504133524.686c7be5@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=khlebnikov@yandex-team.ru \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox