Skip to content

block: avoid redundant flushes for O_DSYNC direct writes

Zhenxian Ma linux-block 2 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest1 of 2 patches 4 repliesApplied
  2. v11 patch 3 repliesSuperseded

Changes in v2 from the cover letter

[https://lore.kernel.org/linux-block/[email protected]/]:

- Split into two patches per Christoph's suggestion.
- Patch 1 tracks need_sync (default false) instead of dio_fua_done.
- Added Patch 2 for the no-FUA case; asynchronous submitters stay at parity with mainline.

1 of 2 patches is in this archive. The cover letter announces 2.

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2block: skip redundant flush for O_DSYNC direct writesblock/fops.c+6 -21 reply

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchChristoph Hellwig
SeriesR-b
1/2R-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/2] block: avoid redundant flushes for O_DSYNC direct writes

This series removes redundant cache flushes on the O_DIRECT | O_DSYNC write path to a block device, following Christoph's review of v1.

Patch 1 skips generic_write_sync() when the direct write was already made durable by REQ_FUA.

Patch 2 stops setting REQ_FUA on synchronous O_DSYNC direct writes to devices without FUA support, relying on generic_write_sync() instead and avoiding per-bio POSTFLUSH emulation. Asynchronous writes keep REQ_FUA, since they cannot fall back to generic_write_sync().

Changes since v1
[https://lore.kernel.org/linux-block/[email protected]/]:

- Split into two patches per Christoph's suggestion.
- Patch 1 tracks need_sync (default false) instead of dio_fua_done.
- Added Patch 2 for the no-FUA case; asynchronous submitters stay at parity with mainline.

Tested on Linux 7.2.0-rc7 with a Seagate ST20000NM007D (fua=1), 4 KiB O_DSYNC direct writes, mainline vs this series:

Sequential: 119.7 -> 7497.0 IOPS
Random: 156.1 -> 666.4 IOPS

On a loop device without FUA there was no regression, and async O_DSYNC direct writes were verified durable with fio verify=crc32c (262144 IOs, no errors).

Zhenxian Ma (2):
block: skip redundant flush for O_DSYNC direct writes
block: only use REQ_FUA for direct writes if the device supports it

 block/fops.c | 40 +++++++++++++++++++++++++++++++++-------
 1 file changed, 33 insertions(+), 7 deletions(-)
Signature · 1 line
2.43.5