Skip to contentSkip to conversation

status of O_DIRECT with btrfs ?

DISCUSSION Qu Wenruo 1 participant 2 messages May 27 – May 28 4 messages not in the archive Btrfs file system

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

Qu Wenruo

author
#3 lore raw
Quoted 9 lines · Roland Kletzing

hello,

thanks again for the patch.

i just build a recent proxmox kernel and applied your patch and it indeed fixes csum error from happening.

i installed several win11 VMs and and also did virtual disk live migration and see no checksum errors anymore.

any reason why this patch isn't getting merged?

Performance drop first, it will reduce performance pretty hugely. At least 1/2, sometimes even 1/3 of the original performance.

Secondly unlike direct writes, modifying the buffer during read can easily race with the data read from disks, thus it's a more serious problem in the user space.

Finally, we're closing to use IOMAP_DIO_BOUNCE flag, which completely resolves the problem of performance drop.

Thanks,
Qu

Quoted 29 lines

regards
Roland

Am 23.05.26 um 00:09 schrieb Qu Wenruo:

Quoted 23 lines · Roland Kletzing
Quoted 7 lines

hello,

i was under assumption that with recent patches and my successfully testing from october last year ( https://bugzilla.kernel.org/show_bug.cgi? id=99171#c35 ) , i was under (false) assumption that O_DIRECT support in btrfs would have gotten much more mature now.

Quoted 6 lines

my latest findings reported at https://bugzilla.proxmox.com/ show_bug.cgi?id=5320#c14 tell different story.

is there any official statement on reliability of O_DIRECT support in btrfs ?

i'm getting these types of errors when installing win11 VM

Direct read can still result csum errors, as this patch is not yet merged upstream.

https://lore.kernel.org/linux-btrfs/ aa09b68f159fb0de4864de151eeba9250f2e34fd.1758840406.git.wqu@suse.com/

Furthermore, for your compression if the direct IO block size is only 4K, it will never be compressed except for inlined ones.

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#5 lore raw
Quoted 4 lines · Roland Kletzing
Quoted 1 line

Finally, we're closing to use IOMAP_DIO_BOUNCE flag, which completely

resolves the problem of performance drop

for not having misunderstood you - you mean you're close to that with development, i.e. this patch is going to be obsolet and replaced by something better !?

Yes, bouncing will solve the buffer modification race, but with only minor performance drop (95% of the original zero-copy performance).

But don't be too optimistic yet, there are still bugs related to the IOMAP_DIO_BOUNCE flag usage in direct writes.

Only after the conversion of direct writes to the new bounce behavior, then we can start working on the direct read.

Thanks,
Qu

Quoted 4 lines

thanks again and have a nice day
roland