From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>
Cc: Bart Van Assche <bvanassche@acm.org>, linux-block@vger.kernel.org
Subject: Re: [PATCH 1/7] blk-mq: factor out a blk_rq_init_flush helper
Date: Mon, 17 Apr 2023 15:22:21 +0900 [thread overview]
Message-ID: <3947a26e-ceb6-4117-7b45-fd7578710120@kernel.org> (raw)
In-Reply-To: <20230416200930.29542-2-hch@lst.de>
On 4/17/23 05:09, Christoph Hellwig wrote:
> Factor out a helper from blk_insert_flush that initializes the flush
> machine related fields in struct request.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> block/blk-flush.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/block/blk-flush.c b/block/blk-flush.c
> index 04698ed9bcd4a9..422a6d5446d1c5 100644
> --- a/block/blk-flush.c
> +++ b/block/blk-flush.c
> @@ -376,6 +376,15 @@ static enum rq_end_io_ret mq_flush_data_end_io(struct request *rq,
> return RQ_END_IO_NONE;
> }
>
> +static void blk_rq_init_flush(struct request *rq)
> +{
> + memset(&rq->flush, 0, sizeof(rq->flush));
> + INIT_LIST_HEAD(&rq->flush.list);
> + rq->rq_flags |= RQF_FLUSH_SEQ;
> + rq->flush.saved_end_io = rq->end_io; /* Usually NULL */
> + rq->end_io = mq_flush_data_end_io;
> +}
struct flush is:
struct {
unsigned int seq;
struct list_head list;
rq_end_io_fn *saved_end_io;
} flush;
So given that list and saved_end_io are initialized here, we could remove the
memset() by initializing seq "manually":
+static void blk_rq_init_flush(struct request *rq)
+{
+ rq->flush.seq = 0;
+ INIT_LIST_HEAD(&rq->flush.list);
+ rq->flush.saved_end_io = rq->end_io; /* Usually NULL */
+ rq->rq_flags |= RQF_FLUSH_SEQ;
+ rq->end_io = mq_flush_data_end_io;
+}
No ?
Otherwise, look good to me.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
> +
> /**
> * blk_insert_flush - insert a new PREFLUSH/FUA request
> * @rq: request to insert
> @@ -437,13 +446,7 @@ void blk_insert_flush(struct request *rq)
> * @rq should go through flush machinery. Mark it part of flush
> * sequence and submit for further processing.
> */
> - memset(&rq->flush, 0, sizeof(rq->flush));
> - INIT_LIST_HEAD(&rq->flush.list);
> - rq->rq_flags |= RQF_FLUSH_SEQ;
> - rq->flush.saved_end_io = rq->end_io; /* Usually NULL */
> -
> - rq->end_io = mq_flush_data_end_io;
> -
> + blk_rq_init_flush(rq);
> spin_lock_irq(&fq->mq_flush_lock);
> blk_flush_complete_seq(rq, fq, REQ_FSEQ_ACTIONS & ~policy, 0);
> spin_unlock_irq(&fq->mq_flush_lock);
next prev parent reply other threads:[~2023-04-17 6:22 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-16 20:09 RFC: less special casing for flush requests Christoph Hellwig
2023-04-16 20:09 ` [PATCH 1/7] blk-mq: factor out a blk_rq_init_flush helper Christoph Hellwig
2023-04-17 6:22 ` Damien Le Moal [this message]
2023-04-17 6:24 ` Christoph Hellwig
2023-04-16 20:09 ` [PATCH 2/7] blk-mq: reflow blk_insert_flush Christoph Hellwig
2023-04-17 6:29 ` Damien Le Moal
2023-04-16 20:09 ` [PATCH 3/7] blk-mq: defer to the normal submission path for non-flush flush commands Christoph Hellwig
2023-04-17 6:31 ` Damien Le Moal
2023-04-17 19:48 ` Bart Van Assche
2023-04-16 20:09 ` [PATCH 4/7] blk-mq: also use the I/O scheduler for requests from the flush state machine Christoph Hellwig
2023-04-17 6:34 ` Damien Le Moal
2023-04-16 20:09 ` [PATCH 5/7] blk-mq: defer to the normal submission path for post-flush requests Christoph Hellwig
2023-04-17 6:36 ` Damien Le Moal
2023-04-17 6:39 ` Christoph Hellwig
2023-04-16 20:09 ` [PATCH 6/7] blk-mq: do not do head insertations post-pre-flush commands Christoph Hellwig
2023-04-17 6:38 ` Damien Le Moal
2023-04-17 19:51 ` Bart Van Assche
2023-04-16 20:09 ` [PATCH 7/7] blk-mq: don't use the requeue list to queue flush commands Christoph Hellwig
2023-04-16 21:01 ` Bart Van Assche
2023-04-17 4:26 ` Christoph Hellwig
2023-04-17 6:46 ` Damien Le Moal
2023-04-19 12:37 ` kernel test robot
2023-04-19 17:34 ` kernel test robot
2023-05-16 0:08 ` RFC: less special casing for flush requests Bart Van Assche
2023-05-16 4:03 ` Christoph Hellwig
2023-05-18 5:57 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2023-05-19 4:40 less special casing for flush requests v2 Christoph Hellwig
2023-05-19 4:40 ` [PATCH 1/7] blk-mq: factor out a blk_rq_init_flush helper Christoph Hellwig
2023-05-19 18:54 ` Bart Van Assche
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=3947a26e-ceb6-4117-7b45-fd7578710120@kernel.org \
--to=dlemoal@kernel.org \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=hch@lst.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).