All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: "jianchao.wang" <jianchao.w.wang@oracle.com>,
	Ming Lei <ming.lei@redhat.com>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] blk-mq: put the driver tag of nxt rq before first one is requeued
Date: Tue, 12 Sep 2017 21:54:06 -0600	[thread overview]
Message-ID: <17775b50-1bf2-26d2-c371-2eb349be85d6@kernel.dk> (raw)
In-Reply-To: <aebfc622-6d7d-0d07-5a13-8dae06a49bb7@oracle.com>

On 09/12/2017 09:39 PM, jianchao.wang wrote:
>> Exactly, and especially the readability is the key element here. It's
>> just not worth it to try and be too clever, especially not for
>> something like this. When you read the above, you immediately know
>> what the code does without needing a comment. That's not true for the
>> other construct.  You both have to read other parts of the function
>> to figure out what it does, AND read the entire function to ensure it
>> always does the right thing. Fragile.
> 
> Thanks for your comments , jens and ming. I'm really appreciative of
> that.  About the fragility, do you mean the possibility that may
> release the tag of the next rq which has a driver tag itself (maybe a
> flush) ?

I mean that if you do:

if (!list_empty(list))
	blk_mq_put_driver_tag(nxt);

it's fragile code in the sense that changes elsewhere in the function
are harder to validate and/or can impact the functionality of that
simple if and tag put.

The actual release must always be safe, of course.

-- 
Jens Axboe

  reply	other threads:[~2017-09-13  3:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12 17:14 [PATCH] blk-mq: put the driver tag of nxt rq before first one is requeued Jianchao Wang
2017-09-12 10:23 ` Ming Lei
2017-09-13  1:01   ` jianchao.wang
2017-09-13  1:24     ` Ming Lei
2017-09-13  1:39       ` jianchao.wang
2017-09-13  1:52         ` Ming Lei
2017-09-13  2:23         ` Jens Axboe
2017-09-13  2:42           ` jianchao.wang
2017-09-13  2:45             ` Jens Axboe
2017-09-13  3:39               ` jianchao.wang
2017-09-13  3:54                 ` Jens Axboe [this message]
2017-09-13  3:59                   ` jianchao.wang
2017-09-13  3:50               ` Ming Lei

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=17775b50-1bf2-26d2-c371-2eb349be85d6@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=jianchao.w.wang@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /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.