Re: [PATCH v2 06/15] blktrace: split do_blk_trace_setup into two functions

Damien Le Moal
2025-10-01T06:25:30Z

On 9/26/25 00:02, Johannes Thumshirn wrote:
> Split do_blk_trace_setup into two functions, this is done to prepare for
> an incoming new BLKTRACESETUP2 ioctl(2) which can receive extended
> parameters form user-space.

s/form/from

>
> Also move the size verification logic to the callers.
>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

> @@ -593,17 +581,39 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
> debugfs_create_file("dropped", 0444, dir, bt, &blk_dropped_fops);
> debugfs_create_file("msg", 0222, dir, bt, &blk_msg_fops);
>
> - bt->rchan = relay_open("trace", dir, buts->buf_size,
> - buts->buf_nr, &blk_relay_callbacks, bt);
> + bt->rchan = relay_open("trace", dir, buf_size, buf_nr,
> + &blk_relay_callbacks, bt);
> if (!bt->rchan)
> goto err;
>
> + blk_trace_setup_lba(bt, bdev);
> +
> + return bt;
> +
> +err:
> + if (ret)
> + blk_trace_free(q, bt);

I do not think that the "if (ret)" is needed here.

> +
> + return ERR_PTR(ret);
> +}

With that fixed,

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

--
Damien Le Moal
Western Digital Research