block: allow max_discard_segments to be stacked
diff mbox

Message ID 20180720185738.11646-1-snitzer@redhat.com
State New
Headers show

Commit Message

Mike Snitzer July 20, 2018, 6:57 p.m. UTC
Set max_discard_segments to USHRT_MAX in blk_set_stacking_limits() so
that blk_stack_limits() can stack up this limit for stacked devices.

before:

$ cat /sys/block/nvme0n1/queue/max_discard_segments
256
$ cat /sys/block/dm-0/queue/max_discard_segments
1

after:

$ cat /sys/block/nvme0n1/queue/max_discard_segments
256
$ cat /sys/block/dm-0/queue/max_discard_segments
256

Fixes: 1e739730c5b9e ("block: optionally merge discontiguous discard bios into a single request")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
 block/blk-settings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig July 23, 2018, 7:34 a.m. UTC | #1
Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Jens Axboe July 24, 2018, 8:47 p.m. UTC | #2
On 7/20/18 11:57 AM, Mike Snitzer wrote:
> Set max_discard_segments to USHRT_MAX in blk_set_stacking_limits() so
> that blk_stack_limits() can stack up this limit for stacked devices.
> 
> before:
> 
> $ cat /sys/block/nvme0n1/queue/max_discard_segments
> 256
> $ cat /sys/block/dm-0/queue/max_discard_segments
> 1
> 
> after:
> 
> $ cat /sys/block/nvme0n1/queue/max_discard_segments
> 256
> $ cat /sys/block/dm-0/queue/max_discard_segments
> 256

Applied, thanks Mike.

Patch
diff mbox

diff --git a/block/blk-settings.c b/block/blk-settings.c
index d1de71124656..24fff4a3d08a 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -128,7 +128,7 @@  void blk_set_stacking_limits(struct queue_limits *lim)
 
 	/* Inherit limits from component devices */
 	lim->max_segments = USHRT_MAX;
-	lim->max_discard_segments = 1;
+	lim->max_discard_segments = USHRT_MAX;
 	lim->max_hw_sectors = UINT_MAX;
 	lim->max_segment_size = UINT_MAX;
 	lim->max_sectors = UINT_MAX;