Linux block layer
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
	Chaitanya Kulkarni <chaitanyak@nvidia.com>,
	linux-btrace@vger.kernel.org
Subject: Re: [PATCH 03/11] blktrace: add option to request a specific trace protocol version
Date: Thu, 16 Jul 2026 20:54:08 +0900	[thread overview]
Message-ID: <c0ee5837-35a2-427f-bebb-da142cf4cdbf@kernel.org> (raw)
In-Reply-To: <20260716110442.1291010-4-johannes.thumshirn@wdc.com>

On 7/16/26 20:04, Johannes Thumshirn wrote:
> Add the '--trace-version=<1|2>' command line option to select the trace
> protocol version requested from the kernel. Requesting version 1 forces
> blktrace to use the old BLKTRACESETUP ioctl, while version 2 (the
> default) uses BLKTRACESETUP2.
> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  blktrace.c     | 30 ++++++++++++++++++++++++++++--
>  doc/blktrace.8 |  7 +++++++
>  2 files changed, 35 insertions(+), 2 deletions(-)
> 
> diff --git a/blktrace.c b/blktrace.c
> index 72562fdc9d9e..35db26fd4e23 100644
> --- a/blktrace.c
> +++ b/blktrace.c
> @@ -283,6 +283,7 @@ static unsigned long long act_mask = ~0U;
>  static int kill_running_trace;
>  static int stop_watch;
>  static int piped_output;
> +static int v1;

bool ?

Or maybe less confusing/more scalable:

static int trace_ver = 2;

to match the default and the --trace-version option changes that to the
specified value? That simplifies the code below too.
>  static void clear_events(struct pollfd *pfd)
>  {
> @@ -2244,6 +2257,19 @@ static int handle_args(int argc, char *argv[])
>  		case 's':
>  			net_use_sendfile = 0;
>  			break;
> +		case OPT_TRACE_VERSION: {

		case OPT_TRACE_VERSION:
			trace_ver = atoi(optarg);
			if (trace_ver != 1 && trace_ver != 2) {
				show_usage(argv[0]);
				exit(1);
			}
			break;

> +			int ver = atoi(optarg);
> +
> +			if (ver == 1)
> +				v1 = 1;
> +			else if (ver == 2)
> +				v1 = 0;
> +			else {
> +				show_usage(argv[0]);
> +				exit(1);
> +			}
> +			break;
> +		}


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-07-16 11:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 11:04 [PATCH 00/11] blktrace: parse blk_io_trace2 in btt and iowatcher Johannes Thumshirn
2026-07-16 11:04 ` [PATCH 01/11] btt: use blk_io_trace2 internally Johannes Thumshirn
2026-07-16 11:43   ` Damien Le Moal
2026-07-16 11:04 ` [PATCH 02/11] btt: natively parse blk_io_trace2 Johannes Thumshirn
2026-07-16 11:47   ` Damien Le Moal
2026-07-16 11:04 ` [PATCH 03/11] blktrace: add option to request a specific trace protocol version Johannes Thumshirn
2026-07-16 11:54   ` Damien Le Moal [this message]
2026-07-16 11:04 ` [PATCH 04/11] blkrawverify: use blk_io_trace2 internally Johannes Thumshirn
2026-07-16 11:55   ` Damien Le Moal
2026-07-16 11:04 ` [PATCH 05/11] blkrawverify: natively parse blk_io_trace2 Johannes Thumshirn
2026-07-16 12:04   ` Damien Le Moal
2026-07-16 11:04 ` [PATCH 06/11] blkiomon: use blk_io_trace2 internally Johannes Thumshirn
2026-07-16 12:05   ` Damien Le Moal
2026-07-16 11:04 ` [PATCH 07/11] blkiomon: natively parse blk_io_trace2 Johannes Thumshirn
2026-07-16 12:06   ` Damien Le Moal
2026-07-16 11:04 ` [PATCH 08/11] iowatcher: use blk_io_trace2 internally Johannes Thumshirn
2026-07-16 12:07   ` Damien Le Moal
2026-07-16 11:04 ` [PATCH 09/11] iowatcher: natively parse blk_io_trace2 Johannes Thumshirn
2026-07-16 12:08   ` Damien Le Moal
2026-07-16 11:04 ` [PATCH 10/11] btreplay: support blk_io_trace2 in btrecord Johannes Thumshirn
2026-07-16 12:09   ` Damien Le Moal
2026-07-16 11:04 ` [PATCH 11/11] blkparse: add option to emit a specific trace protocol version Johannes Thumshirn
2026-07-16 12:13   ` Damien Le Moal

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=c0ee5837-35a2-427f-bebb-da142cf4cdbf@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=chaitanyak@nvidia.com \
    --cc=hch@lst.de \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrace@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