Re: [PATCH 1/8][next] block: blk_types.h: Use struct_group_tagged() in flex struct bio
From: Christoph Hellwig
Date: Mon Feb 24 2025 - 11:40:47 EST
On Mon, Feb 24, 2025 at 08:25:08PM +1030, Gustavo A. R. Silva wrote:
> Use the `struct_group_tagged()` helper to create a new tagged
> `struct bio_hdr`. This structure groups together all the members of
> the flexible `struct bio` except the flexible array `bi_inline_vecs`.
> As a result, the array is effectively separated from the rest of the
> members without modifying the memory layout of the flexible structure.
>
> This new tagged struct will be used to fix problematic declarations
> of middle-flex-arrays in composite structs, like these[1][2][3], for
> instance.
Well, I guess this goes with the context-less nvme patch. I think
you're much better off just removing the bi_inline_vecs array entirely,
and just add a new structure for bio + inline vecs for the few callers
that dynamically allocate the bio and actually have inline vecs.
Similar to what I did here for the bio integrity payload:
https://lore.kernel.org/linux-block/20250131122436.1317268-4-hch@xxxxxx/