[PATCH v2 02/11] block: Micro-optimize blk_req_needs_zone_write_lock()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxx>
Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Ming Lei <ming.lei@xxxxxxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
 block/blk-mq.h         | 2 +-
 block/blk-zoned.c      | 2 +-
 include/linux/blkdev.h | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

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;



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux