Skip to contentSkip to conversation

block: properly stack underlying max_segment_size to DM device

PATCH Applied Mike Snitzer 2 participants 2 messages Oct 18, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: properly stack underlying max_segment_size to DM device

Without this patch all DM devices will default to BLK_MAX_SEGMENT_SIZE (65536) even if the underlying device(s) have a larger value -- this is due to blk_stack_limits() using min_not_zero() when stacking the max_segment_size limit.

# cat /sys/block/sda/queue/max_segment_size
1073741824
# cat /sys/block/dm-0/queue/max_segment_size
before patch:
65536

after patch:
1073741824

---
 block/blk-settings.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
block/blk-settings.c +1 -0
index c50ecf0..29f28bb 100644
@@ -143,6 +143,7 @@ void blk_set_stacking_limits(struct queue_limits *lim)
 	/* Inherit limits from component devices */
 	lim->discard_zeroes_data = 1;
 	lim->max_segments = USHRT_MAX;
+	lim->max_segment_size = UINT_MAX;
 	lim->max_hw_sectors = UINT_MAX;
 	lim->max_sectors = UINT_MAX;
 	lim->max_write_same_sectors = UINT_MAX;
Signature · 1 line
1.7.4.4
maintainer Applied
#1 lore raw
Quoted 27 lines · Mike Snitzer

Without this patch all DM devices will default to BLK_MAX_SEGMENT_SIZE (65536) even if the underlying device(s) have a larger value -- this is due to blk_stack_limits() using min_not_zero() when stacking the max_segment_size limit.

# cat /sys/block/sda/queue/max_segment_size
1073741824
# cat /sys/block/dm-0/queue/max_segment_size
before patch:
65536

after patch:
1073741824

---
 block/blk-settings.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
block/blk-settings.c +0 -0
index c50ecf0..29f28bb 100644

block/blk-settings.c void blk_set_stacking_limits(struct queue_limits *lim) · line 149

Quoted 7 lines
block/blk-settings.c +1 -0
@@ -143,6 +143,7 @@ void blk_set_stacking_limits(struct queue_limits *lim)
 	/* Inherit limits from component devices */
 	lim->discard_zeroes_data = 1;
 	lim->max_segments = USHRT_MAX;
+	lim->max_segment_size = UINT_MAX;
 	lim->max_hw_sectors = UINT_MAX;
 	lim->max_sectors = UINT_MAX;
 	lim->max_write_same_sectors = UINT_MAX;

Thanks, applied for 3.13.

Signature · 1 line
Jens Axboe