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

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 <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20241112170050.1612998-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
61952bb7 0b4ace9d

+13 -12
+10 -6
block/blk-merge.c
··· 867 867 if (rq_data_dir(req) != rq_data_dir(next)) 868 868 return NULL; 869 869 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 + } 873 875 874 876 if (req->ioprio != next->ioprio) 875 877 return NULL; ··· 1003 1001 if (!bio_crypt_rq_ctx_compatible(rq, bio)) 1004 1002 return false; 1005 1003 1006 - /* Don't merge requests with different write hints. */ 1007 - if (rq->write_hint != bio->bi_write_hint) 1008 - return false; 1004 + if (rq->bio) { 1005 + /* Don't merge requests with different write hints. */ 1006 + if (rq->bio->bi_write_hint != bio->bi_write_hint) 1007 + return false; 1008 + } 1009 1009 1010 1010 if (rq->ioprio != bio_prio(bio)) 1011 1011 return false;
-2
block/blk-mq.c
··· 2660 2660 rq->cmd_flags |= REQ_FAILFAST_MASK; 2661 2661 2662 2662 rq->__sector = bio->bi_iter.bi_sector; 2663 - rq->write_hint = bio->bi_write_hint; 2664 2663 blk_rq_bio_prep(rq, bio, nr_segs); 2665 2664 if (bio_integrity(bio)) 2666 2665 rq->nr_integrity_segments = blk_rq_count_integrity_sg(rq->q, ··· 3307 3308 } 3308 3309 rq->nr_phys_segments = rq_src->nr_phys_segments; 3309 3310 rq->ioprio = rq_src->ioprio; 3310 - rq->write_hint = rq_src->write_hint; 3311 3311 3312 3312 if (rq->bio && blk_crypto_rq_bio_prep(rq, rq->bio, gfp_mask) < 0) 3313 3313 goto free_and_out;
+3 -3
drivers/scsi/sd.c
··· 1190 1190 if (!sdkp->rscs) 1191 1191 return 0; 1192 1192 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); 1195 1195 } 1196 1196 1197 1197 static blk_status_t sd_setup_rw32_cmnd(struct scsi_cmnd *cmd, bool write, ··· 1389 1389 ret = sd_setup_rw16_cmnd(cmd, write, lba, nr_blocks, 1390 1390 protect | fua, dld); 1391 1391 } 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) { 1393 1393 ret = sd_setup_rw10_cmnd(cmd, write, lba, nr_blocks, 1394 1394 protect | fua); 1395 1395 } else {
-1
include/linux/blk-mq.h
··· 156 156 struct blk_crypto_keyslot *crypt_keyslot; 157 157 #endif 158 158 159 - enum rw_hint write_hint; 160 159 unsigned short ioprio; 161 160 162 161 enum mq_rq_state state;