Skip to content

Commit 35fe0d1

Browse files
hreineckesagigrimberg
authored andcommitted
nvme: trace bio completion
When native multipathing is enabled we cannot enable blktrace for the underlying paths, so any completion is never traced. Signed-off-by: Hannes Reinecke <hare@suse.com> [fixed-up by Mikhail for non-multipath-build] Signed-off-by: Mikhail Skorzhinskii <mskorzhinskiy@solarflare.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
1 parent e01f91d commit 35fe0d1

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

‎drivers/nvme/host/core.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
#include <linux/pm_qos.h>
2323
#include <asm/unaligned.h>
2424

25-
#define CREATE_TRACE_POINTS
26-
#include "trace.h"
27-
2825
#include "nvme.h"
2926
#include "fabrics.h"
3027

28+
#define CREATE_TRACE_POINTS
29+
#include "trace.h"
30+
3131
#define NVME_MINORS (1U << MINORBITS)
3232

3333
unsigned int admin_timeout = 60;
@@ -279,6 +279,8 @@ void nvme_complete_rq(struct request *req)
279279
return;
280280
}
281281
}
282+
283+
nvme_trace_bio_complete(req, status);
282284
blk_mq_end_request(req, status);
283285
}
284286
EXPORT_SYMBOL_GPL(nvme_complete_rq);

‎drivers/nvme/host/nvme.h‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <linux/fault-inject.h>
1717
#include <linux/rcupdate.h>
1818

19+
#include <trace/events/block.h>
20+
1921
extern unsigned int nvme_io_timeout;
2022
#define NVME_IO_TIMEOUT (nvme_io_timeout * HZ)
2123

@@ -511,6 +513,16 @@ static inline void nvme_mpath_check_last_path(struct nvme_ns *ns)
511513
kblockd_schedule_work(&head->requeue_work);
512514
}
513515

516+
static inline void nvme_trace_bio_complete(struct request *req,
517+
blk_status_t status)
518+
{
519+
struct nvme_ns *ns = req->q->queuedata;
520+
521+
if (req->cmd_flags & REQ_NVME_MPATH)
522+
trace_block_bio_complete(ns->head->disk->queue,
523+
req->bio, status);
524+
}
525+
514526
extern struct device_attribute dev_attr_ana_grpid;
515527
extern struct device_attribute dev_attr_ana_state;
516528
extern struct device_attribute subsys_attr_iopolicy;
@@ -554,6 +566,10 @@ static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns)
554566
static inline void nvme_mpath_check_last_path(struct nvme_ns *ns)
555567
{
556568
}
569+
static inline void nvme_trace_bio_complete(struct request *req,
570+
blk_status_t status)
571+
{
572+
}
557573
static inline int nvme_mpath_init(struct nvme_ctrl *ctrl,
558574
struct nvme_id_ctrl *id)
559575
{

0 commit comments

Comments
 (0)