On Fri, Dec 29, 2017 at 10:45 AM Viacheslav Biriukov <v.v.biriu...@gmail.com>
wrote:

> I expect that my alignment write from an array will work as it works with
a slice.

The code nowhere cares to make the alignment required by O_DIRECT proper
for the write. It works in one of the cases just by chance. Also, the
expectation that the slice after append must have the same alignment as has
the array in the other case, or vice versa, is not guaranteed in any way by
the specs.

You must create a properly aligned disk buffer manually or use a page
acquired directly from the OS which will be probably guaranteed to be
properly aligned for O_DIRECT across OSs.


-- 

-j

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to