From: Zhenxian Ma <mzx199711@gmail.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-block@vger.kernel.org,
Zhenxian Ma <mazhenxian@xiaohongshu.com>
Subject: [PATCH v2 0/2] block: avoid redundant flushes for O_DSYNC direct writes
Date: Sat, 15 Aug 2026 17:06:51 +0800 [thread overview]
Message-ID: <cover.1786782832.git.mzx199711@gmail.com> (raw)
In-Reply-To: <20260812130335.60354-1-mzx199711@gmail.com>
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/20260812130335.60354-1-mzx199711@gmail.com/]:
- 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
next prev parent reply other threads:[~2026-08-15 9:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 13:03 [PATCH] block: skip redundant flush for O_DSYNC direct writes Zhenxian Ma
2026-08-12 16:42 ` Christoph Hellwig
2026-08-13 7:35 ` 马振先
2026-08-14 6:32 ` Christoph Hellwig
2026-08-15 9:06 ` Zhenxian Ma [this message]
2026-08-15 9:06 ` [PATCH v2 1/2] " Zhenxian Ma
2026-08-15 12:02 ` [PATCH v2 2/2] block: only use REQ_FUA for direct writes if the device supports it Zhenxian Ma
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=cover.1786782832.git.mzx199711@gmail.com \
--to=mzx199711@gmail.com \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=mazhenxian@xiaohongshu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.