diff options
author | Christoph Hellwig <hch@lst.de> | 2022-06-14 11:09:34 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-06-27 14:29:11 +0200 |
commit | 2a9336c42a6abdcef564d522648a684a474a3483 (patch) | |
tree | 9ebd3675e1f12ba19bf59089210016a5b3c49cc1 /block | |
parent | block: fold blk_max_size_offset into get_max_io_size (diff) | |
download | linux-2a9336c42a6abdcef564d522648a684a474a3483.tar.xz linux-2a9336c42a6abdcef564d522648a684a474a3483.zip |
block: move blk_queue_get_max_sectors to blk.h
blk_queue_get_max_sectors is private to the block layer, so move it out
of blkdev.h.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220614090934.570632-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r-- | block/blk.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/block/blk.h b/block/blk.h index 434017701403..8e79296ee97a 100644 --- a/block/blk.h +++ b/block/blk.h @@ -159,6 +159,19 @@ static inline bool blk_discard_mergable(struct request *req) return false; } +static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q, + int op) +{ + if (unlikely(op == REQ_OP_DISCARD || op == REQ_OP_SECURE_ERASE)) + return min(q->limits.max_discard_sectors, + UINT_MAX >> SECTOR_SHIFT); + + if (unlikely(op == REQ_OP_WRITE_ZEROES)) + return q->limits.max_write_zeroes_sectors; + + return q->limits.max_sectors; +} + #ifdef CONFIG_BLK_DEV_INTEGRITY void blk_flush_integrity(void); bool __bio_integrity_endio(struct bio *); |