Skip to content

Commit 8d1dfd5

Browse files
johnpgarryaxboe
authored andcommitted
block: Pass blk_queue_get_max_sectors() a request pointer
Currently blk_queue_get_max_sectors() is passed a enum req_op. In future the value returned from blk_queue_get_max_sectors() may depend on certain request flags, so pass a request pointer. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: John Garry <john.g.garry@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Acked-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Link: https://lore.kernel.org/r/20240620125359.2684798-2-john.g.garry@oracle.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent e821bce commit 8d1dfd5

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

block/blk-merge.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,8 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq,
593593
if (blk_rq_is_passthrough(rq))
594594
return q->limits.max_hw_sectors;
595595

596-
max_sectors = blk_queue_get_max_sectors(q, req_op(rq));
596+
max_sectors = blk_queue_get_max_sectors(rq);
597+
597598
if (!q->limits.chunk_sectors ||
598599
req_op(rq) == REQ_OP_DISCARD ||
599600
req_op(rq) == REQ_OP_SECURE_ERASE)

block/blk-mq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3036,7 +3036,7 @@ void blk_mq_submit_bio(struct bio *bio)
30363036
blk_status_t blk_insert_cloned_request(struct request *rq)
30373037
{
30383038
struct request_queue *q = rq->q;
3039-
unsigned int max_sectors = blk_queue_get_max_sectors(q, req_op(rq));
3039+
unsigned int max_sectors = blk_queue_get_max_sectors(rq);
30403040
unsigned int max_segments = blk_rq_get_max_segments(rq);
30413041
blk_status_t ret;
30423042

block/blk.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,11 @@ static inline unsigned int blk_rq_get_max_segments(struct request *rq)
182182
return queue_max_segments(rq->q);
183183
}
184184

185-
static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q,
186-
enum req_op op)
185+
static inline unsigned int blk_queue_get_max_sectors(struct request *rq)
187186
{
187+
struct request_queue *q = rq->q;
188+
enum req_op op = req_op(rq);
189+
188190
if (unlikely(op == REQ_OP_DISCARD || op == REQ_OP_SECURE_ERASE))
189191
return min(q->limits.max_discard_sectors,
190192
UINT_MAX >> SECTOR_SHIFT);

0 commit comments

Comments
 (0)