Skip to content

Commit

Permalink
block: remove the error argument to the block_bio_complete tracepoint
Browse files Browse the repository at this point in the history
The status can be trivially derived from the bio itself.  That also avoid
callers like NVMe to incorrectly pass a blk_status_t instead of the errno,
and the overhead of translating the blk_status_t to the errno in the I/O
completion fast path when no tracing is enabled.

Fixes: 35fe0d1 ("nvme: trace bio completion")
Signed-off-by: Christoph Hellwig <[email protected]>
Reviewed-by: Sagi Grimberg <[email protected]>
Reviewed-by: Chaitanya Kulkarni <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Jun 5, 2020
1 parent 6ac92fb commit d24de76
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions block/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1434,8 +1434,7 @@ void bio_endio(struct bio *bio)
}

if (bio->bi_disk && bio_flagged(bio, BIO_TRACE_COMPLETION)) {
trace_block_bio_complete(bio->bi_disk->queue, bio,
blk_status_to_errno(bio->bi_status));
trace_block_bio_complete(bio->bi_disk->queue, bio);
bio_clear_flag(bio, BIO_TRACE_COMPLETION);
}

Expand Down
3 changes: 1 addition & 2 deletions drivers/nvme/host/nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,7 @@ static inline void nvme_trace_bio_complete(struct request *req,
struct nvme_ns *ns = req->q->queuedata;

if (req->cmd_flags & REQ_NVME_MPATH)
trace_block_bio_complete(ns->head->disk->queue,
req->bio, status);
trace_block_bio_complete(ns->head->disk->queue, req->bio);
}

extern struct device_attribute dev_attr_ana_grpid;
Expand Down
6 changes: 3 additions & 3 deletions include/trace/events/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ TRACE_EVENT(block_bio_bounce,
*/
TRACE_EVENT(block_bio_complete,

TP_PROTO(struct request_queue *q, struct bio *bio, int error),
TP_PROTO(struct request_queue *q, struct bio *bio),

TP_ARGS(q, bio, error),
TP_ARGS(q, bio),

TP_STRUCT__entry(
__field( dev_t, dev )
Expand All @@ -277,7 +277,7 @@ TRACE_EVENT(block_bio_complete,
__entry->dev = bio_dev(bio);
__entry->sector = bio->bi_iter.bi_sector;
__entry->nr_sector = bio_sectors(bio);
__entry->error = error;
__entry->error = blk_status_to_errno(bio->bi_status);
blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
),

Expand Down
6 changes: 3 additions & 3 deletions kernel/trace/blktrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,10 +885,10 @@ static void blk_add_trace_bio_bounce(void *ignore,
}

static void blk_add_trace_bio_complete(void *ignore,
struct request_queue *q, struct bio *bio,
int error)
struct request_queue *q, struct bio *bio)
{
blk_add_trace_bio(q, bio, BLK_TA_COMPLETE, error);
blk_add_trace_bio(q, bio, BLK_TA_COMPLETE,
blk_status_to_errno(bio->bi_status));
}

static void blk_add_trace_bio_backmerge(void *ignore,
Expand Down

0 comments on commit d24de76

Please sign in to comment.