linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Increase BLK_DEF_MAX_SECTORS_CAP
@ 2025-06-17  6:34 Damien Le Moal
  2025-06-17 14:52 ` Ming Lei
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Damien Le Moal @ 2025-06-17  6:34 UTC (permalink / raw)
  To: Jens Axboe, linux-block; +Cc: Christoph Hellwig, Martin K . Petersen

Back in 2015, commit d2be537c3ba3 ("block: bump BLK_DEF_MAX_SECTORS to
2560") increased the default maximum size of a block device I/O to 2560
sectors (1280 KiB) to "accommodate a 10-data-disk stripe write with
chunk size 128k". This choice is rather arbitrary and since then,
improvements to the block layer have software RAID drivers correctly
advertize their stripe width through chunk_sectors and abuses of
BLK_DEF_MAX_SECTORS_CAP by drivers (to set the HW limit rather than the
default user controlled maximum I/O size) have been fixed.

Since many block devices can benefit from a larger value of
BLK_DEF_MAX_SECTORS_CAP, and in particular HDDs, increase this value to
be 4MiB, or 8192 sectors.

Suggested-by: Martin K . Petersen <martin.petersen@oracle.com>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 include/linux/blkdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 85aab8bc96e7..7c35b2462048 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1238,7 +1238,7 @@ enum blk_default_limits {
  * Not to be confused with the max_hw_sector limit that is entirely
  * controlled by the driver, usually based on hardware limits.
  */
-#define BLK_DEF_MAX_SECTORS_CAP	2560u
+#define BLK_DEF_MAX_SECTORS_CAP	8192u
 
 static inline struct queue_limits *bdev_limits(struct block_device *bdev)
 {
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] block: Increase BLK_DEF_MAX_SECTORS_CAP
  2025-06-17  6:34 [PATCH] block: Increase BLK_DEF_MAX_SECTORS_CAP Damien Le Moal
@ 2025-06-17 14:52 ` Ming Lei
  2025-06-18  1:40   ` Damien Le Moal
  2025-06-18  1:37 ` Martin K. Petersen
  2025-06-18  4:59 ` Christoph Hellwig
  2 siblings, 1 reply; 6+ messages in thread
From: Ming Lei @ 2025-06-17 14:52 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Martin K . Petersen

On Tue, Jun 17, 2025 at 03:34:30PM +0900, Damien Le Moal wrote:
> Back in 2015, commit d2be537c3ba3 ("block: bump BLK_DEF_MAX_SECTORS to
> 2560") increased the default maximum size of a block device I/O to 2560
> sectors (1280 KiB) to "accommodate a 10-data-disk stripe write with
> chunk size 128k". This choice is rather arbitrary and since then,
> improvements to the block layer have software RAID drivers correctly
> advertize their stripe width through chunk_sectors and abuses of
> BLK_DEF_MAX_SECTORS_CAP by drivers (to set the HW limit rather than the
> default user controlled maximum I/O size) have been fixed.
> 
> Since many block devices can benefit from a larger value of
> BLK_DEF_MAX_SECTORS_CAP, and in particular HDDs, increase this value to
> be 4MiB, or 8192 sectors.
> 
> Suggested-by: Martin K . Petersen <martin.petersen@oracle.com>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  include/linux/blkdev.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 85aab8bc96e7..7c35b2462048 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1238,7 +1238,7 @@ enum blk_default_limits {
>   * Not to be confused with the max_hw_sector limit that is entirely
>   * controlled by the driver, usually based on hardware limits.
>   */
> -#define BLK_DEF_MAX_SECTORS_CAP	2560u
> +#define BLK_DEF_MAX_SECTORS_CAP	8192u

The change itself looks good, but the definition should belong to block
layer internal, so why not move it into internal header?


thanks,
Ming


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block: Increase BLK_DEF_MAX_SECTORS_CAP
  2025-06-17  6:34 [PATCH] block: Increase BLK_DEF_MAX_SECTORS_CAP Damien Le Moal
  2025-06-17 14:52 ` Ming Lei
@ 2025-06-18  1:37 ` Martin K. Petersen
  2025-06-18  4:59 ` Christoph Hellwig
  2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2025-06-18  1:37 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Martin K . Petersen


Damien,

> Since many block devices can benefit from a larger value of
> BLK_DEF_MAX_SECTORS_CAP, and in particular HDDs, increase this value
> to be 4MiB, or 8192 sectors.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block: Increase BLK_DEF_MAX_SECTORS_CAP
  2025-06-17 14:52 ` Ming Lei
@ 2025-06-18  1:40   ` Damien Le Moal
  0 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2025-06-18  1:40 UTC (permalink / raw)
  To: Ming Lei; +Cc: Jens Axboe, linux-block, Christoph Hellwig, Martin K . Petersen

On 6/17/25 23:52, Ming Lei wrote:
> On Tue, Jun 17, 2025 at 03:34:30PM +0900, Damien Le Moal wrote:
>> Back in 2015, commit d2be537c3ba3 ("block: bump BLK_DEF_MAX_SECTORS to
>> 2560") increased the default maximum size of a block device I/O to 2560
>> sectors (1280 KiB) to "accommodate a 10-data-disk stripe write with
>> chunk size 128k". This choice is rather arbitrary and since then,
>> improvements to the block layer have software RAID drivers correctly
>> advertize their stripe width through chunk_sectors and abuses of
>> BLK_DEF_MAX_SECTORS_CAP by drivers (to set the HW limit rather than the
>> default user controlled maximum I/O size) have been fixed.
>>
>> Since many block devices can benefit from a larger value of
>> BLK_DEF_MAX_SECTORS_CAP, and in particular HDDs, increase this value to
>> be 4MiB, or 8192 sectors.
>>
>> Suggested-by: Martin K . Petersen <martin.petersen@oracle.com>
>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>> ---
>>  include/linux/blkdev.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
>> index 85aab8bc96e7..7c35b2462048 100644
>> --- a/include/linux/blkdev.h
>> +++ b/include/linux/blkdev.h
>> @@ -1238,7 +1238,7 @@ enum blk_default_limits {
>>   * Not to be confused with the max_hw_sector limit that is entirely
>>   * controlled by the driver, usually based on hardware limits.
>>   */
>> -#define BLK_DEF_MAX_SECTORS_CAP	2560u
>> +#define BLK_DEF_MAX_SECTORS_CAP	8192u
> 
> The change itself looks good, but the definition should belong to block
> layer internal, so why not move it into internal header?

Good point. Now that no driver uses this macro directly, we can do that. I will
send a V2.

-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block: Increase BLK_DEF_MAX_SECTORS_CAP
  2025-06-17  6:34 [PATCH] block: Increase BLK_DEF_MAX_SECTORS_CAP Damien Le Moal
  2025-06-17 14:52 ` Ming Lei
  2025-06-18  1:37 ` Martin K. Petersen
@ 2025-06-18  4:59 ` Christoph Hellwig
  2025-06-18  5:11   ` Damien Le Moal
  2 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2025-06-18  4:59 UTC (permalink / raw)
  To: Damien Le Moal
  Cc: Jens Axboe, linux-block, Christoph Hellwig, Martin K . Petersen

On Tue, Jun 17, 2025 at 03:34:30PM +0900, Damien Le Moal wrote:
> Since many block devices can benefit from a larger value of
> BLK_DEF_MAX_SECTORS_CAP, and in particular HDDs, increase this value to
> be 4MiB, or 8192 sectors.
> 
> Suggested-by: Martin K . Petersen <martin.petersen@oracle.com>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>  include/linux/blkdev.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
> index 85aab8bc96e7..7c35b2462048 100644
> --- a/include/linux/blkdev.h
> +++ b/include/linux/blkdev.h
> @@ -1238,7 +1238,7 @@ enum blk_default_limits {
>   * Not to be confused with the max_hw_sector limit that is entirely
>   * controlled by the driver, usually based on hardware limits.
>   */
> -#define BLK_DEF_MAX_SECTORS_CAP	2560u
> +#define BLK_DEF_MAX_SECTORS_CAP	8192u

While we're at nitpicking, maybe define this as

	(SZ_4M >> SECTOR_SHIFT)

to make it a bit more readable?

Otherwise this looks good, the odd number was always rather weird.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] block: Increase BLK_DEF_MAX_SECTORS_CAP
  2025-06-18  4:59 ` Christoph Hellwig
@ 2025-06-18  5:11   ` Damien Le Moal
  0 siblings, 0 replies; 6+ messages in thread
From: Damien Le Moal @ 2025-06-18  5:11 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Jens Axboe, linux-block, Martin K . Petersen

On 6/18/25 13:59, Christoph Hellwig wrote:
> On Tue, Jun 17, 2025 at 03:34:30PM +0900, Damien Le Moal wrote:
>> Since many block devices can benefit from a larger value of
>> BLK_DEF_MAX_SECTORS_CAP, and in particular HDDs, increase this value to
>> be 4MiB, or 8192 sectors.
>>
>> Suggested-by: Martin K . Petersen <martin.petersen@oracle.com>
>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>> ---
>>  include/linux/blkdev.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
>> index 85aab8bc96e7..7c35b2462048 100644
>> --- a/include/linux/blkdev.h
>> +++ b/include/linux/blkdev.h
>> @@ -1238,7 +1238,7 @@ enum blk_default_limits {
>>   * Not to be confused with the max_hw_sector limit that is entirely
>>   * controlled by the driver, usually based on hardware limits.
>>   */
>> -#define BLK_DEF_MAX_SECTORS_CAP	2560u
>> +#define BLK_DEF_MAX_SECTORS_CAP	8192u
> 
> While we're at nitpicking, maybe define this as
> 
> 	(SZ_4M >> SECTOR_SHIFT)
> 
> to make it a bit more readable?

Sure thing.

> 
> Otherwise this looks good, the odd number was always rather weird.
> 
> 


-- 
Damien Le Moal
Western Digital Research

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-06-18  5:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17  6:34 [PATCH] block: Increase BLK_DEF_MAX_SECTORS_CAP Damien Le Moal
2025-06-17 14:52 ` Ming Lei
2025-06-18  1:40   ` Damien Le Moal
2025-06-18  1:37 ` Martin K. Petersen
2025-06-18  4:59 ` Christoph Hellwig
2025-06-18  5:11   ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).