From: Christoph Hellwig <hch@xxxxxx> Source kernel commit: 3abfe6c2759e2e3000b13f8ce8a1a325e80987a1 xfs_format.h has a bunch odd wrappers for helper functions and mount structure access using RT* prefixes. Replace them with their open coded versions (for those that weren't entirely unused) and remove the wrappers. Signed-off-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> Signed-off-by: Chandan Babu R <chandanbabu@xxxxxxxxxx> Reviewed-by: Bill O'Donnell <bodonnel@xxxxxxxxxx> --- db/check.c | 4 ++-- libxfs/xfs_format.h | 8 -------- libxfs/xfs_rtbitmap.c | 24 ++++++++++++------------ repair/rt.c | 6 ++---- 4 files changed, 16 insertions(+), 26 deletions(-) diff --git a/db/check.c b/db/check.c index 2f2fbc7cb..91d0c0940 100644 --- a/db/check.c +++ b/db/check.c @@ -3688,7 +3688,7 @@ process_rtbitmap( } else if (prevbit == 1) { len = ((int)bmbno - start_bmbno) * bitsperblock + (bit - start_bit); - log = XFS_RTBLOCKLOG(len); + log = libxfs_highbit64(len); offs = xfs_rtsumoffs(mp, log, start_bmbno); inc_sumcount(mp, sumcompute, offs); prevbit = 0; @@ -3701,7 +3701,7 @@ process_rtbitmap( if (prevbit == 1) { len = ((int)bmbno - start_bmbno) * bitsperblock + (bit - start_bit); - log = XFS_RTBLOCKLOG(len); + log = libxfs_highbit64(len); offs = xfs_rtsumoffs(mp, log, start_bmbno); inc_sumcount(mp, sumcompute, offs); } diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h index e6ca188e2..7d2873a79 100644 --- a/libxfs/xfs_format.h +++ b/libxfs/xfs_format.h @@ -1156,20 +1156,12 @@ static inline bool xfs_dinode_has_large_extent_counts( #define XFS_DFL_RTEXTSIZE (64 * 1024) /* 64kB */ #define XFS_MIN_RTEXTSIZE (4 * 1024) /* 4kB */ -#define XFS_BLOCKSIZE(mp) ((mp)->m_sb.sb_blocksize) -#define XFS_BLOCKMASK(mp) ((mp)->m_blockmask) - /* * RT bit manipulation macros. */ #define XFS_RTMIN(a,b) ((a) < (b) ? (a) : (b)) #define XFS_RTMAX(a,b) ((a) > (b) ? (a) : (b)) -#define XFS_RTLOBIT(w) xfs_lowbit32(w) -#define XFS_RTHIBIT(w) xfs_highbit32(w) - -#define XFS_RTBLOCKLOG(b) xfs_highbit64(b) - /* * Dquot and dquot block format definitions */ diff --git a/libxfs/xfs_rtbitmap.c b/libxfs/xfs_rtbitmap.c index bbf955be8..eefc45c64 100644 --- a/libxfs/xfs_rtbitmap.c +++ b/libxfs/xfs_rtbitmap.c @@ -193,7 +193,7 @@ xfs_rtfind_back( /* * Different. Mark where we are and return. */ - i = bit - XFS_RTHIBIT(wdiff); + i = bit - xfs_highbit32(wdiff); *rtx = start - i + 1; return 0; } @@ -231,7 +231,7 @@ xfs_rtfind_back( /* * Different, mark where we are and return. */ - i += XFS_NBWORD - 1 - XFS_RTHIBIT(wdiff); + i += XFS_NBWORD - 1 - xfs_highbit32(wdiff); *rtx = start - i + 1; return 0; } @@ -270,7 +270,7 @@ xfs_rtfind_back( /* * Different, mark where we are and return. */ - i += XFS_NBWORD - 1 - XFS_RTHIBIT(wdiff); + i += XFS_NBWORD - 1 - xfs_highbit32(wdiff); *rtx = start - i + 1; return 0; } else @@ -346,7 +346,7 @@ xfs_rtfind_forw( /* * Different. Mark where we are and return. */ - i = XFS_RTLOBIT(wdiff) - bit; + i = xfs_lowbit32(wdiff) - bit; *rtx = start + i - 1; return 0; } @@ -384,7 +384,7 @@ xfs_rtfind_forw( /* * Different, mark where we are and return. */ - i += XFS_RTLOBIT(wdiff); + i += xfs_lowbit32(wdiff); *rtx = start + i - 1; return 0; } @@ -421,7 +421,7 @@ xfs_rtfind_forw( /* * Different, mark where we are and return. */ - i += XFS_RTLOBIT(wdiff); + i += xfs_lowbit32(wdiff); *rtx = start + i - 1; return 0; } else @@ -706,7 +706,7 @@ xfs_rtfree_range( */ if (preblock < start) { error = xfs_rtmodify_summary(args, - XFS_RTBLOCKLOG(start - preblock), + xfs_highbit64(start - preblock), xfs_rtx_to_rbmblock(mp, preblock), -1); if (error) { return error; @@ -718,7 +718,7 @@ xfs_rtfree_range( */ if (postblock > end) { error = xfs_rtmodify_summary(args, - XFS_RTBLOCKLOG(postblock - end), + xfs_highbit64(postblock - end), xfs_rtx_to_rbmblock(mp, end + 1), -1); if (error) { return error; @@ -729,7 +729,7 @@ xfs_rtfree_range( * (new) free extent. */ return xfs_rtmodify_summary(args, - XFS_RTBLOCKLOG(postblock + 1 - preblock), + xfs_highbit64(postblock + 1 - preblock), xfs_rtx_to_rbmblock(mp, preblock), 1); } @@ -798,7 +798,7 @@ xfs_rtcheck_range( /* * Different, compute first wrong bit and return. */ - i = XFS_RTLOBIT(wdiff) - bit; + i = xfs_lowbit32(wdiff) - bit; *new = start + i; *stat = 0; return 0; @@ -837,7 +837,7 @@ xfs_rtcheck_range( /* * Different, compute first wrong bit and return. */ - i += XFS_RTLOBIT(wdiff); + i += xfs_lowbit32(wdiff); *new = start + i; *stat = 0; return 0; @@ -875,7 +875,7 @@ xfs_rtcheck_range( /* * Different, compute first wrong bit and return. */ - i += XFS_RTLOBIT(wdiff); + i += xfs_lowbit32(wdiff); *new = start + i; *stat = 0; return 0; diff --git a/repair/rt.c b/repair/rt.c index e49487829..4c81e2114 100644 --- a/repair/rt.c +++ b/repair/rt.c @@ -14,8 +14,6 @@ #include "err_protos.h" #include "rt.h" -#define xfs_highbit64 libxfs_highbit64 /* for XFS_RTBLOCKLOG macro */ - void rtinit(xfs_mount_t *mp) { @@ -115,7 +113,7 @@ generate_rtinfo( } } else if (in_extent == 1) { len = (int) (extno - start_ext); - log = XFS_RTBLOCKLOG(len); + log = libxfs_highbit64(len); offs = xfs_rtsumoffs(mp, log, start_bmbno); inc_sumcount(mp, sumcompute, offs); in_extent = 0; @@ -131,7 +129,7 @@ generate_rtinfo( } if (in_extent == 1) { len = (int) (extno - start_ext); - log = XFS_RTBLOCKLOG(len); + log = libxfs_highbit64(len); offs = xfs_rtsumoffs(mp, log, start_bmbno); inc_sumcount(mp, sumcompute, offs); }