xfs: remove conditional building of rt geometry validator functions

I mistakenly turned off CONFIG_XFS_RT in the Kconfig file for arm64
variant of the djwong-wtf git branch. Unfortunately, it took me a good
hour to figure out that RT wasn't built because this is what got printed
to dmesg:

XFS (sda2): realtime geometry sanity check failed
XFS (sda2): Metadata corruption detected at xfs_sb_read_verify+0x170/0x190 [xfs], xfs_sb block 0x0

Whereas I would have expected:

XFS (sda2): Not built with CONFIG_XFS_RT
XFS (sda2): RT mount failed

The root cause of these problems is the conditional compilation of the
new functions xfs_validate_rtextents and xfs_compute_rextslog that I
introduced in the two commits listed below. The !RT versions of these
functions return false and 0, respectively, which causes primary
superblock validation to fail, which explains the first message.

Move the two functions to other parts of libxfs that are not
conditionally defined by CONFIG_XFS_RT and remove the broken stubs so
that validation works again.

Fixes: e14293803f4e ("xfs: don't allow overly small or large realtime volumes")
Fixes: a6a38f309afc ("xfs: make rextslog computation consistent with mkfs")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>

authored by Darrick J. Wong and committed by Chandan Babu R 881f78f4 82ef1a53

-14
fs/xfs/libxfs/xfs_rtbitmap.c
··· 1119 1119 } 1120 1120 1121 1121 /* 1122 - * Compute the maximum level number of the realtime summary file, as defined by 1123 - * mkfs. The historic use of highbit32 on a 64-bit quantity prohibited correct 1124 - * use of rt volumes with more than 2^32 extents. 1125 - */ 1126 - uint8_t 1127 - xfs_compute_rextslog( 1128 - xfs_rtbxlen_t rtextents) 1129 - { 1130 - if (!rtextents) 1131 - return 0; 1132 - return xfs_highbit64(rtextents); 1133 - } 1134 - 1135 - /* 1136 1122 * Compute the number of rtbitmap words needed to populate every block of a 1137 1123 * bitmap that is large enough to track the given number of rt extents. 1138 1124 */
-16
fs/xfs/libxfs/xfs_rtbitmap.h
··· 351 351 int xfs_rtfree_blocks(struct xfs_trans *tp, xfs_fsblock_t rtbno, 352 352 xfs_filblks_t rtlen); 353 353 354 - uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents); 355 - 356 - /* Do we support an rt volume having this number of rtextents? */ 357 - static inline bool 358 - xfs_validate_rtextents( 359 - xfs_rtbxlen_t rtextents) 360 - { 361 - /* No runt rt volumes */ 362 - if (rtextents == 0) 363 - return false; 364 - 365 - return true; 366 - } 367 - 368 354 xfs_filblks_t xfs_rtbitmap_blockcount(struct xfs_mount *mp, xfs_rtbxlen_t 369 355 rtextents); 370 356 unsigned long long xfs_rtbitmap_wordcount(struct xfs_mount *mp, ··· 369 383 # define xfs_rtsummary_read_buf(a,b) (-ENOSYS) 370 384 # define xfs_rtbuf_cache_relse(a) (0) 371 385 # define xfs_rtalloc_extent_is_free(m,t,s,l,i) (-ENOSYS) 372 - # define xfs_compute_rextslog(rtx) (0) 373 - # define xfs_validate_rtextents(rtx) (false) 374 386 static inline xfs_filblks_t 375 387 xfs_rtbitmap_blockcount(struct xfs_mount *mp, xfs_rtbxlen_t rtextents) 376 388 {
+14
fs/xfs/libxfs/xfs_sb.c
··· 1377 1377 } 1378 1378 return true; 1379 1379 } 1380 + 1381 + /* 1382 + * Compute the maximum level number of the realtime summary file, as defined by 1383 + * mkfs. The historic use of highbit32 on a 64-bit quantity prohibited correct 1384 + * use of rt volumes with more than 2^32 extents. 1385 + */ 1386 + uint8_t 1387 + xfs_compute_rextslog( 1388 + xfs_rtbxlen_t rtextents) 1389 + { 1390 + if (!rtextents) 1391 + return 0; 1392 + return xfs_highbit64(rtextents); 1393 + }
+2
fs/xfs/libxfs/xfs_sb.h
··· 38 38 extern bool xfs_validate_stripe_geometry(struct xfs_mount *mp, 39 39 __s64 sunit, __s64 swidth, int sectorsize, bool silent); 40 40 41 + uint8_t xfs_compute_rextslog(xfs_rtbxlen_t rtextents); 42 + 41 43 #endif /* __XFS_SB_H__ */
+12
fs/xfs/libxfs/xfs_types.h
··· 251 251 bool xfs_verify_fileext(struct xfs_mount *mp, xfs_fileoff_t off, 252 252 xfs_fileoff_t len); 253 253 254 + /* Do we support an rt volume having this number of rtextents? */ 255 + static inline bool 256 + xfs_validate_rtextents( 257 + xfs_rtbxlen_t rtextents) 258 + { 259 + /* No runt rt volumes */ 260 + if (rtextents == 0) 261 + return false; 262 + 263 + return true; 264 + } 265 + 254 266 #endif /* __XFS_TYPES_H__ */
+1
fs/xfs/scrub/rtbitmap.c
··· 15 15 #include "xfs_inode.h" 16 16 #include "xfs_bmap.h" 17 17 #include "xfs_bit.h" 18 + #include "xfs_sb.h" 18 19 #include "scrub/scrub.h" 19 20 #include "scrub/common.h" 20 21 #include "scrub/repair.h"
+1
fs/xfs/scrub/rtsummary.c
··· 16 16 #include "xfs_rtbitmap.h" 17 17 #include "xfs_bit.h" 18 18 #include "xfs_bmap.h" 19 + #include "xfs_sb.h" 19 20 #include "scrub/scrub.h" 20 21 #include "scrub/common.h" 21 22 #include "scrub/trace.h"