Files
versitygw/backend
Ben McClelland 752da31490 fix: keep O_DIRECT active for object uploads and reads
Uploads copied the request body with io.CopyBuffer, which issues one write
per read. Network reads return arbitrary lengths, so the first short read
produced an unaligned write and the tmpfile silently reopened buffered for
the rest of the object.

- Fill the I/O buffer completely before each O_DIRECT write so only the
  final tail is unaligned; write that tail buffered without treating it
  as a fallback.
- Allocate I/O buffers 4 KiB aligned and use 4 KiB alignment for O_DIRECT
  lengths and offsets to cover 4Kn devices.
- Replace the O_DIRECT read wrapper with a reader that issues aligned
  preads into an aligned buffer for full and ranged GETs. sendfile from an
  O_DIRECT fd fails with EINVAL after a partial socket write, so O_DIRECT
  reads no longer go through sendfile; buffered reads still do.
- Debug log unexpected O_DIRECT fallbacks on both paths.
2026-10-02 09:41:27 -07:00
..
2026-05-21 23:49:34 +04:00