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

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