mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@canonical.com>
To: Jens Axboe <axboe@kernel.dk>, linux-kernel@vger.kernel.org
Cc: linux-block@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Sagi Grimberg <sagig@dev.mellanox.co.il>,
	Kent Overstreet <kent.overstreet@gmail.com>,
	Keith Busch <keith.busch@intel.com>,
	Elliott Robert <elliott@hpe.com>
Subject: [PATCH v2 0/4] block: fix bio_will_gap()
Date: Fri, 26 Feb 2016 23:40:49 +0800	[thread overview]
Message-ID: <1456501253-7269-1-git-send-email-ming.lei@canonical.com> (raw)

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 has confirmed
the fix.

Thanks for Sagi and Christoph's review.

V2:
	- remove unnecessary comment
	- add reviewed-by

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    | 37 +++++++++++++++++++++++++++++++++++++
 include/linux/blkdev.h | 23 +++++++++++++++++------
 3 files changed, 56 insertions(+), 12 deletions(-)


Thanks,
Ming

             reply	other threads:[~2016-02-26 15:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26 15:40 Ming Lei [this message]
2016-02-26 15:40 ` [PATCH v2 1/4] block: bio: introduce helpers to get the 1st and last bvec Ming Lei
2016-02-26 15:40 ` [PATCH v2 2/4] block: check virt boundary in bio_will_gap() Ming Lei
2016-02-26 15:40 ` [PATCH v2 3/4] block: get the 1st and last bvec via helpers Ming Lei
2016-02-26 15:40 ` [PATCH v2 4/4] block: merge: " Ming Lei
2016-02-28  9:57 ` [PATCH v2 0/4] block: fix bio_will_gap() Sagi Grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456501253-7269-1-git-send-email-ming.lei@canonical.com \
    --to=ming.lei@canonical.com \
    --cc=axboe@kernel.dk \
    --cc=elliott@hpe.com \
    --cc=hch@infradead.org \
    --cc=keith.busch@intel.com \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sagig@dev.mellanox.co.il \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome