diff mbox series

[01/14] block: move max_{open,active}_zones to struct queue_limits

Message ID 20240128165813.3213508-2-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [01/14] block: move max_{open,active}_zones to struct queue_limits | expand

Commit Message

Christoph Hellwig Jan. 28, 2024, 4:58 p.m. UTC
The maximum number of open and active zones is a limit on the queue
and should be places there so that we can including it in the upcoming
queue limits batch update API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 include/linux/blkdev.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Bart Van Assche Jan. 28, 2024, 11:32 p.m. UTC | #1
On 1/28/24 08:58, Christoph Hellwig wrote:
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 99e4f5e722132c..4a2e82c7971c86 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -189,8 +189,6 @@ struct gendisk {
>   	 * blk_mq_unfreeze_queue().
>   	 */
>   	unsigned int		nr_zones;
> -	unsigned int		max_open_zones;
> -	unsigned int		max_active_zones;
>   	unsigned long		*conv_zones_bitmap;
>   	unsigned long		*seq_zones_wlock;
>   #endif /* CONFIG_BLK_DEV_ZONED */
> @@ -307,6 +305,8 @@ struct queue_limits {
>   	unsigned char		discard_misaligned;
>   	unsigned char		raid_partial_stripes_expensive;
>   	bool			zoned;
> +	unsigned int		max_open_zones;
> +	unsigned int		max_active_zones;

Not all struct queue_limits instances are associated with a gendisk. Do we need
a way to separate the limits that apply to all request queues from the limits
that only apply to disks in struct queue_limits, e.g. a comment that separates
the two?

Thanks,

Bart.
Christoph Hellwig Jan. 29, 2024, 6:15 a.m. UTC | #2
On Sun, Jan 28, 2024 at 03:32:32PM -0800, Bart Van Assche wrote:
>> @@ -307,6 +305,8 @@ struct queue_limits {
>>   	unsigned char		discard_misaligned;
>>   	unsigned char		raid_partial_stripes_expensive;
>>   	bool			zoned;
>> +	unsigned int		max_open_zones;
>> +	unsigned int		max_active_zones;
>
> Not all struct queue_limits instances are associated with a gendisk. Do we need
> a way to separate the limits that apply to all request queues from the limits
> that only apply to disks in struct queue_limits, e.g. a comment that separates
> the two?

I've actually been thinking about that for a while.  It does sound like
a good idea but I wonder how practical it is.  But that is on the table
for after we've sorted out the basic API problems, as that makes
splitting it much easier if we do that eventually.
diff mbox series

Patch

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 99e4f5e722132c..4a2e82c7971c86 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -189,8 +189,6 @@  struct gendisk {
 	 * blk_mq_unfreeze_queue().
 	 */
 	unsigned int		nr_zones;
-	unsigned int		max_open_zones;
-	unsigned int		max_active_zones;
 	unsigned long		*conv_zones_bitmap;
 	unsigned long		*seq_zones_wlock;
 #endif /* CONFIG_BLK_DEV_ZONED */
@@ -307,6 +305,8 @@  struct queue_limits {
 	unsigned char		discard_misaligned;
 	unsigned char		raid_partial_stripes_expensive;
 	bool			zoned;
+	unsigned int		max_open_zones;
+	unsigned int		max_active_zones;
 
 	/*
 	 * Drivers that set dma_alignment to less than 511 must be prepared to
@@ -639,23 +639,23 @@  static inline bool disk_zone_is_seq(struct gendisk *disk, sector_t sector)
 static inline void disk_set_max_open_zones(struct gendisk *disk,
 		unsigned int max_open_zones)
 {
-	disk->max_open_zones = max_open_zones;
+	disk->queue->limits.max_open_zones = max_open_zones;
 }
 
 static inline void disk_set_max_active_zones(struct gendisk *disk,
 		unsigned int max_active_zones)
 {
-	disk->max_active_zones = max_active_zones;
+	disk->queue->limits.max_active_zones = max_active_zones;
 }
 
 static inline unsigned int bdev_max_open_zones(struct block_device *bdev)
 {
-	return bdev->bd_disk->max_open_zones;
+	return bdev->bd_disk->queue->limits.max_open_zones;
 }
 
 static inline unsigned int bdev_max_active_zones(struct block_device *bdev)
 {
-	return bdev->bd_disk->max_active_zones;
+	return bdev->bd_disk->queue->limits.max_active_zones;
 }
 
 #else /* CONFIG_BLK_DEV_ZONED */