block: Fix page_is_mergeable() for compound pages
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 17 Aug 2020 19:52:06 +0000 (20:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:27 +0000 (11:29 +0200)
commit700d01d85ebbbb16c14ed5b1d829232c5b5dd3f6
treef3acc5ae22522a68f0ca775026366f73ebf44f9f
parent103942e19ae4454ed07f23323999d6df1fd9e742
block: Fix page_is_mergeable() for compound pages

[ Upstream commit d81665198b83e55a28339d1f3e4890ed8a434556 ]

If we pass in an offset which is larger than PAGE_SIZE, then
page_is_mergeable() thinks it's not mergeable with the previous bio_vec,
leading to a large number of bio_vecs being used.  Use a slightly more
obvious test that the two pages are compatible with each other.

Fixes: 52d52d1c98a9 ("block: only allow contiguous page structs in a bio_vec")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
block/bio.c