From: Wang Yugui <wangyugui@e16-tech.com>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: use IOMAP_DIO_BOUNCE flag for direct reads
Date: Fri, 28 Aug 2026 21:26:31 +0800 [thread overview]
Message-ID: <20260828212630.5D50.409509F4@e16-tech.com> (raw)
In-Reply-To: <1219d8d9ed105a922d9af6130e08532e2907ea17.1787909265.git.wqu@suse.com>
Hi,
> Similar to direct writes, if the inode requires data checksum, we should
> use a stable buffer for IO, or even for direct reads an unstable buffer
> (e.g. the buffer is being modified during the direct read) can lead to
> checksum mismatch and even cause read failure.
>
> To address the potential problems of unstable dio read buffers, use
> IOMAP_DIO_BOUNCE for dio reads if the inode requires data checksum.
>
> This will bring a small performance drop, around 7% for my benchmark,
> which is definitely observable on modern NVME SSDs, but the overhead is
> still much smaller compared to data checksum:
>
> Fio command line:
>
> # fio --name=randread --filename $mnt/foobar --ioengine=libaio --size=4G \
> --rw=randread --bs=64k --iodepth=64 --runtime=60 --time_based --direct=1
>
> The VM setup:
>
> 10 vCPUs (host-passthrough), 8G RAM, target storage has cache=none
> option, is backed by a cheap DRAM-less 1T mainstream PCIe4 SSD.
>
> | Bandwidth (MiB/s) | Diff
> --------------------------------+-------------------+-----------
> Nodatasum, zero-copy (Baseline) | 988 | 0
> Datasum, zero-copy (unpatched) | 853 | -13.7%
> Datasum, bounce (patched) | 794 | -19.6%
>
> The difference between data csum bounce and zero-copy is only 7%, which
> is much more acceptable than falling back to buffered IO.
for direct write, there is some process of 'falling back to buffered IO' in
btrfs_direct_write().
for direct read, there is no process of 'falling back to buffered IO' ?
Or I missed something?
Best Regards
Wang Yugui (wangyugui@e16-tech.com)
2026/08/28
prev parent reply other threads:[~2026-08-28 13:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 9:28 [PATCH] btrfs: use IOMAP_DIO_BOUNCE flag for direct reads Qu Wenruo
2026-08-28 13:26 ` Wang Yugui [this message]
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=20260828212630.5D50.409509F4@e16-tech.com \
--to=wangyugui@e16-tech.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.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.