Commit 030f2ad6 authored by Mike Snitzer's avatar Mike Snitzer Committed by Greg Kroah-Hartman

block: allow max_discard_segments to be stacked

[ Upstream commit 42c9cdfe ]

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.


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


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

Fixes: 1e739730 ("block: optionally merge discontiguous discard bios into a single request")
Reviewed-by: default avatarChristoph Hellwig <>
Signed-off-by: default avatarMike Snitzer <>
Signed-off-by: default avatarJens Axboe <>
Signed-off-by: default avatarSasha Levin <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 394df591
......@@ -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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment