On Fri, 23 Feb 2024 at 09:46, Christoph Hellwig <[email protected]> wrote:
>
> I'll let Ming speak, but I think the idea was to remove the padding
> at the end of the structure when embedded into the bio.
It's not horribly obvious if the beginning is aligned there either.
> Does __aligned also work on struct members? If so we could add a
> __aligned(8) to bi_sector an get exactly what we want..
Hmm. I'm not sure that works. I think sizeof may always end up being
aligned to alignof (because otherwise arrays cannot work)
And looking at
struct bio_integrity_payload {
there's odd padding both before _and_ after the struct bvec_iter due
to having three 16-bit fields in between.
So right now I think that packing ends up actually horrid. I don't see
any *reason* for that odd setup, but right now it might have actually
end up being 2-byte aligned with a two-byte padding hole at the end.
Linus