Message ID | 20230418224002.1195163-3-bvanassche@acm.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mq-deadline: Improve support for zoned block devices | expand |
On Tue, Apr 18, 2023 at 03:39:53PM -0700, Bart Van Assche wrote: > Instead of using the following expression to translate a request pointer > into a request queue pointer: rq->q->disk->part0->bd_queue, use the > following expression: rq->q. This looks correct, but I also kinda hate adding queue back in more places.
On 4/18/23 21:11, Christoph Hellwig wrote: > On Tue, Apr 18, 2023 at 03:39:53PM -0700, Bart Van Assche wrote: >> Instead of using the following expression to translate a request pointer >> into a request queue pointer: rq->q->disk->part0->bd_queue, use the >> following expression: rq->q. > > This looks correct, but I also kinda hate adding queue back in more > places. Hi Christoph, How about changing queue_op_is_zoned_write() into disk_op_is_zoned_write()? That won't be as efficient as patch 2/11 in this series but still removes the 'part0' dereference. Thanks, Bart.
On Wed, Apr 19, 2023 at 11:30:36AM -0700, Bart Van Assche wrote: >> This looks correct, but I also kinda hate adding queue back in more >> places. > > Hi Christoph, > > How about changing queue_op_is_zoned_write() into disk_op_is_zoned_write()? > That won't be as efficient as patch 2/11 in this series but still removes > the 'part0' dereference. Or just open code it since we only have two callers anyway?
diff --git a/block/blk-mq.h b/block/blk-mq.h index e876584d3516..6b5bc0b8d7b8 100644 --- a/block/blk-mq.h +++ b/block/blk-mq.h @@ -368,7 +368,7 @@ static inline struct blk_plug *blk_mq_plug( struct bio *bio) { /* Zoned block device write operation case: do not plug the BIO */ if (IS_ENABLED(CONFIG_BLK_DEV_ZONED) && - bdev_op_is_zoned_write(bio->bi_bdev, bio_op(bio))) + queue_op_is_zoned_write(bdev_get_queue(bio->bi_bdev), bio_op(bio))) return NULL; /* diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 835d9e937d4d..c93a26ce4670 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -60,7 +60,7 @@ bool blk_req_needs_zone_write_lock(struct request *rq) if (!rq->q->disk->seq_zones_wlock) return false; - if (bdev_op_is_zoned_write(rq->q->disk->part0, req_op(rq))) + if (queue_op_is_zoned_write(rq->q, req_op(rq))) return blk_rq_zone_is_seq(rq); return false; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index e3242e67a8e3..261538319bbf 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1284,10 +1284,10 @@ static inline unsigned int bdev_zone_no(struct block_device *bdev, sector_t sec) return disk_zone_no(bdev->bd_disk, sec); } -static inline bool bdev_op_is_zoned_write(struct block_device *bdev, - blk_opf_t op) +static inline bool queue_op_is_zoned_write(struct request_queue *q, + enum req_op op) { - if (!bdev_is_zoned(bdev)) + if (!blk_queue_is_zoned(q)) return false; return op == REQ_OP_WRITE || op == REQ_OP_WRITE_ZEROES;
Instead of using the following expression to translate a request pointer into a request queue pointer: rq->q->disk->part0->bd_queue, use the following expression: rq->q. Cc: Damien Le Moal <damien.lemoal@opensource.wdc.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Ming Lei <ming.lei@redhat.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- block/blk-mq.h | 2 +- block/blk-zoned.c | 2 +- include/linux/blkdev.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)