struct nvme_command *cmd, blk_opf_t rq_flags,
blk_mq_req_flags_t blk_flags)
{
+ struct nvme_ns *ns = q->queuedata;
struct request *req;
+ /*
+ * The NVME_MPATH flag is set only for IO commands sent to a namespace
+ * with a multipath enabled head. The request is not eligible for
+ * failover as passthrough requests also append REQ_FAILFAST_DRIVER.
+ */
+ if (ns && nvme_ns_head_multipath(ns->head))
+ rq_flags |= REQ_NVME_MPATH;
+
req = blk_mq_alloc_request(q, nvme_req_op(cmd) | rq_flags, blk_flags);
if (IS_ERR(req))
return req;
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, disk->queue))
+ return;
nvme_req(rq)->flags |= NVME_MPATH_IO_STATS;
nvme_req(rq)->start_time = bdev_start_io_acct(disk->part0, req_op(rq),