Re: [PATCH 2/5] xfs_db: fix alignment checks in getbitval

Christoph Hellwig
2024-03-26T05:14:53Z

On Mon, Mar 25, 2024 at 08:21:21PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> For some reason, getbitval insists upon collecting a u64 from a pointer
> bit by bit if it's not aligned to a 16-byte boundary. Modern day
> systems only seem to require N-byte alignment for an N-byte quantity, so
> let's do that instead.

Not sure what modern day systems means here. In general in C you can
do unaligned access, but it might be very inefficient.

If this code does what I think it does, maybe the right thing is to
simply use the get_unaligned_be{16,32,64} helpers?