Commit 0a26f327 authored by Keith Busch's avatar Keith Busch Committed by Jens Axboe

block: make BLK_DEF_MAX_SECTORS unsigned

This is used as an unsigned value, so define it that way to avoid
having to cast it.
Suggested-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarBart Van Assche <bvanassche@acm.org>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20230105205146.3610282-2-kbusch@meta.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 1bd43e19
...@@ -135,7 +135,7 @@ void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_secto ...@@ -135,7 +135,7 @@ void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_secto
limits->max_hw_sectors = max_hw_sectors; limits->max_hw_sectors = max_hw_sectors;
max_sectors = min_not_zero(max_hw_sectors, limits->max_dev_sectors); max_sectors = min_not_zero(max_hw_sectors, limits->max_dev_sectors);
max_sectors = min_t(unsigned int, max_sectors, BLK_DEF_MAX_SECTORS); max_sectors = min(max_sectors, BLK_DEF_MAX_SECTORS);
max_sectors = round_down(max_sectors, max_sectors = round_down(max_sectors,
limits->logical_block_size >> SECTOR_SHIFT); limits->logical_block_size >> SECTOR_SHIFT);
limits->max_sectors = max_sectors; limits->max_sectors = max_sectors;
......
...@@ -2123,8 +2123,7 @@ static int null_add_dev(struct nullb_device *dev) ...@@ -2123,8 +2123,7 @@ static int null_add_dev(struct nullb_device *dev)
blk_queue_physical_block_size(nullb->q, dev->blocksize); blk_queue_physical_block_size(nullb->q, dev->blocksize);
if (!dev->max_sectors) if (!dev->max_sectors)
dev->max_sectors = queue_max_hw_sectors(nullb->q); dev->max_sectors = queue_max_hw_sectors(nullb->q);
dev->max_sectors = min_t(unsigned int, dev->max_sectors, dev->max_sectors = min(dev->max_sectors, BLK_DEF_MAX_SECTORS);
BLK_DEF_MAX_SECTORS);
blk_queue_max_hw_sectors(nullb->q, dev->max_sectors); blk_queue_max_hw_sectors(nullb->q, dev->max_sectors);
if (dev->virt_boundary) if (dev->virt_boundary)
......
...@@ -1095,11 +1095,12 @@ static inline bool bdev_is_partition(struct block_device *bdev) ...@@ -1095,11 +1095,12 @@ static inline bool bdev_is_partition(struct block_device *bdev)
enum blk_default_limits { enum blk_default_limits {
BLK_MAX_SEGMENTS = 128, BLK_MAX_SEGMENTS = 128,
BLK_SAFE_MAX_SECTORS = 255, BLK_SAFE_MAX_SECTORS = 255,
BLK_DEF_MAX_SECTORS = 2560,
BLK_MAX_SEGMENT_SIZE = 65536, BLK_MAX_SEGMENT_SIZE = 65536,
BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL, BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL,
}; };
#define BLK_DEF_MAX_SECTORS 2560u
static inline unsigned long queue_segment_boundary(const struct request_queue *q) static inline unsigned long queue_segment_boundary(const struct request_queue *q)
{ {
return q->limits.seg_boundary_mask; return q->limits.seg_boundary_mask;
......
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