]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
block: fix the DISCARD request merge
authorJianchao Wang <jianchao.w.wang@oracle.com>
Sat, 27 Oct 2018 11:52:14 +0000 (19:52 +0800)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:20:56 +0000 (14:20 -0300)
commit9fa72f250436aadfae7019afb10b8b2596fd73b3
treeb0b2013c7ad6e1183299dde659656f331cf19820
parentc63979ebb79aa659dd9e035a89b45a81479adabf
block: fix the DISCARD request merge

BugLink: https://bugs.launchpad.net/bugs/1854975
[ Upstream commit 69840466086d2248898020a08dda52732686c4e6 ]

There are two cases when handle DISCARD merge.
If max_discard_segments == 1, the bios/requests need to be contiguous
to merge. If max_discard_segments > 1, it takes every bio as a range
and different range needn't to be contiguous.

But now, attempt_merge screws this up. It always consider contiguity
for DISCARD for the case max_discard_segments > 1 and cannot merge
contiguous DISCARD for the case max_discard_segments == 1, because
rq_attempt_discard_merge always returns false in this case.
This patch fixes both of the two cases above.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
block/blk-merge.c