In case of direct IO, the page index is not calculated correctly when doing encryption and decryption. With Direct IO, because we do not have proper page cache pages, we need to retrieve by ourselves the page mapping and the page index of the page to be encrypted/decrypted. For this we use (struct brw_page*)->off. Unfortunately, this offset is not relative to the whole file, but it is just an offset within the object. At the end of the road, it means we do not use consistent indexes between the buffered IO and direct IO cases. And more specifically, the indexes used by the direct IO case can repeat (if we access pages at the same offset but in different stripes), which is bad.