From: Chengming Zhou <chengming.zhou@linux.dev>
To: Christoph Hellwig <hch@lst.de>, hare@suse.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 1/4] blk-flush: flush_rq should inherit first_rq's cmd_flags
Date: Mon, 31 Jul 2023 22:02:39 +0800 [thread overview]
Message-ID: <0ee17228-4938-6ab7-3fc4-f83a81cbed8f@linux.dev> (raw)
In-Reply-To: <20230731060957.GA30409@lst.de>
On 2023/7/31 14:09, Christoph Hellwig wrote:
> On Tue, Jul 25, 2023 at 09:00:59PM +0800, chengming.zhou@linux.dev wrote:
>> From: Chengming Zhou <zhouchengming@bytedance.com>
>>
>> The cmd_flags in blk_kick_flush() should inherit the original request's
>> cmd_flags, but the current code looks buggy to me:
>
> Should it? I know the code is kinda trying to do it, but does it really
> make sense? Adding Hannes who originally added this inheritance and
> discussing the details below:
I'm not sure, actually I don't get what the current code is doing...
Hope Hannes could provide some details.
blk_flush_complete_seq(rq) -> blk_kick_flush(rq->cmd_flags)
flush_rq will use the cmd_flags of request which just complete a sequence,
there are three cases:
1. blk_insert_flush(rq): rq is pending, wait for flush
2. flush_end_io(flush_rq): rq flush seq done
3. mq_flush_data_end_io(rq): rq data seq done
Only in the 1st case, the rq is the pending request that wait for flush_rq.
In the 2nd and 3rd cases, the rq has nothing to do with the next flush_rq?
So it's more reasonable for flush_rq to use its pending first_rq's cmd_flags?
>
>> flush_rq->cmd_flags = REQ_OP_FLUSH | REQ_PREFLUSH;
>> - flush_rq->cmd_flags |= (flags & REQ_DRV) | (flags & REQ_FAILFAST_MASK);
>> + flush_rq->cmd_flags |= (first_rq->cmd_flags & REQ_DRV) |
>> + (first_rq->cmd_flags & REQ_FAILFAST_MASK);
>
> Two cases here:
>
> 1) REQ_FAILFAST_MASK: I don't think this is actually set on flush request
> currently, and even if it was applying it to the flush that serves more
> than a single originating command seems wrong to me.
> 2) REQ_DRV is only set by drivers that have seen a bio. For dm this
> is used as REQ_DM_POLL_LIST which should never be set for a flush/fua
> request. For nvme-mpath it is REQ_NVME_MPATH, which is set in the
> bio based driver and used for decision making in the I/O completion
> handler. So I guess this one actually does need to get passed
> through.
>
The commit 84fca1b0c461 ("block: pass failfast and driver-specific flags to
flush requests") says:
If flush requests are being sent to the device we need to inherit the
failfast and driver-specific flags, too, otherwise I/O will fail.
1) REQ_FAILFAST_MASK: agree, shouldn't set to the flush_rq I think?
2) REQ_DRV: I don't get why this flag not set would cause I/O fail?
Thanks!
next prev parent reply other threads:[~2023-07-31 14:07 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 [this message]
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
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=0ee17228-4938-6ab7-3fc4-f83a81cbed8f@linux.dev \
--to=chengming.zhou@linux.dev \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--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
all inboxes | Powered by JetHome®