Hi all, In preparation for adding block headers and enforcing endian order in rtbitmap and rtsummary blocks, replace open-coded geometry computations and fugly macros with proper helper functions that can be typechecked. Soon we'll be needing to add more complex logic to the helpers. v1.1: various cleanups suggested by hch If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. With a bit of luck, this should all go splendidly. Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=refactor-rtbitmap-macros-6.7 --- fs/xfs/libxfs/xfs_format.h | 32 +++-- fs/xfs/libxfs/xfs_rtbitmap.c | 270 +++++++++++++++++++++++++++++----------- fs/xfs/libxfs/xfs_rtbitmap.h | 115 +++++++++++++++++ fs/xfs/libxfs/xfs_trans_resv.c | 9 + fs/xfs/libxfs/xfs_types.h | 2 fs/xfs/scrub/rtsummary.c | 39 +++--- fs/xfs/scrub/trace.c | 1 fs/xfs/scrub/trace.h | 4 - fs/xfs/xfs_ondisk.h | 4 + fs/xfs/xfs_rtalloc.c | 39 +++--- 10 files changed, 377 insertions(+), 138 deletions(-)