Commit 2a9336c4 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20220614090934.570632-7-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent efef739d
...@@ -159,6 +159,19 @@ static inline bool blk_discard_mergable(struct request *req) ...@@ -159,6 +159,19 @@ static inline bool blk_discard_mergable(struct request *req)
return false; 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 #ifdef CONFIG_BLK_DEV_INTEGRITY
void blk_flush_integrity(void); void blk_flush_integrity(void);
bool __bio_integrity_endio(struct bio *); bool __bio_integrity_endio(struct bio *);
......
...@@ -921,19 +921,6 @@ static inline unsigned int bio_zone_is_seq(struct bio *bio) ...@@ -921,19 +921,6 @@ static inline unsigned int bio_zone_is_seq(struct bio *bio)
} }
#endif /* CONFIG_BLK_DEV_ZONED */ #endif /* CONFIG_BLK_DEV_ZONED */
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;
}
/* /*
* Return how much of the chunk is left to be used for I/O at a given offset. * Return how much of the chunk is left to be used for I/O at a given offset.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment