aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2014-04-28 14:30:52 -0400
committerMatthew Wilcox <matthew.r.wilcox@intel.com>2014-05-05 10:41:26 -0400
commit3291fa57cb1b004c1a4823beb28b5cc72555f1a5 (patch)
tree027fa1d510238ddd18d6c5b2bced5b5f5c585088
parent94bbac4052eb93219ca0aa370ca741486b25fb98 (diff)
NVMe: Add tracepoints
Adding tracepoints for bio_complete and block_split into nvme to help with gathering IO info using blktrace and blkparse. Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
-rw-r--r--block/blk-core.c1
-rw-r--r--drivers/block/nvme-core.c13
2 files changed, 10 insertions, 4 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index a0e3096c4bb5..c488b55dddd7 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -43,6 +43,7 @@
43EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_remap); 43EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_remap);
44EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap); 44EXPORT_TRACEPOINT_SYMBOL_GPL(block_rq_remap);
45EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete); 45EXPORT_TRACEPOINT_SYMBOL_GPL(block_bio_complete);
46EXPORT_TRACEPOINT_SYMBOL_GPL(block_split);
46EXPORT_TRACEPOINT_SYMBOL_GPL(block_unplug); 47EXPORT_TRACEPOINT_SYMBOL_GPL(block_unplug);
47 48
48DEFINE_IDA(blk_queue_ida); 49DEFINE_IDA(blk_queue_ida);
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index b9f07f81ea5d..025dd4cad4a6 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -42,6 +42,8 @@
42#include <scsi/sg.h> 42#include <scsi/sg.h>
43#include <asm-generic/io-64-nonatomic-lo-hi.h> 43#include <asm-generic/io-64-nonatomic-lo-hi.h>
44 44
45#include <trace/events/block.h>
46
45#define NVME_Q_DEPTH 1024 47#define NVME_Q_DEPTH 1024
46#define SQ_SIZE(depth) (depth * sizeof(struct nvme_command)) 48#define SQ_SIZE(depth) (depth * sizeof(struct nvme_command))
47#define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion)) 49#define CQ_SIZE(depth) (depth * sizeof(struct nvme_completion))
@@ -411,6 +413,7 @@ static void bio_completion(struct nvme_queue *nvmeq, void *ctx,
411 struct nvme_iod *iod = ctx; 413 struct nvme_iod *iod = ctx;
412 struct bio *bio = iod->private; 414 struct bio *bio = iod->private;
413 u16 status = le16_to_cpup(&cqe->status) >> 1; 415 u16 status = le16_to_cpup(&cqe->status) >> 1;
416 int error = 0;
414 417
415 if (unlikely(status)) { 418 if (unlikely(status)) {
416 if (!(status & NVME_SC_DNR || 419 if (!(status & NVME_SC_DNR ||
@@ -423,6 +426,7 @@ static void bio_completion(struct nvme_queue *nvmeq, void *ctx,
423 wake_up(&nvmeq->sq_full); 426 wake_up(&nvmeq->sq_full);
424 return; 427 return;
425 } 428 }
429 error = -EIO;
426 } 430 }
427 if (iod->nents) { 431 if (iod->nents) {
428 dma_unmap_sg(nvmeq->q_dmadev, iod->sg, iod->nents, 432 dma_unmap_sg(nvmeq->q_dmadev, iod->sg, iod->nents,
@@ -430,10 +434,9 @@ static void bio_completion(struct nvme_queue *nvmeq, void *ctx,
430 nvme_end_io_acct(bio, iod->start_time); 434 nvme_end_io_acct(bio, iod->start_time);
431 } 435 }
432 nvme_free_iod(nvmeq->dev, iod); 436 nvme_free_iod(nvmeq->dev, iod);
433 if (status) 437
434 bio_endio(bio, -EIO); 438 trace_block_bio_complete(bdev_get_queue(bio->bi_bdev), bio, error);
435 else 439 bio_endio(bio, error);
436 bio_endio(bio, 0);
437} 440}
438 441
439/* length is in bytes. gfp flags indicates whether we may sleep. */ 442/* length is in bytes. gfp flags indicates whether we may sleep. */
@@ -522,6 +525,8 @@ static int nvme_split_and_submit(struct bio *bio, struct nvme_queue *nvmeq,
522 if (!split) 525 if (!split)
523 return -ENOMEM; 526 return -ENOMEM;
524 527
528 trace_block_split(bdev_get_queue(bio->bi_bdev), bio,
529 split->bi_iter.bi_sector);
525 bio_chain(split, bio); 530 bio_chain(split, bio);
526 531
527 if (!waitqueue_active(&nvmeq->sq_full)) 532 if (!waitqueue_active(&nvmeq->sq_full))