Skip to content

Commit 6975c1a

Browse files
Christoph Hellwigaxboe
authored andcommitted
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 <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 61952bb commit 6975c1a

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

block/blk-merge.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -871,11 +871,10 @@ static struct request *attempt_merge(struct request_queue *q,
871871
/* Don't merge requests with different write hints. */
872872
if (req->bio->bi_write_hint != next->bio->bi_write_hint)
873873
return NULL;
874+
if (req->bio->bi_ioprio != next->bio->bi_ioprio)
875+
return NULL;
874876
}
875877

876-
if (req->ioprio != next->ioprio)
877-
return NULL;
878-
879878
if (!blk_atomic_write_mergeable_rqs(req, next))
880879
return NULL;
881880

@@ -1007,11 +1006,10 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
10071006
/* Don't merge requests with different write hints. */
10081007
if (rq->bio->bi_write_hint != bio->bi_write_hint)
10091008
return false;
1009+
if (rq->bio->bi_ioprio != bio->bi_ioprio)
1010+
return false;
10101011
}
10111012

1012-
if (rq->ioprio != bio_prio(bio))
1013-
return false;
1014-
10151013
if (blk_atomic_write_mergeable_rq_bio(rq, bio) == false)
10161014
return false;
10171015

block/blk-mq.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ static void blk_print_req_error(struct request *req, blk_status_t status)
842842
blk_op_str(req_op(req)),
843843
(__force u32)(req->cmd_flags & ~REQ_OP_MASK),
844844
req->nr_phys_segments,
845-
IOPRIO_PRIO_CLASS(req->ioprio));
845+
IOPRIO_PRIO_CLASS(req_get_ioprio(req)));
846846
}
847847

848848
/*
@@ -3306,7 +3306,6 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
33063306
rq->special_vec = rq_src->special_vec;
33073307
}
33083308
rq->nr_phys_segments = rq_src->nr_phys_segments;
3309-
rq->ioprio = rq_src->ioprio;
33103309

33113310
if (rq->bio && blk_crypto_rq_bio_prep(rq, rq->bio, gfp_mask) < 0)
33123311
goto free_and_out;

include/linux/blk-mq.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ struct request {
156156
struct blk_crypto_keyslot *crypt_keyslot;
157157
#endif
158158

159-
unsigned short ioprio;
160-
161159
enum mq_rq_state state;
162160
atomic_t ref;
163161

@@ -221,7 +219,9 @@ static inline bool blk_rq_is_passthrough(struct request *rq)
221219

222220
static inline unsigned short req_get_ioprio(struct request *req)
223221
{
224-
return req->ioprio;
222+
if (req->bio)
223+
return req->bio->bi_ioprio;
224+
return 0;
225225
}
226226

227227
#define rq_data_dir(rq) (op_is_write(req_op(rq)) ? WRITE : READ)
@@ -984,7 +984,6 @@ static inline void blk_rq_bio_prep(struct request *rq, struct bio *bio,
984984
rq->nr_phys_segments = nr_segs;
985985
rq->__data_len = bio->bi_iter.bi_size;
986986
rq->bio = rq->biotail = bio;
987-
rq->ioprio = bio_prio(bio);
988987
}
989988

990989
void blk_mq_hctx_set_fq_lock_class(struct blk_mq_hw_ctx *hctx,

include/trace/events/block.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ TRACE_EVENT(block_rq_requeue,
9999
__entry->dev = rq->q->disk ? disk_devt(rq->q->disk) : 0;
100100
__entry->sector = blk_rq_trace_sector(rq);
101101
__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
102-
__entry->ioprio = rq->ioprio;
102+
__entry->ioprio = req_get_ioprio(rq);
103103

104104
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
105105
__get_str(cmd)[0] = '\0';
@@ -136,7 +136,7 @@ DECLARE_EVENT_CLASS(block_rq_completion,
136136
__entry->sector = blk_rq_pos(rq);
137137
__entry->nr_sector = nr_bytes >> 9;
138138
__entry->error = blk_status_to_errno(error);
139-
__entry->ioprio = rq->ioprio;
139+
__entry->ioprio = req_get_ioprio(rq);
140140

141141
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
142142
__get_str(cmd)[0] = '\0';
@@ -209,7 +209,7 @@ DECLARE_EVENT_CLASS(block_rq,
209209
__entry->sector = blk_rq_trace_sector(rq);
210210
__entry->nr_sector = blk_rq_trace_nr_sectors(rq);
211211
__entry->bytes = blk_rq_bytes(rq);
212-
__entry->ioprio = rq->ioprio;
212+
__entry->ioprio = req_get_ioprio(rq);
213213

214214
blk_fill_rwbs(__entry->rwbs, rq->cmd_flags);
215215
__get_str(cmd)[0] = '\0';

0 commit comments

Comments
 (0)