Skip to content

blk-flush: optimize non-postflush requests

[email protected] linux-block lkml oe-lkp 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest4 patches 12 repliesIn review

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4blk-flush: flush_rq should inherit first_rq's cmd_flagsblock/blk-flush.c+5 -87 replies
2/4blk-flush: split queues for preflush and postflush requestsblock/blk-flush.c block/blk.h+40 -132 replies
3/4blk-flush: kill the flush state machineblock/blk-flush.c include/linux/blk-mq.h+70 -892 replies
4/4blk-flush: don't need to end rq twice for non postflushblock/blk-flush.c+4 -21 reply

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchChristoph Hellwig
1/4
2/4
3/4
4/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] blk-flush: optimize non-postflush requests

From: Chengming Zhou <[email protected]>

Hello,

This series optimize flush handling for non-postflush requests. Now we unconditionally replace rq->end_io to make rq return twice back to the flush state machine for post-flush.

Obviously, non-postflush 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.

The previous approach [1] we take is to move blk_rq_init_flush() to REQ_FSEQ_DATA stage and only replace rq->end_io if it needs post-flush.

But this way add more magic to the already way too magic flush sequence. Christoph suggested that we can kill the flush sequence entirely, and just split the flush_queue into a preflush and a postflush queue.

So this series implement the suggested approach that use two queues:
preflush and postflush requests have separate pending list and running list, so we know what to do for each request in flush_end_io(), and we don't need the flush sequence entirely.

Thanks for comments!

[1] https://lore.kernel.org/lkml/[email protected]/

Chengming Zhou (4):
blk-flush: flush_rq should inherit first_rq's cmd_flags
blk-flush: split queues for preflush and postflush requests
blk-flush: kill the flush state machine
blk-flush: don't need to end rq twice for non postflush

 block/blk-flush.c      | 181 +++++++++++++++++++++--------------------
 block/blk.h            |   3 +-
 include/linux/blk-mq.h |   1 -
 3 files changed, 96 insertions(+), 89 deletions(-)
Signature · 1 line
2.41.0