public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] block: rename min_segment_size
@ 2025-10-20 20:47 Keith Busch
  2025-10-20 23:28 ` Chaitanya Kulkarni
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Keith Busch @ 2025-10-20 20:47 UTC (permalink / raw)
  To: linux-block, axboe; +Cc: hch, ming.lei, martin.petersen, Keith Busch

From: Keith Busch <kbusch@kernel.org>

Despite its name, the block layer is fine with segments smaller that the
"min_segment_size" limit. The value is an optimization limit indicating
the largest segment that can be used without considering boundary
limits. Smaller segments can take a fast path, so give it a name that
reflects that: max_fast_segment_size.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
v1->v2:

  Going with  "max_fast_segment_size" in this version.

 block/blk-merge.c      | 2 +-
 block/blk-settings.c   | 4 ++--
 block/blk.h            | 2 +-
 include/linux/blkdev.h | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/block/blk-merge.c b/block/blk-merge.c
index 37864c5d287ef..c47d18587a0b6 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -336,7 +336,7 @@ int bio_split_io_at(struct bio *bio, const struct queue_limits *lim,
 
 		if (nsegs < lim->max_segments &&
 		    bytes + bv.bv_len <= max_bytes &&
-		    bv.bv_offset + bv.bv_len <= lim->min_segment_size) {
+		    bv.bv_offset + bv.bv_len <= lim->max_fast_segment_size) {
 			nsegs++;
 			bytes += bv.bv_len;
 		} else {
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 54cffaae4df49..345b6a271cc35 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -457,12 +457,12 @@ int blk_validate_limits(struct queue_limits *lim)
 			return -EINVAL;
 	}
 
-	/* setup min segment size for building new segment in fast path */
+	/* setup max segment size for building new segment in fast path */
 	if (lim->seg_boundary_mask > lim->max_segment_size - 1)
 		seg_size = lim->max_segment_size;
 	else
 		seg_size = lim->seg_boundary_mask + 1;
-	lim->min_segment_size = min_t(unsigned int, seg_size, PAGE_SIZE);
+	lim->max_fast_segment_size = min_t(unsigned int, seg_size, PAGE_SIZE);
 
 	/*
 	 * We require drivers to at least do logical block aligned I/O, but
diff --git a/block/blk.h b/block/blk.h
index 170794632135d..32a10024efbaa 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -377,7 +377,7 @@ static inline bool bio_may_need_split(struct bio *bio,
 	if (bio->bi_vcnt != 1)
 		return true;
 	return bio->bi_io_vec->bv_len + bio->bi_io_vec->bv_offset >
-		lim->min_segment_size;
+		lim->max_fast_segment_size;
 }
 
 /**
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 70b671a9a7f77..99be263b31ab5 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -378,7 +378,7 @@ struct queue_limits {
 	unsigned int		max_sectors;
 	unsigned int		max_user_sectors;
 	unsigned int		max_segment_size;
-	unsigned int		min_segment_size;
+	unsigned int		max_fast_segment_size;
 	unsigned int		physical_block_size;
 	unsigned int		logical_block_size;
 	unsigned int		alignment_offset;
-- 
2.47.3


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

* Re: [PATCHv2] block: rename min_segment_size
  2025-10-20 20:47 [PATCHv2] block: rename min_segment_size Keith Busch
@ 2025-10-20 23:28 ` Chaitanya Kulkarni
  2025-10-21  1:45 ` Ming Lei
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2025-10-20 23:28 UTC (permalink / raw)
  To: Keith Busch, linux-block@vger.kernel.org, axboe@kernel.dk
  Cc: hch@lst.de, ming.lei@redhat.com, martin.petersen@oracle.com,
	Keith Busch

On 10/20/25 13:47, Keith Busch wrote:
> From: Keith Busch<kbusch@kernel.org>
>
> Despite its name, the block layer is fine with segments smaller that the
> "min_segment_size" limit. The value is an optimization limit indicating
> the largest segment that can be used without considering boundary
> limits. Smaller segments can take a fast path, so give it a name that
> reflects that: max_fast_segment_size.
>
> Signed-off-by: Keith Busch<kbusch@kernel.org>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



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

* Re: [PATCHv2] block: rename min_segment_size
  2025-10-20 20:47 [PATCHv2] block: rename min_segment_size Keith Busch
  2025-10-20 23:28 ` Chaitanya Kulkarni
@ 2025-10-21  1:45 ` Ming Lei
  2025-10-21  2:22 ` Martin K. Petersen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Ming Lei @ 2025-10-21  1:45 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-block, axboe, hch, martin.petersen, Keith Busch

On Tue, Oct 21, 2025 at 4:47 AM Keith Busch <kbusch@meta.com> wrote:
>
> From: Keith Busch <kbusch@kernel.org>
>
> Despite its name, the block layer is fine with segments smaller that the
> "min_segment_size" limit. The value is an optimization limit indicating
> the largest segment that can be used without considering boundary
> limits. Smaller segments can take a fast path, so give it a name that
> reflects that: max_fast_segment_size.
>
> Signed-off-by: Keith Busch <kbusch@kernel.org>

Reviewed-by: Ming Lei <ming.lei@redhat.com>


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

* Re: [PATCHv2] block: rename min_segment_size
  2025-10-20 20:47 [PATCHv2] block: rename min_segment_size Keith Busch
  2025-10-20 23:28 ` Chaitanya Kulkarni
  2025-10-21  1:45 ` Ming Lei
@ 2025-10-21  2:22 ` Martin K. Petersen
  2025-10-22  6:11 ` Christoph Hellwig
  2025-10-22 13:39 ` Jens Axboe
  4 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2025-10-21  2:22 UTC (permalink / raw)
  To: Keith Busch
  Cc: linux-block, axboe, hch, ming.lei, martin.petersen, Keith Busch


Hi Keith!

> Despite its name, the block layer is fine with segments smaller that
> the "min_segment_size" limit. The value is an optimization limit
> indicating the largest segment that can be used without considering
> boundary limits. Smaller segments can take a fast path, so give it a
> name that reflects that: max_fast_segment_size.

How about calling it max_fast_path_segment_size, then? That seems very
descriptive, yet not impossibly long to type. And less confusing than a
"fast segment"...

-- 
Martin K. Petersen

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

* Re: [PATCHv2] block: rename min_segment_size
  2025-10-20 20:47 [PATCHv2] block: rename min_segment_size Keith Busch
                   ` (2 preceding siblings ...)
  2025-10-21  2:22 ` Martin K. Petersen
@ 2025-10-22  6:11 ` Christoph Hellwig
  2025-10-22 13:39 ` Jens Axboe
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-10-22  6:11 UTC (permalink / raw)
  To: Keith Busch
  Cc: linux-block, axboe, hch, ming.lei, martin.petersen, Keith Busch

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

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

* Re: [PATCHv2] block: rename min_segment_size
  2025-10-20 20:47 [PATCHv2] block: rename min_segment_size Keith Busch
                   ` (3 preceding siblings ...)
  2025-10-22  6:11 ` Christoph Hellwig
@ 2025-10-22 13:39 ` Jens Axboe
  4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2025-10-22 13:39 UTC (permalink / raw)
  To: linux-block, Keith Busch; +Cc: hch, ming.lei, martin.petersen, Keith Busch


On Mon, 20 Oct 2025 13:47:15 -0700, Keith Busch wrote:
> Despite its name, the block layer is fine with segments smaller that the
> "min_segment_size" limit. The value is an optimization limit indicating
> the largest segment that can be used without considering boundary
> limits. Smaller segments can take a fast path, so give it a name that
> reflects that: max_fast_segment_size.
> 
> 
> [...]

Applied, thanks!

[1/1] block: rename min_segment_size
      commit: 5c5028ee594ce5f907ca6ad1c32cca6a15098464

Best regards,
-- 
Jens Axboe




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

end of thread, other threads:[~2025-10-22 13:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 20:47 [PATCHv2] block: rename min_segment_size Keith Busch
2025-10-20 23:28 ` Chaitanya Kulkarni
2025-10-21  1:45 ` Ming Lei
2025-10-21  2:22 ` Martin K. Petersen
2025-10-22  6:11 ` Christoph Hellwig
2025-10-22 13:39 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox