Skip to content

Commit 61952bb

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: remove the write_hint field from struct request
The write_hint is only used for read/write requests, which must have a bio attached to them. Just 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 0b4ace9 commit 61952bb

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

block/blk-merge.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,11 @@ static struct request *attempt_merge(struct request_queue *q,
867867
if (rq_data_dir(req) != rq_data_dir(next))
868868
return NULL;
869869

870-
/* Don't merge requests with different write hints. */
871-
if (req->write_hint != next->write_hint)
872-
return NULL;
870+
if (req->bio && next->bio) {
871+
/* Don't merge requests with different write hints. */
872+
if (req->bio->bi_write_hint != next->bio->bi_write_hint)
873+
return NULL;
874+
}
873875

874876
if (req->ioprio != next->ioprio)
875877
return NULL;
@@ -1001,9 +1003,11 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
10011003
if (!bio_crypt_rq_ctx_compatible(rq, bio))
10021004
return false;
10031005

1004-
/* Don't merge requests with different write hints. */
1005-
if (rq->write_hint != bio->bi_write_hint)
1006-
return false;
1006+
if (rq->bio) {
1007+
/* Don't merge requests with different write hints. */
1008+
if (rq->bio->bi_write_hint != bio->bi_write_hint)
1009+
return false;
1010+
}
10071011

10081012
if (rq->ioprio != bio_prio(bio))
10091013
return false;

block/blk-mq.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,7 +2660,6 @@ static void blk_mq_bio_to_request(struct request *rq, struct bio *bio,
26602660
rq->cmd_flags |= REQ_FAILFAST_MASK;
26612661

26622662
rq->__sector = bio->bi_iter.bi_sector;
2663-
rq->write_hint = bio->bi_write_hint;
26642663
blk_rq_bio_prep(rq, bio, nr_segs);
26652664
if (bio_integrity(bio))
26662665
rq->nr_integrity_segments = blk_rq_count_integrity_sg(rq->q,
@@ -3308,7 +3307,6 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
33083307
}
33093308
rq->nr_phys_segments = rq_src->nr_phys_segments;
33103309
rq->ioprio = rq_src->ioprio;
3311-
rq->write_hint = rq_src->write_hint;
33123310

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

drivers/scsi/sd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,8 +1190,8 @@ static u8 sd_group_number(struct scsi_cmnd *cmd)
11901190
if (!sdkp->rscs)
11911191
return 0;
11921192

1193-
return min3((u32)rq->write_hint, (u32)sdkp->permanent_stream_count,
1194-
0x3fu);
1193+
return min3((u32)rq->bio->bi_write_hint,
1194+
(u32)sdkp->permanent_stream_count, 0x3fu);
11951195
}
11961196

11971197
static blk_status_t sd_setup_rw32_cmnd(struct scsi_cmnd *cmd, bool write,
@@ -1389,7 +1389,7 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)
13891389
ret = sd_setup_rw16_cmnd(cmd, write, lba, nr_blocks,
13901390
protect | fua, dld);
13911391
} else if ((nr_blocks > 0xff) || (lba > 0x1fffff) ||
1392-
sdp->use_10_for_rw || protect || rq->write_hint) {
1392+
sdp->use_10_for_rw || protect || rq->bio->bi_write_hint) {
13931393
ret = sd_setup_rw10_cmnd(cmd, write, lba, nr_blocks,
13941394
protect | fua);
13951395
} else {

include/linux/blk-mq.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ struct request {
156156
struct blk_crypto_keyslot *crypt_keyslot;
157157
#endif
158158

159-
enum rw_hint write_hint;
160159
unsigned short ioprio;
161160

162161
enum mq_rq_state state;

0 commit comments

Comments
 (0)