Re: [PATCH 11/11] blkparse: add option to emit a specific trace protocol version

Damien Le Moal <[email protected]> Thu, 16 Jul 2026 21:13:01 +0900
Newsgroups org.kernel.vger.linux-btrace,org.kernel.vger.linux-block
Organization Western Digital Research
Message-ID <[email protected]>
On 7/16/26 20:04, Johannes Thumshirn wrote:
> Add the '--trace-version=<1|2>' command line option to select the trace
> protocol version of the binary output file. Requesting version 1 emits
> the legacy 'struct blk_io_trace', while version 2 (the default) emits
> 'struct blk_io_trace2'.
> 
> Signed-off-by: Johannes Thumshirn <[email protected]>

Looks OK to me, modulo the nit below.

Reviewed-by: Damien Le Moal <[email protected]>

> @@ -3298,6 +3337,17 @@ int main(int argc, char *argv[])
>  		case 'M':
>  			bin_output_msgs = 0;
>  			break;
> +		case OPT_TRACE_VERSION: {

		case OPT_TRACE_VERSION:
			dump_trace_version = atoi(optarg);
			if (dump_trace_version != 1 &&
			    dump_trace_version != 2) {
				usage(argv[0]);
				return 1;
			}

Is a lot simpler I think.

> +			int ver = atoi(optarg);
> +
> +			if (ver == 1 || ver == 2)
> +				dump_trace_version = ver;
> +			else {
> +				usage(argv[0]);
> +				return 1;
> +			}
> +			break;
> +		}
>  		default:
>  			usage(argv[0]);
>  			return 1;

-- 
Damien Le Moal
Western Digital Research