Skip to contentSkip to conversation

block: rename min_segment_size

PATCH Applied Keith Busch 6 participants 6 messages Oct 20, 2025 – Oct 22, 2025 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 block: rename min_segment_size

From: Keith Busch <[email protected]>

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.

---
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(-)
block/blk-merge.c +1 -1
index 37864c5d287ef..c47d18587a0b6 100644
@@ -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 {
block/blk-settings.c +2 -2
index 54cffaae4df49..345b6a271cc35 100644
@@ -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
block/blk.h +1 -1
index 170794632135d..32a10024efbaa 100644
@@ -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;
 }
 
 /**
include/linux/blkdev.h +1 -1
index 70b671a9a7f77..99be263b31ab5 100644
@@ -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;
Signature · 1 line
2.47.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Keith Busch

From: Keith Busch<[email protected]>

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.

Looks good.

-ck

Reviewed-by on v2 1/1
#2 lore raw
In reply to Keith Busch
Quoted 10 lines · Keith Busch

From: Keith Busch <[email protected]>

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.

#3 lore raw
In reply to Keith Busch

Hi Keith!

Quoted 5 lines

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

Signature · 1 line
Martin K. Petersen
maintainer Applied
#5 lore raw
In reply to Keith Busch
Quoted 8 lines · Keith Busch

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,

Signature · 1 line
Jens Axboe