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

block: remove the ioprio field from struct request

The request ioprio is only initialized from the first attached bio,
so requests without a bio already never set it. Directly use the
bio field instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20241112170050.1612998-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
6975c1a4 61952bb7

+11 -15
+4 -6
block/blk-merge.c
··· 871 871 /* Don't merge requests with different write hints. */ 872 872 if (req->bio->bi_write_hint != next->bio->bi_write_hint) 873 873 return NULL; 874 + if (req->bio->bi_ioprio != next->bio->bi_ioprio) 875 + return NULL; 874 876 } 875 - 876 - if (req->ioprio != next->ioprio) 877 - return NULL; 878 877 879 878 if (!blk_atomic_write_mergeable_rqs(req, next)) 880 879 return NULL; ··· 1006 1007 /* Don't merge requests with different write hints. */ 1007 1008 if (rq->bio->bi_write_hint != bio->bi_write_hint) 1008 1009 return false; 1010 + if (rq->bio->bi_ioprio != bio->bi_ioprio) 1011 + return false; 1009 1012 } 1010 - 1011 - if (rq->ioprio != bio_prio(bio)) 1012 - return false; 1013 1013 1014 1014 if (blk_atomic_write_mergeable_rq_bio(rq, bio) == false) 1015 1015 return false;
+1 -2
block/blk-mq.c
··· 842 842 blk_op_str(req_op(req)), 843 843 (__force u32)(req->cmd_flags & ~REQ_OP_MASK), 844 844 req->nr_phys_segments, 845 - IOPRIO_PRIO_CLASS(req->ioprio)); 845 + IOPRIO_PRIO_CLASS(req_get_ioprio(req))); 846 846 } 847 847 848 848 /* ··· 3306 3306 rq->special_vec = rq_src->special_vec; 3307 3307 } 3308 3308 rq->nr_phys_segments = rq_src->nr_phys_segments; 3309 - rq->ioprio = rq_src->ioprio; 3310 3309 3311 3310 if (rq->bio && blk_crypto_rq_bio_prep(rq, rq->bio, gfp_mask) < 0) 3312 3311 goto free_and_out;
+3 -4
include/linux/blk-mq.h
··· 156 156 struct blk_crypto_keyslot *crypt_keyslot; 157 157 #endif 158 158 159 - unsigned short ioprio; 160 - 161 159 enum mq_rq_state state; 162 160 atomic_t ref; 163 161 ··· 219 221 220 222 static inline unsigned short req_get_ioprio(struct request *req) 221 223 { 222 - return req->ioprio; 224 + if (req->bio) 225 + return req->bio->bi_ioprio; 226 + return 0; 223 227 } 224 228 225 229 #define rq_data_dir(rq) (op_is_write(req_op(rq)) ? WRITE : READ) ··· 984 984 rq->nr_phys_segments = nr_segs; 985 985 rq->__data_len = bio->bi_iter.bi_size; 986 986 rq->bio = rq->biotail = bio; 987 - rq->ioprio = bio_prio(bio); 988 987 } 989 988 990 989 void blk_mq_hctx_set_fq_lock_class(struct blk_mq_hw_ctx *hctx,
+3 -3
include/trace/events/block.h
··· 99 99 __entry->dev = rq->q->disk ? disk_devt(rq->q->disk) : 0; 100 100 __entry->sector = blk_rq_trace_sector(rq); 101 101 __entry->nr_sector = blk_rq_trace_nr_sectors(rq); 102 - __entry->ioprio = rq->ioprio; 102 + __entry->ioprio = req_get_ioprio(rq); 103 103 104 104 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); 105 105 __get_str(cmd)[0] = '\0'; ··· 136 136 __entry->sector = blk_rq_pos(rq); 137 137 __entry->nr_sector = nr_bytes >> 9; 138 138 __entry->error = blk_status_to_errno(error); 139 - __entry->ioprio = rq->ioprio; 139 + __entry->ioprio = req_get_ioprio(rq); 140 140 141 141 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); 142 142 __get_str(cmd)[0] = '\0'; ··· 209 209 __entry->sector = blk_rq_trace_sector(rq); 210 210 __entry->nr_sector = blk_rq_trace_nr_sectors(rq); 211 211 __entry->bytes = blk_rq_bytes(rq); 212 - __entry->ioprio = rq->ioprio; 212 + __entry->ioprio = req_get_ioprio(rq); 213 213 214 214 blk_fill_rwbs(__entry->rwbs, rq->cmd_flags); 215 215 __get_str(cmd)[0] = '\0';