block: allow max_discard_segments to be stacked
authorMike Snitzer <snitzer@redhat.com>
Fri, 20 Jul 2018 18:57:38 +0000 (14:57 -0400)
committerJens Axboe <axboe@kernel.dk>
Tue, 24 Jul 2018 20:46:39 +0000 (14:46 -0600)
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")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-settings.c

index 053de87d1fda6d5d7135aff94ddee23e421e2614..ffd459969689df0821bf377d1c433f039d502de1 100644 (file)
@@ -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;