From: Bart Van Assche <bvanassche@acm.org>
To: "André Almeida" <andrealmeid@collabora.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: axboe@kernel.dk, kernel@collabora.com, krisman@collabora.com
Subject: Re: [PATCH] blk-mq: remove needless goto from blk_mq_get_driver_tag
Date: Wed, 23 Oct 2019 18:34:10 -0700 [thread overview]
Message-ID: <2a8a99a6-4b39-e459-988a-ba9502919044@acm.org> (raw)
In-Reply-To: <20191022174108.15554-1-andrealmeid@collabora.com>
On 2019-10-22 10:41, André Almeida wrote:
> The only usage of the label "done" is when (rq->tag != -1) at the
> begging of the function. Rather than jumping to label, we can just
> remove this label and execute the code at the "if". Besides that,
> the code that would be executed after the label "done" is the return of
> the logical expression (rq->tag != -1) but since we are already inside
> the if, we now that this is true. Remove the label and replace the goto
> with the proper result of the label.
>
> Signed-off-by: André Almeida <andrealmeid@collabora.com>
> ---
> Hello,
>
> I've used `blktest` to check if this change add any regression. I have
> used `./check block` and I got the same results with and without this
> patch (a bunch of "passed" and three "not run" because of the virtual
> scsi capabilities). Please let me know if there would be a better way to
> test changes at block stack.
>
> This commit was rebase at linux-block/for-5.5/block.
>
> Thanks,
> André
> ---
> block/blk-mq.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 8538dc415499..1e067b78ab97 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -1036,7 +1036,7 @@ bool blk_mq_get_driver_tag(struct request *rq)
> bool shared;
>
> if (rq->tag != -1)
> - goto done;
> + return true;
>
> if (blk_mq_tag_is_reserved(data.hctx->sched_tags, rq->internal_tag))
> data.flags |= BLK_MQ_REQ_RESERVED;
> @@ -1051,7 +1051,6 @@ bool blk_mq_get_driver_tag(struct request *rq)
> data.hctx->tags->rqs[rq->tag] = rq;
> }
>
> -done:
> return rq->tag != -1;
> }
Do we really need code changes like the above? I'm not aware of any text
in the Documentation/ directory that forbids the use of goto statements.
Thanks,
Bart.
next prev parent reply other threads:[~2019-10-24 1:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 17:41 André Almeida
2019-10-24 1:34 ` Bart Van Assche [this message]
2019-10-24 3:32 ` Jens Axboe
2019-10-24 18:10 ` André Almeida
2019-10-25 20:15 ` Jens Axboe
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=2a8a99a6-4b39-e459-988a-ba9502919044@acm.org \
--to=bvanassche@acm.org \
--cc=andrealmeid@collabora.com \
--cc=axboe@kernel.dk \
--cc=kernel@collabora.com \
--cc=krisman@collabora.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®