From: Chengming Zhou <chengming.zhou@linux.dev>
To: Christoph Hellwig <hch@lst.de>
Cc: axboe@kernel.dk, ming.lei@redhat.com,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
zhouchengming@bytedance.com
Subject: Re: [PATCH v2 2/4] blk-flush: split queues for preflush and postflush requests
Date: Mon, 31 Jul 2023 22:15:46 +0800 [thread overview]
Message-ID: <259badcd-fa15-8194-9e2c-d8fc2e1593bd@linux.dev> (raw)
In-Reply-To: <20230731061521.GB30409@lst.de>
On 2023/7/31 14:15, Christoph Hellwig wrote:
>> - list_for_each_entry_safe(rq, n, running, queuelist) {
>> + list_for_each_entry_safe(rq, n, preflush_running, queuelist) {
>> + unsigned int seq = blk_flush_cur_seq(rq);
>> +
>> + BUG_ON(seq != REQ_FSEQ_PREFLUSH && seq != REQ_FSEQ_POSTFLUSH);
>> + blk_flush_complete_seq(rq, fq, seq, error);
>> + }
>> +
>> + list_for_each_entry_safe(rq, n, postflush_running, queuelist) {
>> unsigned int seq = blk_flush_cur_seq(rq);
>>
>> BUG_ON(seq != REQ_FSEQ_PREFLUSH && seq != REQ_FSEQ_POSTFLUSH);
>
> Shouldn't the BUG_ON be split into one that only checks for PREFLUSH and
> one only for POSTFLUSH?
Ah yes, will fix it.
>
>> + if (fq->flush_pending_idx != fq->flush_running_idx)
>> + return;
>> +
>> + if (!list_empty(preflush_pending))
>> + first_rq = list_first_entry(preflush_pending, struct request, queuelist);
>> + else if (!list_empty(postflush_pending))
>> + first_rq = list_first_entry(postflush_pending, struct request, queuelist);
>> + else
>> return;
>
> Hmm, I don't think both lists can be empty here?
Yes if check fq->flush_pending_since != 0 before.
>
> I'd simplify this and avoid the overly long lines as:
>
> first_rq = list_first_entry_or_null(preflush_pending, struct request,
> queuelist);
> if (!first_rq)
> first_rq = list_first_entry_or_null(postflush_pending,
> struct request, queuelist);
>
This is better, will change it.
Thanks.
next prev parent reply other threads:[~2023-07-31 14:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 13:00 [PATCH v2 0/4] blk-flush: optimize non-postflush requests chengming.zhou
2023-07-25 13:00 ` [PATCH v2 1/4] blk-flush: flush_rq should inherit first_rq's cmd_flags chengming.zhou
2023-07-31 6:09 ` Christoph Hellwig
2023-07-31 14:02 ` Chengming Zhou
2023-07-31 14:09 ` Christoph Hellwig
2023-07-31 16:28 ` Hannes Reinecke
2023-08-01 11:04 ` Christoph Hellwig
2023-08-01 11:06 ` Christoph Hellwig
2023-08-03 15:35 ` Chengming Zhou
2023-07-25 13:01 ` [PATCH v2 2/4] blk-flush: split queues for preflush and postflush requests chengming.zhou
2023-07-31 6:15 ` Christoph Hellwig
2023-07-31 14:15 ` Chengming Zhou [this message]
2023-07-25 13:01 ` [PATCH v2 3/4] blk-flush: kill the flush state machine chengming.zhou
2023-07-31 6:19 ` Christoph Hellwig
2023-07-31 14:27 ` Chengming Zhou
2023-07-25 13:01 ` [PATCH v2 4/4] blk-flush: don't need to end rq twice for non postflush chengming.zhou
2023-07-31 6:20 ` Christoph Hellwig
2023-08-10 14:25 ` kernel test robot
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=259badcd-fa15-8194-9e2c-d8fc2e1593bd@linux.dev \
--to=chengming.zhou@linux.dev \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=zhouchengming@bytedance.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;
as well as URLs for NNTP newsgroup(s).