On Mon, Mar 30, 2020 at 8:43 PM Richard Laager <rlaa...@wiktel.com> wrote:

> On 3/30/20 10:27 PM, Matthew Ahrens via openzfs-developer wrote:
>
> On Mon, Mar 30, 2020 at 7:08 PM Richard Laager <rlaa...@wiktel.com> wrote:
>
>> My only personal interest in O_DIRECT is for KVM qemu virtualization. It
>> sounds like I will probably need to set direct=disabled. Alternatively,
>> if I could get all the writes to be 4K-aligned (e.g. by making all the
>> virtual disks 4Kn?), then ZFS's O_DIRECT would work.
>>
>
> We were thinking that qemu *would* be able to use O_DIRECT, or at least it
> wouldn't need direct=disabled.  But I think your assessment implies that
> qemu usually uses O_DIRECT i/o that is not page (4K) aligned
>
> Yes, that was my assumption. Imagine the (likely still typical) case of
> 512B virtual disks. If the guest does a 512B write, is KVM really doing RMW
> to make that 4K? I'm assuming not. This very well may be a faulty
> assumption. I'm not a qemu developer.
>

QEMU could try to do the 512b O_DIRECT write, get an error, and then fall
back on 512b non-DIRECT write.  Or tell you to change your config to not
use O_DIRECT.  I can't imagine what else would work, given other
filesystems' implementations of O_DIRECT.  Given that we are proposing ZFS
have the same semantics, and we haven't heard of anyone having to tell ext4
to ignore O_DIRECT, I don't imagine you will need to tell ZFS to ignore
O_DIRECT (with direct=disabled) either.

--matt

------------------------------------------
openzfs: openzfs-developer
Permalink: 
https://openzfs.topicbox.com/groups/developer/T950b02acdf392290-Mf69b8eb6c10e94b9b6b8592e
Delivery options: https://openzfs.topicbox.com/groups/developer/subscription

Reply via email to