summaryrefslogtreecommitdiffstats
path: root/block/blk-mq.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-02-08 14:46:49 +0100
committerJens Axboe <axboe@fb.com>2017-02-08 21:43:08 +0100
commit1e739730c5b9ea80a2f25e9cf6e1025d47e3d8ed (patch)
tree4f48ed6c92153fb9941185182e918232eb3472f4 /block/blk-mq.c
parentblock: enumify ELEVATOR_*_MERGE (diff)
downloadlinux-1e739730c5b9ea80a2f25e9cf6e1025d47e3d8ed.tar.xz
linux-1e739730c5b9ea80a2f25e9cf6e1025d47e3d8ed.zip
block: optionally merge discontiguous discard bios into a single request
Add a new merge strategy that merges discard bios into a request until the maximum number of discard ranges (or the maximum discard size) is reached from the plug merging code. I/O scheduler merging is not wired up yet but might also be useful, although not for fast devices like NVMe which are the only user for now. Note that for now we don't support limiting the size of each discard range, but if needed that can be added later. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-mq.c')
-rw-r--r--block/blk-mq.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index dd9722df4afe..7412191aee57 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -780,6 +780,9 @@ static bool blk_mq_attempt_merge(struct request_queue *q,
if (blk_mq_sched_allow_merge(q, rq, bio))
merged = bio_attempt_front_merge(q, rq, bio);
break;
+ case ELEVATOR_DISCARD_MERGE:
+ merged = bio_attempt_discard_merge(q, rq, bio);
+ break;
default:
continue;
}