[PATCH v2 0/2] block: avoid redundant flushes for O_DSYNC direct writes
Zhenxian Ma <[email protected]>
| Newsgroups | org.kernel.vger.linux-block |
|---|---|
| Message-ID | <[email protected]> |
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(-) -- 2.43.5