xfs: replace xfs_sb_version checks with feature flag checks
Convert the xfs_sb_version_hasfoo() to checks against mp->m_features. Checks of the superblock itself during disk operations (e.g. in the read/write verifiers and the to/from disk formatters) are not converted - they operate purely on the superblock state. Everything else should use the mount features. Large parts of this conversion were done with sed with commands like this: for f in `git grep -l xfs_sb_version_has fs/xfs/*.c`; do sed -i -e 's/xfs_sb_version_has\(.*\)(&\(.*\)->m_sb)/xfs_has_\1(\2)/' $f done With manual cleanups for things like "xfs_has_extflgbit" and other little inconsistencies in naming. The result is ia lot less typing to check features and an XFS binary size reduced by a bit over 3kB: $ size -t fs/xfs/built-in.a text data bss dec hex filenam before 1130866 311352 484 1442702 16038e (TOTALS) after 1127727 311352 484 1439563 15f74b (TOTALS) Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
committed by
Darrick J. Wong
parent
a1d86e8dec
commit
38c26bfd90
@@ -105,7 +105,7 @@ xfs_dir3_free_verify(
|
||||
if (!xfs_verify_magic(bp, hdr->magic))
|
||||
return __this_address;
|
||||
|
||||
if (xfs_sb_version_hascrc(&mp->m_sb)) {
|
||||
if (xfs_has_crc(mp)) {
|
||||
struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
|
||||
|
||||
if (!uuid_equal(&hdr3->uuid, &mp->m_sb.sb_meta_uuid))
|
||||
@@ -128,7 +128,7 @@ xfs_dir3_free_read_verify(
|
||||
struct xfs_mount *mp = bp->b_mount;
|
||||
xfs_failaddr_t fa;
|
||||
|
||||
if (xfs_sb_version_hascrc(&mp->m_sb) &&
|
||||
if (xfs_has_crc(mp) &&
|
||||
!xfs_buf_verify_cksum(bp, XFS_DIR3_FREE_CRC_OFF))
|
||||
xfs_verifier_error(bp, -EFSBADCRC, __this_address);
|
||||
else {
|
||||
@@ -153,7 +153,7 @@ xfs_dir3_free_write_verify(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!xfs_sb_version_hascrc(&mp->m_sb))
|
||||
if (!xfs_has_crc(mp))
|
||||
return;
|
||||
|
||||
if (bip)
|
||||
@@ -185,7 +185,7 @@ xfs_dir3_free_header_check(
|
||||
firstdb = (xfs_dir2_da_to_db(mp->m_dir_geo, fbno) -
|
||||
xfs_dir2_byte_to_db(mp->m_dir_geo, XFS_DIR2_FREE_OFFSET)) *
|
||||
maxbests;
|
||||
if (xfs_sb_version_hascrc(&mp->m_sb)) {
|
||||
if (xfs_has_crc(mp)) {
|
||||
struct xfs_dir3_free_hdr *hdr3 = bp->b_addr;
|
||||
|
||||
if (be32_to_cpu(hdr3->firstdb) != firstdb)
|
||||
@@ -341,7 +341,7 @@ xfs_dir3_free_get_buf(
|
||||
memset(bp->b_addr, 0, sizeof(struct xfs_dir3_free_hdr));
|
||||
memset(&hdr, 0, sizeof(hdr));
|
||||
|
||||
if (xfs_sb_version_hascrc(&mp->m_sb)) {
|
||||
if (xfs_has_crc(mp)) {
|
||||
struct xfs_dir3_free_hdr *hdr3 = bp->b_addr;
|
||||
|
||||
hdr.magic = XFS_DIR3_FREE_MAGIC;
|
||||
|
||||
Reference in New Issue
Block a user