Skip to contentSkip to conversation

block: set default max segment size in case of virt_boundary

PATCH Applied Ming Lei 2 participants 4 messages Apr 24, 2024 – May 7, 2024 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block: set default max segment size in case of virt_boundary

For devices with virt_boundary limit, the driver may provide zero max segment size, we have to set it as UINT_MAX at default. Otherwise, it may cause warning in driver when handling sglist.

Fix it by setting default max segment size as UINT_MAX.

Cc Christoph Hellwig <[email protected]>
Cc Mike Snitzer <[email protected]>
Fixes b561ea56a264 ("block: allow device to have both virt_boundary_mask and max segment size")
---
 block/blk-settings.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
block/blk-settings.c +4 -1
index d2731843f2fc..9d6033e01f2e 100644
@@ -188,7 +188,10 @@ static int blk_validate_limits(struct queue_limits *lim)
 	 * bvec and lower layer bio splitting is supposed to handle the two
 	 * correctly.
 	 */
-	if (!lim->virt_boundary_mask) {
+	if (lim->virt_boundary_mask) {
+		if (!lim->max_segment_size)
+			lim->max_segment_size = UINT_MAX;
+	} else {
 		/*
 		 * The maximum segment size has an odd historic 64k default that
 		 * drivers probably should override.  Just like the I/O size we
Signature · 1 line
2.42.0
author
#1 lore raw
Quoted 23 lines · Ming Lei

For devices with virt_boundary limit, the driver may provide zero max segment size, we have to set it as UINT_MAX at default. Otherwise, it may cause warning in driver when handling sglist.

Fix it by setting default max segment size as UINT_MAX.

Cc Christoph Hellwig <[email protected]>
Cc Mike Snitzer <[email protected]>
Fixes b561ea56a264 ("block: allow device to have both virt_boundary_mask and max segment size")
---
 block/blk-settings.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
block/blk-settings.c +0 -0
index d2731843f2fc..9d6033e01f2e 100644
@@ -188,7 +188,10 @@ static int blk_validate_limits(struct queue_limits *lim)
 	 * bvec and lower layer bio splitting is supposed to handle the two

block/blk-settings.c static int blk_validate_limits(struct queue_limits *lim) · line 197

Quoted 10 lines
block/blk-settings.c +4 -1
 	 * correctly.
 	 */
-	if (!lim->virt_boundary_mask) {
+	if (lim->virt_boundary_mask) {
+		if (!lim->max_segment_size)
+			lim->max_segment_size = UINT_MAX;
+	} else {
 		/*
 		 * The maximum segment size has an odd historic 64k default that
 		 * drivers probably should override.  Just like the I/O size we

Hello Jens,

Looks this fix is missed, can you make it to v6.9?

Thanks,
Ming

maintainer
#2 lore raw
Quoted 37 lines · Ming Lei
Quoted 23 lines · Ming Lei

For devices with virt_boundary limit, the driver may provide zero max segment size, we have to set it as UINT_MAX at default. Otherwise, it may cause warning in driver when handling sglist.

Fix it by setting default max segment size as UINT_MAX.

Cc Christoph Hellwig <[email protected]>
Cc Mike Snitzer <[email protected]>
Fixes b561ea56a264 ("block: allow device to have both virt_boundary_mask and max segment size")
---
 block/blk-settings.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
block/blk-settings.c +0 -0
index d2731843f2fc..9d6033e01f2e 100644
@@ -188,7 +188,10 @@ static int blk_validate_limits(struct queue_limits *lim)
 	 * bvec and lower layer bio splitting is supposed to handle the two

block/blk-settings.c static int blk_validate_limits(struct queue_limits *lim) · line 197

Quoted 10 lines
block/blk-settings.c +4 -1
 	 * correctly.
 	 */
-	if (!lim->virt_boundary_mask) {
+	if (lim->virt_boundary_mask) {
+		if (!lim->max_segment_size)
+			lim->max_segment_size = UINT_MAX;
+	} else {
 		/*
 		 * The maximum segment size has an odd historic 64k default that
 		 * drivers probably should override.  Just like the I/O size we

Hello Jens,

Quoted 1 line

Looks this fix is missed, can you make it to v6.9?

Oops yes, thanks for the reminder.

Signature · 1 line
Jens Axboe
maintainer Applied
#3 lore raw
In reply to Ming Lei
Quoted 8 lines · Ming Lei

For devices with virt_boundary limit, the driver may provide zero max segment size, we have to set it as UINT_MAX at default. Otherwise, it may cause warning in driver when handling sglist.

Fix it by setting default max segment size as UINT_MAX.

[...]

Applied, thanks!

[1/1] block: set default max segment size in case of virt_boundary

      commit: ffd379c13fc0ab2c7c4313e7a01c71d9d202cc88

Best regards,

Signature · 1 line
Jens Axboe