directio icon indicating copy to clipboard operation
directio copied to clipboard

Direct IO Golang Writer (Linux O_DIRECT)

Results 4 directio issues
Sort by recently updated
recently updated
newest added

When my go code is running with this `O_DIRECT` flag, I run the command `free -h`, I can still see hundreds of megabytes buffer are used

Direct IO is best used with large buffer size, so it's probably more common to see async calls to DirectIO streams.

Would be handy to have a method that opens a file and returns Direct IO Writer/Reader object for it. I'm thinking same signature as https://golang.org/src/os/file.go?h=OpenFile#L282

Drives may have different block size, consider using ioctl with BLKSSZGET for alignment block size.