On Fri, Aug 22, 2025 at 06:57:08PM +0530, Ritesh Harjani wrote: > Keith Busch <kbusch@xxxxxxxx> writes: > > BTW - I did some basic testing of the series against block device, XFS & > EXT4 and it worked as expected (for both DIO & AIO-DIO) i.e. > 1. Individial iov_len need not be aligned to the logical block size anymore. > 2. Total length of iovecs should be logical block size aligned though. > > i.e. this combination works with this patch series now: > > posix_memalign((void**)&aligned_buf, mem_align, 2 * BLOCK_SIZE); > struct iovec iov[4] = { > {.iov_base = aligned_buf, .iov_len = 500}, > {.iov_base = aligned_buf + 500, .iov_len = 1500}, > {.iov_base = aligned_buf + 2000, .iov_len = 2000}, > {.iov_base = aligned_buf + 4000, .iov_len = 4192} > }; // 500 + 1500 + 2000 + 4192 = 8192 Yep, the kernel would have rejected that before, but should work now. An added bonus, the code doesn't spend CPU cycles walking the iovec early anymore. Your test, though, is not getting to the real good stuff! :) Your vectors are virtually contiguous, so the block layer will merge them to maybe only one block sized segment. Add some offsets to create gaps, but still adhere to your device's dma and virtual boundary limits. Your offset options may be constrained if you're using NVMe, but I have a follow up series fixing that for capable hardware.