From: Christoph Hellwig <hch@infradead.org>
To: Ye Bin <yebin@huaweicloud.com>
Cc: axboe@kernel.dk, rostedt@goodmis.org, mhiramat@kernel.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] blktrace: introduce 'blk_trace_{start,stop}' helper
Date: Tue, 18 Oct 2022 08:52:31 -0700 [thread overview]
Message-ID: <Y07Lv1BVm0+mRDS9@infradead.org> (raw)
In-Reply-To: <20221018145135.932240-2-yebin@huaweicloud.com>
> +static int blk_trace_start(struct blk_trace *bt)
> +{
> + /*
> + * For starting a trace, we can transition from a setup or stopped
> + * trace.
> + */
That's pretty obvious from the check, isn't it?
> + if (bt->trace_state == Blktrace_setup ||
> + bt->trace_state == Blktrace_stopped) {
I'd invert the check and return early from the function for the error
case so that the real starting code is in the main path.
> +static int blk_trace_stop(struct blk_trace *bt)
> +{
> + /*
> + * For stopping a trace, the state must be running
> + */
> + if (bt->trace_state == Blktrace_running) {
The same two comments apply here as well.
next prev parent reply other threads:[~2022-10-18 15:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-18 14:51 [PATCH v2 0/3] fix possible memleak in '__blk_trace_remove' Ye Bin
2022-10-18 14:51 ` [PATCH v2 1/3] blktrace: introduce 'blk_trace_{start,stop}' helper Ye Bin
2022-10-18 15:52 ` Christoph Hellwig [this message]
2022-10-18 14:51 ` [PATCH v2 2/3] blktrace: fix possible memleak in '__blk_trace_remove' Ye Bin
2022-10-18 15:52 ` Christoph Hellwig
2022-10-18 14:51 ` [PATCH v2 3/3] blktrace: remove unnessary stop block trace in 'blk_trace_shutdown' Ye Bin
2022-10-18 15:53 ` 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=Y07Lv1BVm0+mRDS9@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=yebin@huaweicloud.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox