Re: bio segment constraints

Keith Busch
2025-04-07T15:12:46Z

On Mon, Apr 07, 2025 at 12:07:11AM -0700, Christoph Hellwig wrote:
> On Sun, Apr 06, 2025 at 03:40:04PM -0400, Sean Anderson wrote:
> > - What about bv_offset?
>
> bv_offset is a memory offset and must only be aligned to the
> dma_alignment limit.
>
> > - Is it possible to have a bio where the total length is a multiple of
> > logical_sector_size, but the data is split across several segments
> > where each segment is a multiple of SECTOR_SIZE?
>
> Yes.
>
> > - Is is possible to have segments not even aligned to SECTOR_SIZE?
>
> No.

O_DIRECT only requires each user iovec be a multiple of the logical
block size with the address aligned to the dma_alignment. If the
dma_alignment is smaller than the logical block size, then this could
create bvec segments that are smaller. For nvme where we have 4-byte
dma alignment, you could have the first segment be the last 4 bytes of a
page, then the remaing 508 bytes from a different page in the next
segment.