]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commit
xfs_db: improve number extraction in getbitval
authorDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 23:07:45 +0000 (16:07 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 17 Apr 2024 21:06:27 +0000 (14:06 -0700)
commit221bfd062e641ae9d0c2ba7fa8c87228a5712b37
treefa73667b6f2ca79371f3db1b76ec86aa66024004
parenta66875ddf0d3ac19af4decb49c5304debdef3b51
xfs_db: improve number extraction in getbitval

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.  If not, then it
resorts to scraping bits individually.  I don't know of any platform
where we require 16-byte alignment for a 8-byte access, or why we'd care
now that we have things like get_unaligned_beXX.

Rework this function to detect either naturally aligned accesses and use
the regular beXX_to_cpu functions; or byte-aligned accesses and use the
get_unaligned_beXX functions.  Only fall back to the bit scraping
algorithm for the really weird cases.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
db/bit.c