Direct IO support #7823
Motivation and Context
Direct IO via the O_DIRECT flag was originally introduced in XFS by
Since it was originally introduced it has become a standard flag which
Since the semantics were never defined in any standard, O_DIRECT is
This change is implemented by layering the aops->direct_IO operations
Original patch proposed by Richard Yao.
How Has This Been Tested?
All testing was performed using the 4.18.0-1.el7.elrepo.x86_64 kernel.
Additional build and test results are still needed for a wider range of kernels.
Types of changes
@behlendorf we've focused too much on cache behavior/pollution; certainly whilst that feels very important there is another issue of robustness/correctness in the case of failures
DIO is as much about error handling
you want a 1:1 correspondence to IOs submitted and error responses
if you submit 100s of IOs possible asynchronously from many threads (databases do this), and for some reason some of them don't make it (i'm not sure under what circumstances that might happen with zfs) the application needs to know which IOs failed and which succeeded
@cwedgwood To me it seems that in ZFS, where data writes can be transformed (ie: compression, encryption, etc) and will be written into recordsize chunks, single I/O error reporting is extremely difficult and invasive. I think this patch, enabling seamless use of DirectIO-only application, is the way to go.
@cwedgwood could you be more specific, what exactly are you proposing. Applications can pass the
 I should add that one thing I did leave out of this PR was to force all
In addition to @shodanshok comments, ZFS coalesces I/Os, further diminishing the ability to directly attribute an I/O with an I/O.
@behlendorf I like the approach. Normally, I'd advocate for a docs change, but for this specific
@@ Coverage Diff @@ ## master #7823 +/- ## ========================================== + Coverage 78.42% 78.46% +0.04% ========================================== Files 374 374 Lines 112907 112902 -5 ========================================== + Hits 88548 88592 +44 + Misses 24359 24310 -49