Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block: don't call blk_status_to_errno in blk_update_request

We only need to call it to resolve the blk_status_t -> errno mapping for
tracing, so move the conversion into the tracepoints that are not called
at all when tracing isn't enabled.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
8a7d267b db9a02ba

+8 -7
+1 -1
block/blk-mq.c
··· 680 680 { 681 681 int total_bytes; 682 682 683 - trace_block_rq_complete(req, blk_status_to_errno(error), nr_bytes); 683 + trace_block_rq_complete(req, error, nr_bytes); 684 684 685 685 if (!req->bio) 686 686 return false;
+3 -3
include/trace/events/block.h
··· 114 114 */ 115 115 TRACE_EVENT(block_rq_complete, 116 116 117 - TP_PROTO(struct request *rq, int error, unsigned int nr_bytes), 117 + TP_PROTO(struct request *rq, blk_status_t error, unsigned int nr_bytes), 118 118 119 119 TP_ARGS(rq, error, nr_bytes), 120 120 ··· 122 122 __field( dev_t, dev ) 123 123 __field( sector_t, sector ) 124 124 __field( unsigned int, nr_sector ) 125 - __field( int, error ) 125 + __field( int , error ) 126 126 __array( char, rwbs, RWBS_LEN ) 127 127 __dynamic_array( char, cmd, 1 ) 128 128 ), ··· 131 131 __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; 132 132 __entry->sector = blk_rq_pos(rq); 133 133 __entry->nr_sector = nr_bytes >> 9; 134 - __entry->error = error; 134 + __entry->error = blk_status_to_errno(error); 135 135 136 136 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); 137 137 __get_str(cmd)[0] = '\0';
+4 -3
kernel/trace/blktrace.c
··· 816 816 * Records an action against a request. Will log the bio offset + size. 817 817 * 818 818 **/ 819 - static void blk_add_trace_rq(struct request *rq, int error, 819 + static void blk_add_trace_rq(struct request *rq, blk_status_t error, 820 820 unsigned int nr_bytes, u32 what, u64 cgid) 821 821 { 822 822 struct blk_trace *bt; ··· 834 834 what |= BLK_TC_ACT(BLK_TC_FS); 835 835 836 836 __blk_add_trace(bt, blk_rq_trace_sector(rq), nr_bytes, req_op(rq), 837 - rq->cmd_flags, what, error, 0, NULL, cgid); 837 + rq->cmd_flags, what, blk_status_to_errno(error), 0, 838 + NULL, cgid); 838 839 rcu_read_unlock(); 839 840 } 840 841 ··· 864 863 } 865 864 866 865 static void blk_add_trace_rq_complete(void *ignore, struct request *rq, 867 - int error, unsigned int nr_bytes) 866 + blk_status_t error, unsigned int nr_bytes) 868 867 { 869 868 blk_add_trace_rq(rq, error, nr_bytes, BLK_TA_COMPLETE, 870 869 blk_trace_request_get_cgid(rq));