Skip to content

Commit d24de76

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: remove the error argument to the block_bio_complete tracepoint
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]>
1 parent 6ac92fb commit d24de76

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

block/bio.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,8 +1434,7 @@ void bio_endio(struct bio *bio)
14341434
}
14351435

14361436
if (bio->bi_disk && bio_flagged(bio, BIO_TRACE_COMPLETION)) {
1437-
trace_block_bio_complete(bio->bi_disk->queue, bio,
1438-
blk_status_to_errno(bio->bi_status));
1437+
trace_block_bio_complete(bio->bi_disk->queue, bio);
14391438
bio_clear_flag(bio, BIO_TRACE_COMPLETION);
14401439
}
14411440

drivers/nvme/host/nvme.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,7 @@ static inline void nvme_trace_bio_complete(struct request *req,
599599
struct nvme_ns *ns = req->q->queuedata;
600600

601601
if (req->cmd_flags & REQ_NVME_MPATH)
602-
trace_block_bio_complete(ns->head->disk->queue,
603-
req->bio, status);
602+
trace_block_bio_complete(ns->head->disk->queue, req->bio);
604603
}
605604

606605
extern struct device_attribute dev_attr_ana_grpid;

include/trace/events/block.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ TRACE_EVENT(block_bio_bounce,
261261
*/
262262
TRACE_EVENT(block_bio_complete,
263263

264-
TP_PROTO(struct request_queue *q, struct bio *bio, int error),
264+
TP_PROTO(struct request_queue *q, struct bio *bio),
265265

266-
TP_ARGS(q, bio, error),
266+
TP_ARGS(q, bio),
267267

268268
TP_STRUCT__entry(
269269
__field( dev_t, dev )
@@ -277,7 +277,7 @@ TRACE_EVENT(block_bio_complete,
277277
__entry->dev = bio_dev(bio);
278278
__entry->sector = bio->bi_iter.bi_sector;
279279
__entry->nr_sector = bio_sectors(bio);
280-
__entry->error = error;
280+
__entry->error = blk_status_to_errno(bio->bi_status);
281281
blk_fill_rwbs(__entry->rwbs, bio->bi_opf, bio->bi_iter.bi_size);
282282
),
283283

kernel/trace/blktrace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -885,10 +885,10 @@ static void blk_add_trace_bio_bounce(void *ignore,
885885
}
886886

887887
static void blk_add_trace_bio_complete(void *ignore,
888-
struct request_queue *q, struct bio *bio,
889-
int error)
888+
struct request_queue *q, struct bio *bio)
890889
{
891-
blk_add_trace_bio(q, bio, BLK_TA_COMPLETE, error);
890+
blk_add_trace_bio(q, bio, BLK_TA_COMPLETE,
891+
blk_status_to_errno(bio->bi_status));
892892
}
893893

894894
static void blk_add_trace_bio_backmerge(void *ignore,

0 commit comments

Comments
 (0)