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
@@ -58,7 +58,7 @@ xfs_inobt_update(
|
||||
union xfs_btree_rec rec;
|
||||
|
||||
rec.inobt.ir_startino = cpu_to_be32(irec->ir_startino);
|
||||
if (xfs_sb_version_hassparseinodes(&cur->bc_mp->m_sb)) {
|
||||
if (xfs_has_sparseinodes(cur->bc_mp)) {
|
||||
rec.inobt.ir_u.sp.ir_holemask = cpu_to_be16(irec->ir_holemask);
|
||||
rec.inobt.ir_u.sp.ir_count = irec->ir_count;
|
||||
rec.inobt.ir_u.sp.ir_freecount = irec->ir_freecount;
|
||||
@@ -78,7 +78,7 @@ xfs_inobt_btrec_to_irec(
|
||||
struct xfs_inobt_rec_incore *irec)
|
||||
{
|
||||
irec->ir_startino = be32_to_cpu(rec->inobt.ir_startino);
|
||||
if (xfs_sb_version_hassparseinodes(&mp->m_sb)) {
|
||||
if (xfs_has_sparseinodes(mp)) {
|
||||
irec->ir_holemask = be16_to_cpu(rec->inobt.ir_u.sp.ir_holemask);
|
||||
irec->ir_count = rec->inobt.ir_u.sp.ir_count;
|
||||
irec->ir_freecount = rec->inobt.ir_u.sp.ir_freecount;
|
||||
@@ -2478,7 +2478,7 @@ xfs_agi_verify(
|
||||
struct xfs_agi *agi = bp->b_addr;
|
||||
int i;
|
||||
|
||||
if (xfs_sb_version_hascrc(&mp->m_sb)) {
|
||||
if (xfs_has_crc(mp)) {
|
||||
if (!uuid_equal(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid))
|
||||
return __this_address;
|
||||
if (!xfs_log_check_lsn(mp, be64_to_cpu(agi->agi_lsn)))
|
||||
@@ -2497,7 +2497,7 @@ xfs_agi_verify(
|
||||
be32_to_cpu(agi->agi_level) > M_IGEO(mp)->inobt_maxlevels)
|
||||
return __this_address;
|
||||
|
||||
if (xfs_sb_version_hasfinobt(&mp->m_sb) &&
|
||||
if (xfs_has_finobt(mp) &&
|
||||
(be32_to_cpu(agi->agi_free_level) < 1 ||
|
||||
be32_to_cpu(agi->agi_free_level) > M_IGEO(mp)->inobt_maxlevels))
|
||||
return __this_address;
|
||||
@@ -2528,7 +2528,7 @@ xfs_agi_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_AGI_CRC_OFF))
|
||||
xfs_verifier_error(bp, -EFSBADCRC, __this_address);
|
||||
else {
|
||||
@@ -2553,7 +2553,7 @@ xfs_agi_write_verify(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!xfs_sb_version_hascrc(&mp->m_sb))
|
||||
if (!xfs_has_crc(mp))
|
||||
return;
|
||||
|
||||
if (bip)
|
||||
@@ -2953,7 +2953,7 @@ xfs_ialloc_check_shrink(
|
||||
int has;
|
||||
int error;
|
||||
|
||||
if (!xfs_sb_version_hassparseinodes(&mp->m_sb))
|
||||
if (!xfs_has_sparseinodes(mp))
|
||||
return 0;
|
||||
|
||||
pag = xfs_perag_get(mp, agno);
|
||||
|
||||
Reference in New Issue
Block a user