[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d9792de8-aaea-e848-9108-323e8e66a429@linux.dev>
Date: Tue, 25 Jul 2023 21:15:59 +0800
From: Chengming Zhou <chengming.zhou@...ux.dev>
To: Christoph Hellwig <hch@....de>
Cc: axboe@...nel.dk, ming.lei@...hat.com, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, zhouchengming@...edance.com
Subject: Re: [PATCH 2/2] blk-flush: don't need to end rq twice for non
post-flush requests
On 2023/7/10 21:33, Christoph Hellwig wrote:
> On Mon, Jul 10, 2023 at 02:47:05PM +0800, chengming.zhou@...ux.dev wrote:
>> From: Chengming Zhou <zhouchengming@...edance.com>
>>
>> Now we unconditionally blk_rq_init_flush() to replace rq->end_io to
>> make rq return twice back to the flush state machine for post-flush.
>>
>> Obviously, non post-flush requests don't need it, they don't need to
>> end request twice, so they don't need to replace rq->end_io callback.
>> And the same for requests with the FUA bit on hardware with FUA support.
>>
>> So we move blk_rq_init_flush() to REQ_FSEQ_DATA stage and only replace
>> rq->end_io if it needs post-flush. Otherwise, it can end like normal
>> request and doesn't need to return back to the flush state machine.
>
> I really like the idea behind this optimization, but I kinda hate
> adding more magic to the already way too magic flush sequence.
Yes, agree.
>
> I wonder if a better idea would be to kill the flush sequence entirely,
> and just split the flush_queue into a preflush and a postflush queue.
> This would remove a field from struct request and lead to more readable
> code as well.
I have thought about this for some time, it seems feasible. So I implement it
today and test it using blktests, it works.
I will send the patchset soon.
Thanks.
Powered by blists - more mailing lists