Latest Results
dd: align the I/O buffer to the page size for O_DIRECT
O_DIRECT requires the user buffer to satisfy the DMA alignment of the
underlying block device (/sys/block/<dev>/queue/dma_alignment), which
is as strict as one logical sector (511) for most drivers (sd, loop,
virtio_blk, nbd, zram, ...). The main I/O buffer was allocated with
Vec's default heap alignment (16 bytes), so iflag=direct reads failed
with EINVAL on such devices, and every full-block oflag=direct write
took the EINVAL fallback path that strips O_DIRECT via fcntl, retries
buffered, and restores the flag - three extra syscalls per block while
silently not doing direct I/O at all.
Introduce AlignedBuffer, a growable byte buffer that keeps its data
start page-aligned (like GNU dd) by over-allocating and offsetting in
safe code, and use it for the copy loop buffer.
Fixes #12085relative23:dd-odirect-buffer-alignment Latest Branches
0%
leeewee:join-fix-field-number-display 0%
0%
Chaganti-Reddy:ln-backup-multilink-samefile © 2026 CodSpeed Technology