On Fri, 23 Feb 2024 at 09:17, Mike Snitzer <[email protected]> wrote:
>
> - Fix DM crypt and verity targets to align their respective bvec_iter
> struct members to avoid the need for byte level access (due to
> __packed attribute) that is costly on some arches (like RISC).
Ugh. This is due to commit 19416123ab3e ("block: define 'struct
bvec_iter' as packed"), and the point of *that* commit was that it
doesn't hurt to mark it packed.
That was clearly not true.
And honestly, "__packed" really is wrong here. Nobody ever wanted it
to be completely unaligned.
I think we might be better off marking it as being 4-byte aligned.
That would mean that instead of __packed, it is done as
__packed __aligned(4)
because "__aligned" on its own only increases alignment (so without
the __packed it would stay 8-byte aligned).
Then the only part of that structure that might be unaligned is
"sector_t", and that would only matter on 64-bit architectures.
And very few architectures are both 64-bit _and_ so broken as to not
do unaligned loads well. And even if such broken architectures exist,
at least they can do the 8-byte load as two 4-byte ones rather than
doing it as byte loads..
Anyway, I've pulled this, but I really think this should have been
fixed in bvec.h instead.
Jens/Christoph/whoever feels they own bvec.h?
Linus