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. If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. This has been running on the djcloud for months with no problems. Enjoy! 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 xfsprogs git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=refactor-rtbitmap-macros --- fs/xfs/libxfs/xfs_format.h | 32 ++--- fs/xfs/libxfs/xfs_rtbitmap.c | 268 ++++++++++++++++++++++++++++----------- fs/xfs/libxfs/xfs_rtbitmap.h | 133 +++++++++++++++++++ fs/xfs/libxfs/xfs_trans_resv.c | 9 + fs/xfs/libxfs/xfs_types.h | 2 fs/xfs/scrub/rtsummary.c | 50 ++++--- fs/xfs/scrub/rtsummary.h | 6 - fs/xfs/scrub/rtsummary_repair.c | 7 + fs/xfs/scrub/trace.c | 1 fs/xfs/scrub/trace.h | 4 - fs/xfs/xfs_ondisk.h | 4 + fs/xfs/xfs_rtalloc.c | 39 +++--- 12 files changed, 408 insertions(+), 147 deletions(-)