linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: rename min_segment_size
@ 2025-08-22 17:10 Keith Busch
  2025-08-23  3:04 ` Ming Lei
  2025-08-25  9:30 ` Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Keith Busch @ 2025-08-22 17:10 UTC (permalink / raw)
  To: axboe, linux-block, ming.lei; +Cc: 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 aligned segment that can be used without considering segment
boundary limits, so give it a name that reflects that.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 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 70d704615be52..863a4a6d3da62 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -307,7 +307,7 @@ int bio_split_rw_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_aligned_segment) {
 			nsegs++;
 			bytes += bv.bv_len;
 		} else {
diff --git a/block/blk-settings.c b/block/blk-settings.c
index d6438e6c276dc..a61d676ff4c49 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -442,12 +442,12 @@ int blk_validate_limits(struct queue_limits *lim)
 			return -EINVAL;
 	}
 
-	/* setup min segment size for building new segment in fast path */
+	/* setup max aligned 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_aligned_segment = 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 46f566f9b1266..ed60d3dcdf93c 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -376,7 +376,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_aligned_segment;
 }
 
 /**
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index fe1797bbec420..b8d4333716e59 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_aligned_segment;
 	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: [PATCH] block: rename min_segment_size
  2025-08-22 17:10 [PATCH] block: rename min_segment_size Keith Busch
@ 2025-08-23  3:04 ` Ming Lei
  2025-08-25  9:30 ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Ming Lei @ 2025-08-23  3:04 UTC (permalink / raw)
  To: Keith Busch; +Cc: axboe, linux-block, Keith Busch

On Fri, Aug 22, 2025 at 10:10:38AM -0700, 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 aligned segment that can be used without considering segment
> boundary limits, so give it a name that reflects that.

Yeah, it is right.

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


Thanks,
Ming


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

* Re: [PATCH] block: rename min_segment_size
  2025-08-22 17:10 [PATCH] block: rename min_segment_size Keith Busch
  2025-08-23  3:04 ` Ming Lei
@ 2025-08-25  9:30 ` Christoph Hellwig
  2025-08-25 19:18   ` Martin K. Petersen
  1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2025-08-25  9:30 UTC (permalink / raw)
  To: Keith Busch; +Cc: axboe, linux-block, ming.lei, Keith Busch

On Fri, Aug 22, 2025 at 10:10:38AM -0700, 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 aligned segment that can be used without considering segment
> boundary limits, so give it a name that reflects that.

But max_aligned_segment also feels wrong for that.  It's not really
the maximum alignmnet, it is the fast path alignment.  Maybe something
like fast_segment_granularity or nosplit_segment_granularity?


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

* Re: [PATCH] block: rename min_segment_size
  2025-08-25  9:30 ` Christoph Hellwig
@ 2025-08-25 19:18   ` Martin K. Petersen
  2025-08-25 19:50     ` Keith Busch
  0 siblings, 1 reply; 6+ messages in thread
From: Martin K. Petersen @ 2025-08-25 19:18 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Keith Busch, axboe, linux-block, ming.lei, Keith Busch


Christoph,

> But max_aligned_segment also feels wrong for that. It's not really the
> maximum alignmnet, it is the fast path alignment. Maybe something like
> fast_segment_granularity or nosplit_segment_granularity?

Maybe just segment_granularity to match the other granularities we have?

-- 
Martin K. Petersen

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

* Re: [PATCH] block: rename min_segment_size
  2025-08-25 19:18   ` Martin K. Petersen
@ 2025-08-25 19:50     ` Keith Busch
  2025-08-26  7:57       ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Keith Busch @ 2025-08-25 19:50 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, Keith Busch, axboe, linux-block, ming.lei

On Mon, Aug 25, 2025 at 03:18:43PM -0400, Martin K. Petersen wrote:
> 
> Christoph,
> 
> > But max_aligned_segment also feels wrong for that. It's not really the
> > maximum alignmnet, it is the fast path alignment. Maybe something like
> > fast_segment_granularity or nosplit_segment_granularity?
> 
> Maybe just segment_granularity to match the other granularities we have?

I'm not sure I like granularity for this limit. That sounds like it
defines segments to be sized to some multiple of that value, but it's
perfectly fine to use smaller segments.

The limit defines the largest aligned segment the block layer can know
for certain won't need to be split. This allows a short cut while
counting segments without checking against any other limits.

  max_aligned_unsplittable_segment_size

That's pretty verbose, but this limit is kind of unique in its purpose.

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

* Re: [PATCH] block: rename min_segment_size
  2025-08-25 19:50     ` Keith Busch
@ 2025-08-26  7:57       ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-08-26  7:57 UTC (permalink / raw)
  To: Keith Busch
  Cc: Martin K. Petersen, Christoph Hellwig, Keith Busch, axboe,
	linux-block, ming.lei

On Mon, Aug 25, 2025 at 01:50:09PM -0600, Keith Busch wrote:
> On Mon, Aug 25, 2025 at 03:18:43PM -0400, Martin K. Petersen wrote:
> > 
> > Christoph,
> > 
> > > But max_aligned_segment also feels wrong for that. It's not really the
> > > maximum alignmnet, it is the fast path alignment. Maybe something like
> > > fast_segment_granularity or nosplit_segment_granularity?
> > 
> > Maybe just segment_granularity to match the other granularities we have?
> 
> I'm not sure I like granularity for this limit. That sounds like it
> defines segments to be sized to some multiple of that value, but it's
> perfectly fine to use smaller segments.

I guess I stuck too much to nvme terminology where those boundaries
are called granularity.  We also do that for the discard granularity.
Maye it should be boundary?


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

end of thread, other threads:[~2025-08-26  7:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 17:10 [PATCH] block: rename min_segment_size Keith Busch
2025-08-23  3:04 ` Ming Lei
2025-08-25  9:30 ` Christoph Hellwig
2025-08-25 19:18   ` Martin K. Petersen
2025-08-25 19:50     ` Keith Busch
2025-08-26  7:57       ` Christoph Hellwig

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).