[PATCH] block, nvme: export and use passthrough stats

Nilay Shroff nilay at linux.ibm.com
Sat May 23 11:54:24 PDT 2026


On 5/22/26 8:45 PM, Keith Busch wrote:
> diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
> index 263161cb8ac06..435fab0be6401 100644
> --- a/drivers/nvme/host/multipath.c
> +++ b/drivers/nvme/host/multipath.c
> @@ -175,9 +175,11 @@ void nvme_mpath_start_request(struct request *rq)
>   		nvme_req(rq)->flags |= NVME_MPATH_CNT_ACTIVE;
>   	}
>   
> -	if (!blk_queue_io_stat(disk->queue) || blk_rq_is_passthrough(rq) ||
> +	if (!blk_queue_io_stat(disk->queue) ||
>   	    (nvme_req(rq)->flags & NVME_MPATH_IO_STATS))
>   		return;
> +	if (blk_rq_is_passthrough(rq) && !blk_rq_passthrough_stats(rq))
> +		return;
>   
>   	nvme_req(rq)->flags |= NVME_MPATH_IO_STATS;
>   	nvme_req(rq)->start_time = bdev_start_io_acct(disk->part0, req_op(rq),

Thanks for this patch! It will be very useful for nvme top dashboard for
displaying passthru I/O stat under head node.

Well, I see an issue here with @rq being passed to blk_rq_passthrough_stats()
as the @rq->q points to nvme path queue object rather than the head node queue
object. The intention here is to account passthrough I/O statistics at the
head node level, but with the current implementation the decision depends
on the path queue's iostats_passthrough setting instead of the head queue's
setting. As a result, head-node passthrough I/O statistics may get accounted
based on whether the underlying path queue has iostats_passthrough enabled,
irrespective of the head queue configuration.

Another issue is that nvme_mpath_start_request() is only reached from
nvme_start_request() when REQ_NVME_MPATH is set. Normal bio based I/O
through the head gets that flag in nvme_ns_head_submit_bio(), but the
passthrough ioctl/uring path in the quoted patch does not set it. So
head passthrough I/O would not enter nvme_mpath_start_request() and
would not get head-node stats.

Thanks,
--Nilay



More information about the Linux-nvme mailing list