public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/4] block: fix bio_will_gap()
@ 2016-02-19  3:20 Ming Lei
  2016-02-19  3:20 ` [PATCH v1 1/4] block: bio: introduce helpers to get the 1st and last bvec Ming Lei
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Ming Lei @ 2016-02-19  3:20 UTC (permalink / raw)
  To: Jens Axboe, linux-kernel
  Cc: linux-block, Christoph Hellwig, Sagi Grimberg, Kent Overstreet,
	Keith Busch, Elliott Robert

Hi Guys,

The bio passed to bio_will_gap() may be fast cloned from upper
layer(dm, md, bcache, fs, ...), or from bio splitting in block
core. Unfortunately bio_will_gap() just figures out the last
bvec via 'bi_io_vec[prev->bi_vcnt - 1]' directly, and this way
is obviously wrong in case of fast-cloned bio.

It is observed that lots of BIOs are still merged even if
the virt boundary limit is violated by the merge, and the issue
was reported from Sagi Grimberg.
    
This patch introduces two helpers for getting the first and last
bvec of one bio and applys them to fix the issue. Sagi tested
the last patchset and confirmed the fix.

V1:
	- get bvec directly for non-cloned bio
	- implement bio_get_last_bvec() with single bio_advance_iter(),
	and avoid to use bio_for_each_segment() which looks a bit inefficient
	- avoid to double check queue_virt_boundary() in bio_will_gap()


 block/blk-merge.c      |  8 ++------
 include/linux/bio.h    | 41 +++++++++++++++++++++++++++++++++++++++++
 include/linux/blkdev.h | 21 ++++++++++++++++-----
 3 files changed, 59 insertions(+), 11 deletions(-)

Thanks,
Ming

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-02-22  9:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-19  3:20 [PATCH v1 0/4] block: fix bio_will_gap() Ming Lei
2016-02-19  3:20 ` [PATCH v1 1/4] block: bio: introduce helpers to get the 1st and last bvec Ming Lei
2016-02-21  9:38   ` Sagi Grimberg
2016-02-22  8:59   ` Christoph Hellwig
2016-02-19  3:20 ` [PATCH v1 2/4] block: check virt boundary in bio_will_gap() Ming Lei
2016-02-21  9:39   ` Sagi Grimberg
2016-02-22  9:00   ` Christoph Hellwig
2016-02-19  3:20 ` [PATCH v1 3/4] block: get the 1st and last bvec via helpers Ming Lei
2016-02-21  9:39   ` Sagi Grimberg
2016-02-22  9:01   ` Christoph Hellwig
2016-02-19  3:20 ` [PATCH v1 4/4] block: merge: " Ming Lei
2016-02-21  9:39   ` Sagi Grimberg
2016-02-22  9:01   ` Christoph Hellwig
2016-02-21  9:41 ` [PATCH v1 0/4] block: fix bio_will_gap() Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox