All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Bob Liu <bob.liu@oracle.com>
Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>,
	linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	Damien Le Moal <damien.lemoal@wdc.com>
Subject: Re: [PATCH] block: streamline merge possibility checks
Date: Wed, 8 Jan 2020 05:44:37 -0800	[thread overview]
Message-ID: <20200108134437.GF4455@infradead.org> (raw)
In-Reply-To: <df9c90e7-9aa7-4f77-7161-1bc38de6f8ba@oracle.com>

On Fri, Dec 20, 2019 at 02:50:05PM +0800, Bob Liu wrote:
> On 12/19/19 3:41 AM, Dmitry Fomichev wrote:
> > Checks for data direction in attempt_merge() and blk_rq_merge_ok()
> 
> Speak about these two functions, do you think attempt_merge() can be built on blk_rq_merge_ok()?
> Things like..
> diff --git a/block/blk-merge.c b/block/blk-merge.c
> index 48e6725..2a00c4c 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -724,28 +724,7 @@ static enum elv_merge blk_try_req_merge(struct request *req,
>  static struct request *attempt_merge(struct request_queue *q,
>                                      struct request *req, struct request *next)
>  {
> -       if (!rq_mergeable(req) || !rq_mergeable(next))
> -               return NULL;
> -
> -       if (req_op(req) != req_op(next))
> -               return NULL;
> -
> -       if (rq_data_dir(req) != rq_data_dir(next)
> -           || req->rq_disk != next->rq_disk)
> -               return NULL;
> -
> -       if (req_op(req) == REQ_OP_WRITE_SAME &&
> -           !blk_write_same_mergeable(req->bio, next->bio))
> -               return NULL;
> -
> -       /*
> -        * Don't allow merge of different write hints, or for a hint with
> -        * non-hint IO.
> -        */
> -       if (req->write_hint != next->write_hint)
> -               return NULL;
> -
> -       if (req->ioprio != next->ioprio)
> +       if (!blk_rq_merge_ok(req, next->bio))
>                 return NULL;

This looks sensible, but we might have to be a bit more careful.
rq_mergeable checks for RQF_NOMERGE_FLAGS and various ops, while
bio_mergeable is missing those.  So I think you need to go through
carefully if we need to keep any extra checks, but otherwise using
blk_rq_merge_ok looks sensible.

  reply	other threads:[~2020-01-08 13:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18 19:41 [PATCH] block: streamline merge possibility checks Dmitry Fomichev
2019-12-19  8:56 ` Bob Liu
2019-12-19 10:05 ` Damien Le Moal
2019-12-20  6:50 ` Bob Liu
2020-01-08 13:44   ` Christoph Hellwig [this message]
2020-01-08 22:02     ` Dmitry Fomichev
2020-01-09  0:56       ` Bob Liu
2020-01-08 13:41 ` Christoph Hellwig

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=20200108134437.GF4455@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=bob.liu@oracle.com \
    --cc=damien.lemoal@wdc.com \
    --cc=dmitry.fomichev@wdc.com \
    --cc=linux-block@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.