mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
block: pre-calculate max_zone_append_sectors
max_zone_append_sectors differs from all other queue limits in that the final value used is not stored in the queue_limits but needs to be obtained using queue_limits_max_zone_append_sectors helper. This not only adds (tiny) extra overhead to the I/O path, but also can be easily forgotten in file system code. Add a new max_hw_zone_append_sectors value to queue_limits which is set by the driver, and calculate max_zone_append_sectors from that and the other inputs in blk_validate_zoned_limits, similar to how max_sectors is calculated to fix this. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20241104073955.112324-3-hch@lst.de Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Link: https://lore.kernel.org/r/20241108154657.845768-2-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
0ef2b9e698
commit
559218d43e
@@ -375,6 +375,7 @@ struct queue_limits {
|
||||
unsigned int max_user_discard_sectors;
|
||||
unsigned int max_secure_erase_sectors;
|
||||
unsigned int max_write_zeroes_sectors;
|
||||
unsigned int max_hw_zone_append_sectors;
|
||||
unsigned int max_zone_append_sectors;
|
||||
unsigned int discard_granularity;
|
||||
unsigned int discard_alignment;
|
||||
@@ -1208,25 +1209,9 @@ static inline unsigned int queue_max_segment_size(const struct request_queue *q)
|
||||
return q->limits.max_segment_size;
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
queue_limits_max_zone_append_sectors(const struct queue_limits *l)
|
||||
{
|
||||
unsigned int max_sectors = min(l->chunk_sectors, l->max_hw_sectors);
|
||||
|
||||
return min_not_zero(l->max_zone_append_sectors, max_sectors);
|
||||
}
|
||||
|
||||
static inline unsigned int queue_max_zone_append_sectors(struct request_queue *q)
|
||||
{
|
||||
if (!blk_queue_is_zoned(q))
|
||||
return 0;
|
||||
|
||||
return queue_limits_max_zone_append_sectors(&q->limits);
|
||||
}
|
||||
|
||||
static inline bool queue_emulates_zone_append(struct request_queue *q)
|
||||
{
|
||||
return blk_queue_is_zoned(q) && !q->limits.max_zone_append_sectors;
|
||||
return blk_queue_is_zoned(q) && !q->limits.max_hw_zone_append_sectors;
|
||||
}
|
||||
|
||||
static inline bool bdev_emulates_zone_append(struct block_device *bdev)
|
||||
@@ -1237,7 +1222,7 @@ static inline bool bdev_emulates_zone_append(struct block_device *bdev)
|
||||
static inline unsigned int
|
||||
bdev_max_zone_append_sectors(struct block_device *bdev)
|
||||
{
|
||||
return queue_max_zone_append_sectors(bdev_get_queue(bdev));
|
||||
return bdev_limits(bdev)->max_zone_append_sectors;
|
||||
}
|
||||
|
||||
static inline unsigned int bdev_max_segments(struct block_device *bdev)
|
||||
|
||||
Reference in New Issue
Block a user