提交 5f4623da 编写于 作者: D Dave Chinner 提交者: Long Li

xfs: replace xfs_sb_version checks with feature flag checks

mainline inclusion
from mainline-v5.14-rc4
commit 38c26bfd
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4KIAO
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=38c26bfd90e1999650d5ef40f90d721f05916643

--------------------------------

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: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NDarrick J. Wong <djwong@kernel.org>
Signed-off-by: NDarrick J. Wong <djwong@kernel.org>

Conflicts:
	fs/xfs/libxfs/xfs_btree.c
	fs/xfs/libxfs/xfs_ialloc.c
	fs/xfs/xfs_buf_item.c
	fs/xfs/xfs_fsmap.c
	fs/xfs/xfs_fsops.c
	fs/xfs/xfs_inode.c
	fs/xfs/xfs_ioctl.c
	fs/xfs/xfs_itable.c
	fs/xfs/xfs_log.c
	fs/xfs/xfs_refcount_item.c
	fs/xfs/xfs_rmap_item.c
	fs/xfs/xfs_rtalloc.c
Signed-off-by: NLong Li <leo.lilong@huawei.com>
上级 fd78d2ab
...@@ -195,7 +195,7 @@ xfs_rmaproot_init( ...@@ -195,7 +195,7 @@ xfs_rmaproot_init(
rrec->rm_offset = 0; rrec->rm_offset = 0;
/* account for refc btree root */ /* account for refc btree root */
if (xfs_sb_version_hasreflink(&mp->m_sb)) { if (xfs_has_reflink(mp)) {
rrec = XFS_RMAP_REC_ADDR(block, 5); rrec = XFS_RMAP_REC_ADDR(block, 5);
rrec->rm_startblock = cpu_to_be32(xfs_refc_block(mp)); rrec->rm_startblock = cpu_to_be32(xfs_refc_block(mp));
rrec->rm_blockcount = cpu_to_be32(1); rrec->rm_blockcount = cpu_to_be32(1);
...@@ -254,7 +254,7 @@ xfs_agfblock_init( ...@@ -254,7 +254,7 @@ xfs_agfblock_init(
agf->agf_roots[XFS_BTNUM_CNTi] = cpu_to_be32(XFS_CNT_BLOCK(mp)); agf->agf_roots[XFS_BTNUM_CNTi] = cpu_to_be32(XFS_CNT_BLOCK(mp));
agf->agf_levels[XFS_BTNUM_BNOi] = cpu_to_be32(1); agf->agf_levels[XFS_BTNUM_BNOi] = cpu_to_be32(1);
agf->agf_levels[XFS_BTNUM_CNTi] = cpu_to_be32(1); agf->agf_levels[XFS_BTNUM_CNTi] = cpu_to_be32(1);
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) { if (xfs_has_rmapbt(mp)) {
agf->agf_roots[XFS_BTNUM_RMAPi] = agf->agf_roots[XFS_BTNUM_RMAPi] =
cpu_to_be32(XFS_RMAP_BLOCK(mp)); cpu_to_be32(XFS_RMAP_BLOCK(mp));
agf->agf_levels[XFS_BTNUM_RMAPi] = cpu_to_be32(1); agf->agf_levels[XFS_BTNUM_RMAPi] = cpu_to_be32(1);
...@@ -267,9 +267,9 @@ xfs_agfblock_init( ...@@ -267,9 +267,9 @@ xfs_agfblock_init(
tmpsize = id->agsize - mp->m_ag_prealloc_blocks; tmpsize = id->agsize - mp->m_ag_prealloc_blocks;
agf->agf_freeblks = cpu_to_be32(tmpsize); agf->agf_freeblks = cpu_to_be32(tmpsize);
agf->agf_longest = cpu_to_be32(tmpsize); agf->agf_longest = cpu_to_be32(tmpsize);
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_has_crc(mp))
uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid); uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid);
if (xfs_sb_version_hasreflink(&mp->m_sb)) { if (xfs_has_reflink(mp)) {
agf->agf_refcount_root = cpu_to_be32( agf->agf_refcount_root = cpu_to_be32(
xfs_refc_block(mp)); xfs_refc_block(mp));
agf->agf_refcount_level = cpu_to_be32(1); agf->agf_refcount_level = cpu_to_be32(1);
...@@ -295,7 +295,7 @@ xfs_agflblock_init( ...@@ -295,7 +295,7 @@ xfs_agflblock_init(
__be32 *agfl_bno; __be32 *agfl_bno;
int bucket; int bucket;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
agfl->agfl_magicnum = cpu_to_be32(XFS_AGFL_MAGIC); agfl->agfl_magicnum = cpu_to_be32(XFS_AGFL_MAGIC);
agfl->agfl_seqno = cpu_to_be32(id->agno); agfl->agfl_seqno = cpu_to_be32(id->agno);
uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid); uuid_copy(&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid);
...@@ -325,9 +325,9 @@ xfs_agiblock_init( ...@@ -325,9 +325,9 @@ xfs_agiblock_init(
agi->agi_freecount = 0; agi->agi_freecount = 0;
agi->agi_newino = cpu_to_be32(NULLAGINO); agi->agi_newino = cpu_to_be32(NULLAGINO);
agi->agi_dirino = cpu_to_be32(NULLAGINO); agi->agi_dirino = cpu_to_be32(NULLAGINO);
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_has_crc(mp))
uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid); uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid);
if (xfs_sb_version_hasfinobt(&mp->m_sb)) { if (xfs_has_finobt(mp)) {
agi->agi_free_root = cpu_to_be32(XFS_FIBT_BLOCK(mp)); agi->agi_free_root = cpu_to_be32(XFS_FIBT_BLOCK(mp));
agi->agi_free_level = cpu_to_be32(1); agi->agi_free_level = cpu_to_be32(1);
} }
...@@ -445,14 +445,14 @@ xfs_ag_init_headers( ...@@ -445,14 +445,14 @@ xfs_ag_init_headers(
.ops = &xfs_finobt_buf_ops, .ops = &xfs_finobt_buf_ops,
.work = &xfs_btroot_init, .work = &xfs_btroot_init,
.type = XFS_BTNUM_FINO, .type = XFS_BTNUM_FINO,
.need_init = xfs_sb_version_hasfinobt(&mp->m_sb) .need_init = xfs_has_finobt(mp)
}, },
{ /* RMAP root block */ { /* RMAP root block */
.daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_RMAP_BLOCK(mp)), .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_RMAP_BLOCK(mp)),
.numblks = BTOBB(mp->m_sb.sb_blocksize), .numblks = BTOBB(mp->m_sb.sb_blocksize),
.ops = &xfs_rmapbt_buf_ops, .ops = &xfs_rmapbt_buf_ops,
.work = &xfs_rmaproot_init, .work = &xfs_rmaproot_init,
.need_init = xfs_sb_version_hasrmapbt(&mp->m_sb) .need_init = xfs_has_rmapbt(mp)
}, },
{ /* REFC root block */ { /* REFC root block */
.daddr = XFS_AGB_TO_DADDR(mp, id->agno, xfs_refc_block(mp)), .daddr = XFS_AGB_TO_DADDR(mp, id->agno, xfs_refc_block(mp)),
...@@ -460,7 +460,7 @@ xfs_ag_init_headers( ...@@ -460,7 +460,7 @@ xfs_ag_init_headers(
.ops = &xfs_refcountbt_buf_ops, .ops = &xfs_refcountbt_buf_ops,
.work = &xfs_btroot_init, .work = &xfs_btroot_init,
.type = XFS_BTNUM_REFC, .type = XFS_BTNUM_REFC,
.need_init = xfs_sb_version_hasreflink(&mp->m_sb) .need_init = xfs_has_reflink(mp)
}, },
{ /* NULL terminating block */ { /* NULL terminating block */
.daddr = XFS_BUF_DADDR_NULL, .daddr = XFS_BUF_DADDR_NULL,
......
...@@ -51,7 +51,7 @@ xfs_agfl_size( ...@@ -51,7 +51,7 @@ xfs_agfl_size(
{ {
unsigned int size = mp->m_sb.sb_sectsize; unsigned int size = mp->m_sb.sb_sectsize;
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_has_crc(mp))
size -= sizeof(struct xfs_agfl); size -= sizeof(struct xfs_agfl);
return size / sizeof(xfs_agblock_t); return size / sizeof(xfs_agblock_t);
...@@ -61,9 +61,9 @@ unsigned int ...@@ -61,9 +61,9 @@ unsigned int
xfs_refc_block( xfs_refc_block(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) if (xfs_has_rmapbt(mp))
return XFS_RMAP_BLOCK(mp) + 1; return XFS_RMAP_BLOCK(mp) + 1;
if (xfs_sb_version_hasfinobt(&mp->m_sb)) if (xfs_has_finobt(mp))
return XFS_FIBT_BLOCK(mp) + 1; return XFS_FIBT_BLOCK(mp) + 1;
return XFS_IBT_BLOCK(mp) + 1; return XFS_IBT_BLOCK(mp) + 1;
} }
...@@ -72,11 +72,11 @@ xfs_extlen_t ...@@ -72,11 +72,11 @@ xfs_extlen_t
xfs_prealloc_blocks( xfs_prealloc_blocks(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
if (xfs_sb_version_hasreflink(&mp->m_sb)) if (xfs_has_reflink(mp))
return xfs_refc_block(mp) + 1; return xfs_refc_block(mp) + 1;
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) if (xfs_has_rmapbt(mp))
return XFS_RMAP_BLOCK(mp) + 1; return XFS_RMAP_BLOCK(mp) + 1;
if (xfs_sb_version_hasfinobt(&mp->m_sb)) if (xfs_has_finobt(mp))
return XFS_FIBT_BLOCK(mp) + 1; return XFS_FIBT_BLOCK(mp) + 1;
return XFS_IBT_BLOCK(mp) + 1; return XFS_IBT_BLOCK(mp) + 1;
} }
...@@ -126,11 +126,11 @@ xfs_alloc_ag_max_usable( ...@@ -126,11 +126,11 @@ xfs_alloc_ag_max_usable(
blocks = XFS_BB_TO_FSB(mp, XFS_FSS_TO_BB(mp, 4)); /* ag headers */ blocks = XFS_BB_TO_FSB(mp, XFS_FSS_TO_BB(mp, 4)); /* ag headers */
blocks += XFS_ALLOC_AGFL_RESERVE; blocks += XFS_ALLOC_AGFL_RESERVE;
blocks += 3; /* AGF, AGI btree root blocks */ blocks += 3; /* AGF, AGI btree root blocks */
if (xfs_sb_version_hasfinobt(&mp->m_sb)) if (xfs_has_finobt(mp))
blocks++; /* finobt root block */ blocks++; /* finobt root block */
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) if (xfs_has_rmapbt(mp))
blocks++; /* rmap root block */ blocks++; /* rmap root block */
if (xfs_sb_version_hasreflink(&mp->m_sb)) if (xfs_has_reflink(mp))
blocks++; /* refcount root block */ blocks++; /* refcount root block */
return mp->m_sb.sb_agblocks - blocks; return mp->m_sb.sb_agblocks - blocks;
...@@ -598,7 +598,7 @@ xfs_agfl_verify( ...@@ -598,7 +598,7 @@ xfs_agfl_verify(
* AGFL is what the AGF says is active. We can't get to the AGF, so we * AGFL is what the AGF says is active. We can't get to the AGF, so we
* can't verify just those entries are valid. * can't verify just those entries are valid.
*/ */
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return NULL; return NULL;
if (!xfs_verify_magic(bp, agfl->agfl_magicnum)) if (!xfs_verify_magic(bp, agfl->agfl_magicnum))
...@@ -638,7 +638,7 @@ xfs_agfl_read_verify( ...@@ -638,7 +638,7 @@ xfs_agfl_read_verify(
* AGFL is what the AGF says is active. We can't get to the AGF, so we * AGFL is what the AGF says is active. We can't get to the AGF, so we
* can't verify just those entries are valid. * can't verify just those entries are valid.
*/ */
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
if (!xfs_buf_verify_cksum(bp, XFS_AGFL_CRC_OFF)) if (!xfs_buf_verify_cksum(bp, XFS_AGFL_CRC_OFF))
...@@ -659,7 +659,7 @@ xfs_agfl_write_verify( ...@@ -659,7 +659,7 @@ xfs_agfl_write_verify(
xfs_failaddr_t fa; xfs_failaddr_t fa;
/* no verification of non-crc AGFLs */ /* no verification of non-crc AGFLs */
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
fa = xfs_agfl_verify(bp); fa = xfs_agfl_verify(bp);
...@@ -2373,7 +2373,7 @@ xfs_agfl_needs_reset( ...@@ -2373,7 +2373,7 @@ xfs_agfl_needs_reset(
int active; int active;
/* no agfl header on v4 supers */ /* no agfl header on v4 supers */
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return false; return false;
/* /*
...@@ -2827,7 +2827,7 @@ xfs_agf_verify( ...@@ -2827,7 +2827,7 @@ xfs_agf_verify(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
struct xfs_agf *agf = bp->b_addr; struct xfs_agf *agf = bp->b_addr;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
if (!uuid_equal(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid)) if (!uuid_equal(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid))
return __this_address; return __this_address;
if (!xfs_log_check_lsn(mp, be64_to_cpu(agf->agf_lsn))) if (!xfs_log_check_lsn(mp, be64_to_cpu(agf->agf_lsn)))
...@@ -2857,7 +2857,7 @@ xfs_agf_verify( ...@@ -2857,7 +2857,7 @@ xfs_agf_verify(
be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) > XFS_BTREE_MAXLEVELS) be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) > XFS_BTREE_MAXLEVELS)
return __this_address; return __this_address;
if (xfs_sb_version_hasrmapbt(&mp->m_sb) && if (xfs_has_rmapbt(mp) &&
(be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) < 1 || (be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) < 1 ||
be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) > XFS_BTREE_MAXLEVELS)) be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) > XFS_BTREE_MAXLEVELS))
return __this_address; return __this_address;
...@@ -2900,7 +2900,7 @@ xfs_agf_read_verify( ...@@ -2900,7 +2900,7 @@ xfs_agf_read_verify(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
xfs_failaddr_t fa; xfs_failaddr_t fa;
if (xfs_sb_version_hascrc(&mp->m_sb) && if (xfs_has_crc(mp) &&
!xfs_buf_verify_cksum(bp, XFS_AGF_CRC_OFF)) !xfs_buf_verify_cksum(bp, XFS_AGF_CRC_OFF))
xfs_verifier_error(bp, -EFSBADCRC, __this_address); xfs_verifier_error(bp, -EFSBADCRC, __this_address);
else { else {
...@@ -2925,7 +2925,7 @@ xfs_agf_write_verify( ...@@ -2925,7 +2925,7 @@ xfs_agf_write_verify(
return; return;
} }
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
if (bip) if (bip)
......
...@@ -499,7 +499,7 @@ xfs_allocbt_init_common( ...@@ -499,7 +499,7 @@ xfs_allocbt_init_common(
cur->bc_ag.agno = agno; cur->bc_ag.agno = agno;
cur->bc_ag.abt.active = false; cur->bc_ag.abt.active = false;
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_has_crc(mp))
cur->bc_flags |= XFS_BTREE_CRC_BLOCKS; cur->bc_flags |= XFS_BTREE_CRC_BLOCKS;
return cur; return cur;
......
...@@ -19,7 +19,7 @@ struct xbtree_afakeroot; ...@@ -19,7 +19,7 @@ struct xbtree_afakeroot;
* Btree block header size depends on a superblock flag. * Btree block header size depends on a superblock flag.
*/ */
#define XFS_ALLOC_BLOCK_LEN(mp) \ #define XFS_ALLOC_BLOCK_LEN(mp) \
(xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ (xfs_has_crc(((mp))) ? \
XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN) XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)
/* /*
......
...@@ -383,7 +383,7 @@ xfs_attr3_leaf_write_verify( ...@@ -383,7 +383,7 @@ xfs_attr3_leaf_write_verify(
return; return;
} }
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
if (bip) if (bip)
...@@ -405,7 +405,7 @@ xfs_attr3_leaf_read_verify( ...@@ -405,7 +405,7 @@ xfs_attr3_leaf_read_verify(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
xfs_failaddr_t fa; xfs_failaddr_t fa;
if (xfs_sb_version_hascrc(&mp->m_sb) && if (xfs_has_crc(mp) &&
!xfs_buf_verify_cksum(bp, XFS_ATTR3_LEAF_CRC_OFF)) !xfs_buf_verify_cksum(bp, XFS_ATTR3_LEAF_CRC_OFF))
xfs_verifier_error(bp, -EFSBADCRC, __this_address); xfs_verifier_error(bp, -EFSBADCRC, __this_address);
else { else {
...@@ -627,10 +627,10 @@ STATIC void ...@@ -627,10 +627,10 @@ STATIC void
xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp) xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp)
{ {
if ((mp->m_flags & XFS_MOUNT_ATTR2) && if ((mp->m_flags & XFS_MOUNT_ATTR2) &&
!(xfs_sb_version_hasattr2(&mp->m_sb))) { !(xfs_has_attr2(mp))) {
spin_lock(&mp->m_sb_lock); spin_lock(&mp->m_sb_lock);
if (!xfs_sb_version_hasattr2(&mp->m_sb)) { if (!xfs_has_attr2(mp)) {
xfs_sb_version_addattr2(&mp->m_sb); xfs_add_attr2(mp);
spin_unlock(&mp->m_sb_lock); spin_unlock(&mp->m_sb_lock);
xfs_log_sb(tp); xfs_log_sb(tp);
} else } else
...@@ -1202,7 +1202,7 @@ xfs_attr3_leaf_to_node( ...@@ -1202,7 +1202,7 @@ xfs_attr3_leaf_to_node(
xfs_trans_buf_set_type(args->trans, bp2, XFS_BLFT_ATTR_LEAF_BUF); xfs_trans_buf_set_type(args->trans, bp2, XFS_BLFT_ATTR_LEAF_BUF);
bp2->b_ops = bp1->b_ops; bp2->b_ops = bp1->b_ops;
memcpy(bp2->b_addr, bp1->b_addr, args->geo->blksize); memcpy(bp2->b_addr, bp1->b_addr, args->geo->blksize);
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
struct xfs_da3_blkinfo *hdr3 = bp2->b_addr; struct xfs_da3_blkinfo *hdr3 = bp2->b_addr;
hdr3->blkno = cpu_to_be64(bp2->b_bn); hdr3->blkno = cpu_to_be64(bp2->b_bn);
} }
...@@ -1267,7 +1267,7 @@ xfs_attr3_leaf_create( ...@@ -1267,7 +1267,7 @@ xfs_attr3_leaf_create(
memset(&ichdr, 0, sizeof(ichdr)); memset(&ichdr, 0, sizeof(ichdr));
ichdr.firstused = args->geo->blksize; ichdr.firstused = args->geo->blksize;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
struct xfs_da3_blkinfo *hdr3 = bp->b_addr; struct xfs_da3_blkinfo *hdr3 = bp->b_addr;
ichdr.magic = XFS_ATTR3_LEAF_MAGIC; ichdr.magic = XFS_ATTR3_LEAF_MAGIC;
......
...@@ -51,7 +51,7 @@ xfs_attr3_rmt_blocks( ...@@ -51,7 +51,7 @@ xfs_attr3_rmt_blocks(
struct xfs_mount *mp, struct xfs_mount *mp,
int attrlen) int attrlen)
{ {
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
int buflen = XFS_ATTR3_RMT_BUF_SPACE(mp, mp->m_sb.sb_blocksize); int buflen = XFS_ATTR3_RMT_BUF_SPACE(mp, mp->m_sb.sb_blocksize);
return (attrlen + buflen - 1) / buflen; return (attrlen + buflen - 1) / buflen;
} }
...@@ -126,7 +126,7 @@ __xfs_attr3_rmt_read_verify( ...@@ -126,7 +126,7 @@ __xfs_attr3_rmt_read_verify(
int blksize = mp->m_attr_geo->blksize; int blksize = mp->m_attr_geo->blksize;
/* no verification of non-crc buffers */ /* no verification of non-crc buffers */
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return 0; return 0;
ptr = bp->b_addr; ptr = bp->b_addr;
...@@ -191,7 +191,7 @@ xfs_attr3_rmt_write_verify( ...@@ -191,7 +191,7 @@ xfs_attr3_rmt_write_verify(
xfs_daddr_t bno; xfs_daddr_t bno;
/* no verification of non-crc buffers */ /* no verification of non-crc buffers */
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
ptr = bp->b_addr; ptr = bp->b_addr;
...@@ -246,7 +246,7 @@ xfs_attr3_rmt_hdr_set( ...@@ -246,7 +246,7 @@ xfs_attr3_rmt_hdr_set(
{ {
struct xfs_attr3_rmt_hdr *rmt = ptr; struct xfs_attr3_rmt_hdr *rmt = ptr;
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return 0; return 0;
rmt->rm_magic = cpu_to_be32(XFS_ATTR3_RMT_MAGIC); rmt->rm_magic = cpu_to_be32(XFS_ATTR3_RMT_MAGIC);
...@@ -296,7 +296,7 @@ xfs_attr_rmtval_copyout( ...@@ -296,7 +296,7 @@ xfs_attr_rmtval_copyout(
byte_cnt = min(*valuelen, byte_cnt); byte_cnt = min(*valuelen, byte_cnt);
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
if (xfs_attr3_rmt_hdr_ok(src, ino, *offset, if (xfs_attr3_rmt_hdr_ok(src, ino, *offset,
byte_cnt, bno)) { byte_cnt, bno)) {
xfs_alert(mp, xfs_alert(mp,
......
...@@ -1113,17 +1113,17 @@ xfs_bmap_add_attrfork( ...@@ -1113,17 +1113,17 @@ xfs_bmap_add_attrfork(
xfs_trans_log_inode(tp, ip, logflags); xfs_trans_log_inode(tp, ip, logflags);
if (error) if (error)
goto trans_cancel; goto trans_cancel;
if (!xfs_sb_version_hasattr(&mp->m_sb) || if (!xfs_has_attr(mp) ||
(!xfs_sb_version_hasattr2(&mp->m_sb) && version == 2)) { (!xfs_has_attr2(mp) && version == 2)) {
bool log_sb = false; bool log_sb = false;
spin_lock(&mp->m_sb_lock); spin_lock(&mp->m_sb_lock);
if (!xfs_sb_version_hasattr(&mp->m_sb)) { if (!xfs_has_attr(mp)) {
xfs_sb_version_addattr(&mp->m_sb); xfs_add_attr(mp);
log_sb = true; log_sb = true;
} }
if (!xfs_sb_version_hasattr2(&mp->m_sb) && version == 2) { if (!xfs_has_attr2(mp) && version == 2) {
xfs_sb_version_addattr2(&mp->m_sb); xfs_add_attr2(mp);
log_sb = true; log_sb = true;
} }
spin_unlock(&mp->m_sb_lock); spin_unlock(&mp->m_sb_lock);
......
...@@ -136,7 +136,7 @@ xfs_bmbt_to_bmdr( ...@@ -136,7 +136,7 @@ xfs_bmbt_to_bmdr(
xfs_bmbt_key_t *tkp; xfs_bmbt_key_t *tkp;
__be64 *tpp; __be64 *tpp;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
ASSERT(rblock->bb_magic == cpu_to_be32(XFS_BMAP_CRC_MAGIC)); ASSERT(rblock->bb_magic == cpu_to_be32(XFS_BMAP_CRC_MAGIC));
ASSERT(uuid_equal(&rblock->bb_u.l.bb_uuid, ASSERT(uuid_equal(&rblock->bb_u.l.bb_uuid,
&mp->m_sb.sb_meta_uuid)); &mp->m_sb.sb_meta_uuid));
...@@ -563,7 +563,7 @@ xfs_bmbt_init_cursor( ...@@ -563,7 +563,7 @@ xfs_bmbt_init_cursor(
cur->bc_ops = &xfs_bmbt_ops; cur->bc_ops = &xfs_bmbt_ops;
cur->bc_flags = XFS_BTREE_LONG_PTRS | XFS_BTREE_ROOT_IN_INODE; cur->bc_flags = XFS_BTREE_LONG_PTRS | XFS_BTREE_ROOT_IN_INODE;
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_has_crc(mp))
cur->bc_flags |= XFS_BTREE_CRC_BLOCKS; cur->bc_flags |= XFS_BTREE_CRC_BLOCKS;
cur->bc_ino.forksize = xfs_inode_fork_size(ip, whichfork); cur->bc_ino.forksize = xfs_inode_fork_size(ip, whichfork);
......
...@@ -16,7 +16,7 @@ struct xfs_trans; ...@@ -16,7 +16,7 @@ struct xfs_trans;
* Btree block header size depends on a superblock flag. * Btree block header size depends on a superblock flag.
*/ */
#define XFS_BMBT_BLOCK_LEN(mp) \ #define XFS_BMBT_BLOCK_LEN(mp) \
(xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ (xfs_has_crc(((mp))) ? \
XFS_BTREE_LBLOCK_CRC_LEN : XFS_BTREE_LBLOCK_LEN) XFS_BTREE_LBLOCK_CRC_LEN : XFS_BTREE_LBLOCK_LEN)
#define XFS_BMBT_REC_ADDR(mp, block, index) \ #define XFS_BMBT_REC_ADDR(mp, block, index) \
......
...@@ -128,7 +128,7 @@ __xfs_btree_check_lblock( ...@@ -128,7 +128,7 @@ __xfs_btree_check_lblock(
{ {
struct xfs_mount *mp = cur->bc_mp; struct xfs_mount *mp = cur->bc_mp;
xfs_btnum_t btnum = cur->bc_btnum; xfs_btnum_t btnum = cur->bc_btnum;
int crc = xfs_sb_version_hascrc(&mp->m_sb); int crc = xfs_has_crc(mp);
xfs_failaddr_t fa; xfs_failaddr_t fa;
xfs_fsblock_t fsb = NULLFSBLOCK; xfs_fsblock_t fsb = NULLFSBLOCK;
...@@ -195,7 +195,7 @@ __xfs_btree_check_sblock( ...@@ -195,7 +195,7 @@ __xfs_btree_check_sblock(
{ {
struct xfs_mount *mp = cur->bc_mp; struct xfs_mount *mp = cur->bc_mp;
xfs_btnum_t btnum = cur->bc_btnum; xfs_btnum_t btnum = cur->bc_btnum;
int crc = xfs_sb_version_hascrc(&mp->m_sb); int crc = xfs_has_crc(mp);
xfs_failaddr_t fa; xfs_failaddr_t fa;
xfs_agblock_t agbno = NULLAGBLOCK; xfs_agblock_t agbno = NULLAGBLOCK;
xfs_agnumber_t agno = NULLAGNUMBER; xfs_agnumber_t agno = NULLAGNUMBER;
...@@ -358,7 +358,7 @@ xfs_btree_lblock_verify_crc( ...@@ -358,7 +358,7 @@ xfs_btree_lblock_verify_crc(
struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.l.bb_lsn))) if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.l.bb_lsn)))
return false; return false;
return xfs_buf_verify_cksum(bp, XFS_BTREE_LBLOCK_CRC_OFF); return xfs_buf_verify_cksum(bp, XFS_BTREE_LBLOCK_CRC_OFF);
...@@ -396,7 +396,7 @@ xfs_btree_sblock_verify_crc( ...@@ -396,7 +396,7 @@ xfs_btree_sblock_verify_crc(
struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.s.bb_lsn))) if (!xfs_log_check_lsn(mp, be64_to_cpu(block->bb_u.s.bb_lsn)))
return false; return false;
return xfs_buf_verify_cksum(bp, XFS_BTREE_SBLOCK_CRC_OFF); return xfs_buf_verify_cksum(bp, XFS_BTREE_SBLOCK_CRC_OFF);
...@@ -1165,7 +1165,7 @@ xfs_btree_init_block_int( ...@@ -1165,7 +1165,7 @@ xfs_btree_init_block_int(
__u64 owner, __u64 owner,
unsigned int flags) unsigned int flags)
{ {
int crc = xfs_sb_version_hascrc(&mp->m_sb); int crc = xfs_has_crc(mp);
__u32 magic = xfs_btree_magic(crc, btnum); __u32 magic = xfs_btree_magic(crc, btnum);
buf->bb_magic = cpu_to_be32(magic); buf->bb_magic = cpu_to_be32(magic);
...@@ -4524,7 +4524,7 @@ xfs_btree_lblock_v5hdr_verify( ...@@ -4524,7 +4524,7 @@ xfs_btree_lblock_v5hdr_verify(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return __this_address; return __this_address;
if (!uuid_equal(&block->bb_u.l.bb_uuid, &mp->m_sb.sb_meta_uuid)) if (!uuid_equal(&block->bb_u.l.bb_uuid, &mp->m_sb.sb_meta_uuid))
return __this_address; return __this_address;
...@@ -4575,7 +4575,7 @@ xfs_btree_sblock_v5hdr_verify( ...@@ -4575,7 +4575,7 @@ xfs_btree_sblock_v5hdr_verify(
struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp); struct xfs_btree_block *block = XFS_BUF_TO_BLOCK(bp);
struct xfs_perag *pag = bp->b_pag; struct xfs_perag *pag = bp->b_pag;
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return __this_address; return __this_address;
if (!uuid_equal(&block->bb_u.s.bb_uuid, &mp->m_sb.sb_meta_uuid)) if (!uuid_equal(&block->bb_u.s.bb_uuid, &mp->m_sb.sb_meta_uuid))
return __this_address; return __this_address;
......
...@@ -253,7 +253,7 @@ xfs_da3_node_write_verify( ...@@ -253,7 +253,7 @@ xfs_da3_node_write_verify(
return; return;
} }
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
if (bip) if (bip)
...@@ -442,7 +442,7 @@ xfs_da3_node_create( ...@@ -442,7 +442,7 @@ xfs_da3_node_create(
xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DA_NODE_BUF); xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DA_NODE_BUF);
node = bp->b_addr; node = bp->b_addr;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
struct xfs_da3_node_hdr *hdr3 = bp->b_addr; struct xfs_da3_node_hdr *hdr3 = bp->b_addr;
memset(hdr3, 0, sizeof(struct xfs_da3_node_hdr)); memset(hdr3, 0, sizeof(struct xfs_da3_node_hdr));
......
...@@ -789,7 +789,7 @@ struct xfs_attr3_rmt_hdr { ...@@ -789,7 +789,7 @@ struct xfs_attr3_rmt_hdr {
#define XFS_ATTR3_RMT_CRC_OFF offsetof(struct xfs_attr3_rmt_hdr, rm_crc) #define XFS_ATTR3_RMT_CRC_OFF offsetof(struct xfs_attr3_rmt_hdr, rm_crc)
#define XFS_ATTR3_RMT_BUF_SPACE(mp, bufsize) \ #define XFS_ATTR3_RMT_BUF_SPACE(mp, bufsize) \
((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \ ((bufsize) - (xfs_has_crc((mp)) ? \
sizeof(struct xfs_attr3_rmt_hdr) : 0)) sizeof(struct xfs_attr3_rmt_hdr) : 0))
/* Number of bytes in a directory block. */ /* Number of bytes in a directory block. */
......
...@@ -71,7 +71,7 @@ xfs_dir3_block_read_verify( ...@@ -71,7 +71,7 @@ xfs_dir3_block_read_verify(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
xfs_failaddr_t fa; xfs_failaddr_t fa;
if (xfs_sb_version_hascrc(&mp->m_sb) && if (xfs_has_crc(mp) &&
!xfs_buf_verify_cksum(bp, XFS_DIR3_DATA_CRC_OFF)) !xfs_buf_verify_cksum(bp, XFS_DIR3_DATA_CRC_OFF))
xfs_verifier_error(bp, -EFSBADCRC, __this_address); xfs_verifier_error(bp, -EFSBADCRC, __this_address);
else { else {
...@@ -96,7 +96,7 @@ xfs_dir3_block_write_verify( ...@@ -96,7 +96,7 @@ xfs_dir3_block_write_verify(
return; return;
} }
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
if (bip) if (bip)
...@@ -171,7 +171,7 @@ xfs_dir3_block_init( ...@@ -171,7 +171,7 @@ xfs_dir3_block_init(
bp->b_ops = &xfs_dir3_block_buf_ops; bp->b_ops = &xfs_dir3_block_buf_ops;
xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DIR_BLOCK_BUF); xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DIR_BLOCK_BUF);
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
memset(hdr3, 0, sizeof(*hdr3)); memset(hdr3, 0, sizeof(*hdr3));
hdr3->magic = cpu_to_be32(XFS_DIR3_BLOCK_MAGIC); hdr3->magic = cpu_to_be32(XFS_DIR3_BLOCK_MAGIC);
hdr3->blkno = cpu_to_be64(bp->b_bn); hdr3->blkno = cpu_to_be64(bp->b_bn);
......
...@@ -343,7 +343,7 @@ xfs_dir3_data_read_verify( ...@@ -343,7 +343,7 @@ xfs_dir3_data_read_verify(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
xfs_failaddr_t fa; xfs_failaddr_t fa;
if (xfs_sb_version_hascrc(&mp->m_sb) && if (xfs_has_crc(mp) &&
!xfs_buf_verify_cksum(bp, XFS_DIR3_DATA_CRC_OFF)) !xfs_buf_verify_cksum(bp, XFS_DIR3_DATA_CRC_OFF))
xfs_verifier_error(bp, -EFSBADCRC, __this_address); xfs_verifier_error(bp, -EFSBADCRC, __this_address);
else { else {
...@@ -368,7 +368,7 @@ xfs_dir3_data_write_verify( ...@@ -368,7 +368,7 @@ xfs_dir3_data_write_verify(
return; return;
} }
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
if (bip) if (bip)
...@@ -717,7 +717,7 @@ xfs_dir3_data_init( ...@@ -717,7 +717,7 @@ xfs_dir3_data_init(
* Initialize the header. * Initialize the header.
*/ */
hdr = bp->b_addr; hdr = bp->b_addr;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr; struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
memset(hdr3, 0, sizeof(*hdr3)); memset(hdr3, 0, sizeof(*hdr3));
......
...@@ -205,7 +205,7 @@ xfs_dir3_leaf_read_verify( ...@@ -205,7 +205,7 @@ xfs_dir3_leaf_read_verify(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
xfs_failaddr_t fa; xfs_failaddr_t fa;
if (xfs_sb_version_hascrc(&mp->m_sb) && if (xfs_has_crc(mp) &&
!xfs_buf_verify_cksum(bp, XFS_DIR3_LEAF_CRC_OFF)) !xfs_buf_verify_cksum(bp, XFS_DIR3_LEAF_CRC_OFF))
xfs_verifier_error(bp, -EFSBADCRC, __this_address); xfs_verifier_error(bp, -EFSBADCRC, __this_address);
else { else {
...@@ -230,7 +230,7 @@ xfs_dir3_leaf_write_verify( ...@@ -230,7 +230,7 @@ xfs_dir3_leaf_write_verify(
return; return;
} }
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
if (bip) if (bip)
...@@ -304,7 +304,7 @@ xfs_dir3_leaf_init( ...@@ -304,7 +304,7 @@ xfs_dir3_leaf_init(
ASSERT(type == XFS_DIR2_LEAF1_MAGIC || type == XFS_DIR2_LEAFN_MAGIC); ASSERT(type == XFS_DIR2_LEAF1_MAGIC || type == XFS_DIR2_LEAFN_MAGIC);
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr; struct xfs_dir3_leaf_hdr *leaf3 = bp->b_addr;
memset(leaf3, 0, sizeof(*leaf3)); memset(leaf3, 0, sizeof(*leaf3));
......
...@@ -105,7 +105,7 @@ xfs_dir3_free_verify( ...@@ -105,7 +105,7 @@ xfs_dir3_free_verify(
if (!xfs_verify_magic(bp, hdr->magic)) if (!xfs_verify_magic(bp, hdr->magic))
return __this_address; 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; struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;
if (!uuid_equal(&hdr3->uuid, &mp->m_sb.sb_meta_uuid)) if (!uuid_equal(&hdr3->uuid, &mp->m_sb.sb_meta_uuid))
...@@ -128,7 +128,7 @@ xfs_dir3_free_read_verify( ...@@ -128,7 +128,7 @@ xfs_dir3_free_read_verify(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
xfs_failaddr_t fa; 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_buf_verify_cksum(bp, XFS_DIR3_FREE_CRC_OFF))
xfs_verifier_error(bp, -EFSBADCRC, __this_address); xfs_verifier_error(bp, -EFSBADCRC, __this_address);
else { else {
...@@ -153,7 +153,7 @@ xfs_dir3_free_write_verify( ...@@ -153,7 +153,7 @@ xfs_dir3_free_write_verify(
return; return;
} }
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
if (bip) if (bip)
...@@ -185,7 +185,7 @@ xfs_dir3_free_header_check( ...@@ -185,7 +185,7 @@ xfs_dir3_free_header_check(
firstdb = (xfs_dir2_da_to_db(mp->m_dir_geo, fbno) - firstdb = (xfs_dir2_da_to_db(mp->m_dir_geo, fbno) -
xfs_dir2_byte_to_db(mp->m_dir_geo, XFS_DIR2_FREE_OFFSET)) * xfs_dir2_byte_to_db(mp->m_dir_geo, XFS_DIR2_FREE_OFFSET)) *
maxbests; maxbests;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
struct xfs_dir3_free_hdr *hdr3 = bp->b_addr; struct xfs_dir3_free_hdr *hdr3 = bp->b_addr;
if (be32_to_cpu(hdr3->firstdb) != firstdb) if (be32_to_cpu(hdr3->firstdb) != firstdb)
...@@ -341,7 +341,7 @@ xfs_dir3_free_get_buf( ...@@ -341,7 +341,7 @@ xfs_dir3_free_get_buf(
memset(bp->b_addr, 0, sizeof(struct xfs_dir3_free_hdr)); memset(bp->b_addr, 0, sizeof(struct xfs_dir3_free_hdr));
memset(&hdr, 0, sizeof(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; struct xfs_dir3_free_hdr *hdr3 = bp->b_addr;
hdr.magic = XFS_DIR3_FREE_MAGIC; hdr.magic = XFS_DIR3_FREE_MAGIC;
......
...@@ -192,7 +192,7 @@ xfs_dir2_block_sfsize( ...@@ -192,7 +192,7 @@ xfs_dir2_block_sfsize(
* if there is a filetype field, add the extra byte to the namelen * if there is a filetype field, add the extra byte to the namelen
* for each entry that we see. * for each entry that we see.
*/ */
has_ftype = xfs_sb_version_hasftype(&mp->m_sb) ? 1 : 0; has_ftype = xfs_has_ftype(mp) ? 1 : 0;
count = i8count = namelen = 0; count = i8count = namelen = 0;
btp = xfs_dir2_block_tail_p(geo, hdr); btp = xfs_dir2_block_tail_p(geo, hdr);
......
...@@ -106,7 +106,7 @@ xfs_dqblk_verify( ...@@ -106,7 +106,7 @@ xfs_dqblk_verify(
struct xfs_dqblk *dqb, struct xfs_dqblk *dqb,
xfs_dqid_t id) /* used only during quotacheck */ xfs_dqid_t id) /* used only during quotacheck */
{ {
if (xfs_sb_version_hascrc(&mp->m_sb) && if (xfs_has_crc(mp) &&
!uuid_equal(&dqb->dd_uuid, &mp->m_sb.sb_meta_uuid)) !uuid_equal(&dqb->dd_uuid, &mp->m_sb.sb_meta_uuid))
return __this_address; return __this_address;
...@@ -134,7 +134,7 @@ xfs_dqblk_repair( ...@@ -134,7 +134,7 @@ xfs_dqblk_repair(
dqb->dd_diskdq.d_type = type; dqb->dd_diskdq.d_type = type;
dqb->dd_diskdq.d_id = cpu_to_be32(id); dqb->dd_diskdq.d_id = cpu_to_be32(id);
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
uuid_copy(&dqb->dd_uuid, &mp->m_sb.sb_meta_uuid); uuid_copy(&dqb->dd_uuid, &mp->m_sb.sb_meta_uuid);
xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk), xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk),
XFS_DQUOT_CRC_OFF); XFS_DQUOT_CRC_OFF);
...@@ -151,7 +151,7 @@ xfs_dquot_buf_verify_crc( ...@@ -151,7 +151,7 @@ xfs_dquot_buf_verify_crc(
int ndquots; int ndquots;
int i; int i;
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return true; return true;
/* /*
......
...@@ -398,7 +398,7 @@ static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp) ...@@ -398,7 +398,7 @@ static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp)
sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT; sbp->sb_features2 |= XFS_SB_VERSION2_ATTR2BIT;
} }
static inline bool xfs_sb_version_hasprojid32bit(struct xfs_sb *sbp) static inline bool xfs_sb_version_hasprojid32(struct xfs_sb *sbp)
{ {
return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) || return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
(xfs_sb_version_hasmorebits(sbp) && (xfs_sb_version_hasmorebits(sbp) &&
...@@ -511,7 +511,7 @@ static inline bool xfs_dinode_good_version(struct xfs_sb *sbp, ...@@ -511,7 +511,7 @@ static inline bool xfs_dinode_good_version(struct xfs_sb *sbp,
return version == 1 || version == 2; return version == 1 || version == 2;
} }
static inline bool xfs_sb_version_has_pquotino(struct xfs_sb *sbp) static inline bool xfs_sb_version_haspquotino(struct xfs_sb *sbp)
{ {
return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5; return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5;
} }
...@@ -1441,7 +1441,7 @@ struct xfs_dsymlink_hdr { ...@@ -1441,7 +1441,7 @@ struct xfs_dsymlink_hdr {
#define XFS_SYMLINK_MAPS 3 #define XFS_SYMLINK_MAPS 3
#define XFS_SYMLINK_BUF_SPACE(mp, bufsize) \ #define XFS_SYMLINK_BUF_SPACE(mp, bufsize) \
((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \ ((bufsize) - (xfs_has_crc((mp)) ? \
sizeof(struct xfs_dsymlink_hdr) : 0)) sizeof(struct xfs_dsymlink_hdr) : 0))
...@@ -1673,7 +1673,7 @@ struct xfs_rmap_key { ...@@ -1673,7 +1673,7 @@ struct xfs_rmap_key {
typedef __be32 xfs_rmap_ptr_t; typedef __be32 xfs_rmap_ptr_t;
#define XFS_RMAP_BLOCK(mp) \ #define XFS_RMAP_BLOCK(mp) \
(xfs_sb_version_hasfinobt(&((mp)->m_sb)) ? \ (xfs_has_finobt(((mp))) ? \
XFS_FIBT_BLOCK(mp) + 1 : \ XFS_FIBT_BLOCK(mp) + 1 : \
XFS_IBT_BLOCK(mp) + 1) XFS_IBT_BLOCK(mp) + 1)
...@@ -1905,7 +1905,7 @@ struct xfs_acl { ...@@ -1905,7 +1905,7 @@ struct xfs_acl {
* limited only by the maximum size of the xattr that stores the information. * limited only by the maximum size of the xattr that stores the information.
*/ */
#define XFS_ACL_MAX_ENTRIES(mp) \ #define XFS_ACL_MAX_ENTRIES(mp) \
(xfs_sb_version_hascrc(&mp->m_sb) \ (xfs_has_crc(mp) \
? (XFS_XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \ ? (XFS_XATTR_SIZE_MAX - sizeof(struct xfs_acl)) / \
sizeof(struct xfs_acl_entry) \ sizeof(struct xfs_acl_entry) \
: 25) : 25)
......
...@@ -58,7 +58,7 @@ xfs_inobt_update( ...@@ -58,7 +58,7 @@ xfs_inobt_update(
union xfs_btree_rec rec; union xfs_btree_rec rec;
rec.inobt.ir_startino = cpu_to_be32(irec->ir_startino); 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_holemask = cpu_to_be16(irec->ir_holemask);
rec.inobt.ir_u.sp.ir_count = irec->ir_count; rec.inobt.ir_u.sp.ir_count = irec->ir_count;
rec.inobt.ir_u.sp.ir_freecount = irec->ir_freecount; rec.inobt.ir_u.sp.ir_freecount = irec->ir_freecount;
...@@ -78,7 +78,7 @@ xfs_inobt_btrec_to_irec( ...@@ -78,7 +78,7 @@ xfs_inobt_btrec_to_irec(
struct xfs_inobt_rec_incore *irec) struct xfs_inobt_rec_incore *irec)
{ {
irec->ir_startino = be32_to_cpu(rec->inobt.ir_startino); 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_holemask = be16_to_cpu(rec->inobt.ir_u.sp.ir_holemask);
irec->ir_count = rec->inobt.ir_u.sp.ir_count; irec->ir_count = rec->inobt.ir_u.sp.ir_count;
irec->ir_freecount = rec->inobt.ir_u.sp.ir_freecount; irec->ir_freecount = rec->inobt.ir_u.sp.ir_freecount;
...@@ -2513,7 +2513,7 @@ xfs_agi_verify( ...@@ -2513,7 +2513,7 @@ xfs_agi_verify(
struct xfs_agi *agi = bp->b_addr; struct xfs_agi *agi = bp->b_addr;
int i; 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)) if (!uuid_equal(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid))
return __this_address; return __this_address;
if (!xfs_log_check_lsn(mp, be64_to_cpu(agi->agi_lsn))) if (!xfs_log_check_lsn(mp, be64_to_cpu(agi->agi_lsn)))
...@@ -2532,7 +2532,7 @@ xfs_agi_verify( ...@@ -2532,7 +2532,7 @@ xfs_agi_verify(
be32_to_cpu(agi->agi_level) > XFS_BTREE_MAXLEVELS) be32_to_cpu(agi->agi_level) > XFS_BTREE_MAXLEVELS)
return __this_address; 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) < 1 ||
be32_to_cpu(agi->agi_free_level) > XFS_BTREE_MAXLEVELS)) be32_to_cpu(agi->agi_free_level) > XFS_BTREE_MAXLEVELS))
return __this_address; return __this_address;
...@@ -2563,7 +2563,7 @@ xfs_agi_read_verify( ...@@ -2563,7 +2563,7 @@ xfs_agi_read_verify(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
xfs_failaddr_t fa; 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_buf_verify_cksum(bp, XFS_AGI_CRC_OFF))
xfs_verifier_error(bp, -EFSBADCRC, __this_address); xfs_verifier_error(bp, -EFSBADCRC, __this_address);
else { else {
...@@ -2588,7 +2588,7 @@ xfs_agi_write_verify( ...@@ -2588,7 +2588,7 @@ xfs_agi_write_verify(
return; return;
} }
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
if (bip) if (bip)
......
...@@ -212,7 +212,7 @@ xfs_inobt_init_rec_from_cur( ...@@ -212,7 +212,7 @@ xfs_inobt_init_rec_from_cur(
union xfs_btree_rec *rec) union xfs_btree_rec *rec)
{ {
rec->inobt.ir_startino = cpu_to_be32(cur->bc_rec.i.ir_startino); rec->inobt.ir_startino = cpu_to_be32(cur->bc_rec.i.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 = rec->inobt.ir_u.sp.ir_holemask =
cpu_to_be16(cur->bc_rec.i.ir_holemask); cpu_to_be16(cur->bc_rec.i.ir_holemask);
rec->inobt.ir_u.sp.ir_count = cur->bc_rec.i.ir_count; rec->inobt.ir_u.sp.ir_count = cur->bc_rec.i.ir_count;
...@@ -446,7 +446,7 @@ xfs_inobt_init_common( ...@@ -446,7 +446,7 @@ xfs_inobt_init_common(
cur->bc_blocklog = mp->m_sb.sb_blocklog; cur->bc_blocklog = mp->m_sb.sb_blocklog;
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_has_crc(mp))
cur->bc_flags |= XFS_BTREE_CRC_BLOCKS; cur->bc_flags |= XFS_BTREE_CRC_BLOCKS;
cur->bc_ag.agno = agno; cur->bc_ag.agno = agno;
...@@ -740,7 +740,7 @@ xfs_finobt_calc_reserves( ...@@ -740,7 +740,7 @@ xfs_finobt_calc_reserves(
xfs_extlen_t tree_len = 0; xfs_extlen_t tree_len = 0;
int error; int error;
if (!xfs_sb_version_hasfinobt(&mp->m_sb)) if (!xfs_has_finobt(mp))
return 0; return 0;
if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) if (xfs_sb_version_hasinobtcounts(&mp->m_sb))
......
...@@ -18,7 +18,7 @@ struct xfs_mount; ...@@ -18,7 +18,7 @@ struct xfs_mount;
* Btree block header size depends on a superblock flag. * Btree block header size depends on a superblock flag.
*/ */
#define XFS_INOBT_BLOCK_LEN(mp) \ #define XFS_INOBT_BLOCK_LEN(mp) \
(xfs_sb_version_hascrc(&((mp)->m_sb)) ? \ (xfs_has_crc(((mp))) ? \
XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN) XFS_BTREE_SBLOCK_CRC_LEN : XFS_BTREE_SBLOCK_LEN)
/* /*
......
...@@ -552,7 +552,7 @@ xfs_dinode_verify( ...@@ -552,7 +552,7 @@ xfs_dinode_verify(
/* don't allow reflink/cowextsize if we don't have reflink */ /* don't allow reflink/cowextsize if we don't have reflink */
if ((flags2 & (XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE)) && if ((flags2 & (XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE)) &&
!xfs_sb_version_hasreflink(&mp->m_sb)) !xfs_has_reflink(mp))
return __this_address; return __this_address;
/* only regular files get reflink */ /* only regular files get reflink */
...@@ -587,7 +587,7 @@ xfs_dinode_calc_crc( ...@@ -587,7 +587,7 @@ xfs_dinode_calc_crc(
if (dip->di_version < 3) if (dip->di_version < 3)
return; return;
ASSERT(xfs_sb_version_hascrc(&mp->m_sb)); ASSERT(xfs_has_crc(mp));
crc = xfs_start_cksum_update((char *)dip, mp->m_sb.sb_inodesize, crc = xfs_start_cksum_update((char *)dip, mp->m_sb.sb_inodesize,
XFS_DINODE_CRC_OFF); XFS_DINODE_CRC_OFF);
dip->di_crc = xfs_end_cksum(crc); dip->di_crc = xfs_end_cksum(crc);
...@@ -672,7 +672,7 @@ xfs_inode_validate_cowextsize( ...@@ -672,7 +672,7 @@ xfs_inode_validate_cowextsize(
hint_flag = (flags2 & XFS_DIFLAG2_COWEXTSIZE); hint_flag = (flags2 & XFS_DIFLAG2_COWEXTSIZE);
cowextsize_bytes = XFS_FSB_TO_B(mp, cowextsize); cowextsize_bytes = XFS_FSB_TO_B(mp, cowextsize);
if (hint_flag && !xfs_sb_version_hasreflink(&mp->m_sb)) if (hint_flag && !xfs_has_reflink(mp))
return __this_address; return __this_address;
if (hint_flag && !(S_ISDIR(mode) || S_ISREG(mode))) if (hint_flag && !(S_ISDIR(mode) || S_ISREG(mode)))
......
...@@ -41,10 +41,10 @@ typedef uint32_t xlog_tid_t; ...@@ -41,10 +41,10 @@ typedef uint32_t xlog_tid_t;
#define XFS_MIN_LOG_FACTOR 3 #define XFS_MIN_LOG_FACTOR 3
#define XLOG_REC_SHIFT(log) \ #define XLOG_REC_SHIFT(log) \
BTOBB(1 << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ BTOBB(1 << (xfs_has_logv2(log->l_mp) ? \
XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT)) XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
#define XLOG_TOTAL_REC_SHIFT(log) \ #define XLOG_TOTAL_REC_SHIFT(log) \
BTOBB(XLOG_MAX_ICLOGS << (xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? \ BTOBB(XLOG_MAX_ICLOGS << (xfs_has_logv2(log->l_mp) ? \
XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT)) XLOG_MAX_RECORD_BSHIFT : XLOG_BIG_RECORD_BSHIFT))
/* get lsn fields */ /* get lsn fields */
......
...@@ -92,7 +92,7 @@ xfs_log_calc_minimum_size( ...@@ -92,7 +92,7 @@ xfs_log_calc_minimum_size(
if (tres.tr_logcount > 1) if (tres.tr_logcount > 1)
max_logres *= tres.tr_logcount; max_logres *= tres.tr_logcount;
if (xfs_sb_version_haslogv2(&mp->m_sb) && mp->m_sb.sb_logsunit > 1) if (xfs_has_logv2(mp) && mp->m_sb.sb_logsunit > 1)
lsunit = BTOBB(mp->m_sb.sb_logsunit); lsunit = BTOBB(mp->m_sb.sb_logsunit);
/* /*
......
...@@ -209,7 +209,7 @@ xfs_refcountbt_verify( ...@@ -209,7 +209,7 @@ xfs_refcountbt_verify(
if (!xfs_verify_magic(bp, block->bb_magic)) if (!xfs_verify_magic(bp, block->bb_magic))
return __this_address; return __this_address;
if (!xfs_sb_version_hasreflink(&mp->m_sb)) if (!xfs_has_reflink(mp))
return __this_address; return __this_address;
fa = xfs_btree_sblock_v5hdr_verify(bp); fa = xfs_btree_sblock_v5hdr_verify(bp);
if (fa) if (fa)
...@@ -460,7 +460,7 @@ xfs_refcountbt_calc_reserves( ...@@ -460,7 +460,7 @@ xfs_refcountbt_calc_reserves(
xfs_extlen_t tree_len; xfs_extlen_t tree_len;
int error; int error;
if (!xfs_sb_version_hasreflink(&mp->m_sb)) if (!xfs_has_reflink(mp))
return 0; return 0;
......
...@@ -703,7 +703,7 @@ xfs_rmap_free( ...@@ -703,7 +703,7 @@ xfs_rmap_free(
struct xfs_btree_cur *cur; struct xfs_btree_cur *cur;
int error; int error;
if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) if (!xfs_has_rmapbt(mp))
return 0; return 0;
cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno); cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
...@@ -957,7 +957,7 @@ xfs_rmap_alloc( ...@@ -957,7 +957,7 @@ xfs_rmap_alloc(
struct xfs_btree_cur *cur; struct xfs_btree_cur *cur;
int error; int error;
if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) if (!xfs_has_rmapbt(mp))
return 0; return 0;
cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno); cur = xfs_rmapbt_init_cursor(mp, tp, agbp, agno);
...@@ -2461,7 +2461,7 @@ xfs_rmap_update_is_needed( ...@@ -2461,7 +2461,7 @@ xfs_rmap_update_is_needed(
struct xfs_mount *mp, struct xfs_mount *mp,
int whichfork) int whichfork)
{ {
return xfs_sb_version_hasrmapbt(&mp->m_sb) && whichfork != XFS_COW_FORK; return xfs_has_rmapbt(mp) && whichfork != XFS_COW_FORK;
} }
/* /*
......
...@@ -307,7 +307,7 @@ xfs_rmapbt_verify( ...@@ -307,7 +307,7 @@ xfs_rmapbt_verify(
if (!xfs_verify_magic(bp, block->bb_magic)) if (!xfs_verify_magic(bp, block->bb_magic))
return __this_address; return __this_address;
if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) if (!xfs_has_rmapbt(mp))
return __this_address; return __this_address;
fa = xfs_btree_sblock_v5hdr_verify(bp); fa = xfs_btree_sblock_v5hdr_verify(bp);
if (fa) if (fa)
...@@ -558,7 +558,7 @@ xfs_rmapbt_compute_maxlevels( ...@@ -558,7 +558,7 @@ xfs_rmapbt_compute_maxlevels(
* disallow reflinking when less than 10% of the per-AG metadata * disallow reflinking when less than 10% of the per-AG metadata
* block reservation since the fallback is a regular file copy. * block reservation since the fallback is a regular file copy.
*/ */
if (xfs_sb_version_hasreflink(&mp->m_sb)) if (xfs_has_reflink(mp))
mp->m_rmap_maxlevels = XFS_BTREE_MAXLEVELS; mp->m_rmap_maxlevels = XFS_BTREE_MAXLEVELS;
else else
mp->m_rmap_maxlevels = xfs_btree_compute_maxlevels( mp->m_rmap_maxlevels = xfs_btree_compute_maxlevels(
...@@ -606,7 +606,7 @@ xfs_rmapbt_calc_reserves( ...@@ -606,7 +606,7 @@ xfs_rmapbt_calc_reserves(
xfs_extlen_t tree_len; xfs_extlen_t tree_len;
int error; int error;
if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) if (!xfs_has_rmapbt(mp))
return 0; return 0;
error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp); error = xfs_alloc_read_agf(mp, tp, agno, 0, &agbp);
......
...@@ -298,7 +298,7 @@ xfs_validate_sb_common( ...@@ -298,7 +298,7 @@ xfs_validate_sb_common(
return -EWRONGFS; return -EWRONGFS;
} }
if (xfs_sb_version_has_pquotino(sbp)) { if (xfs_sb_version_haspquotino(sbp)) {
if (sbp->sb_qflags & (XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD)) { if (sbp->sb_qflags & (XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD)) {
xfs_notice(mp, xfs_notice(mp,
"Version 5 of Super block has XFS_OQUOTA bits."); "Version 5 of Super block has XFS_OQUOTA bits.");
...@@ -440,7 +440,7 @@ xfs_validate_sb_common( ...@@ -440,7 +440,7 @@ xfs_validate_sb_common(
} }
if (xfs_sb_version_hascrc(&mp->m_sb) && if (xfs_sb_version_hascrc(sbp) &&
sbp->sb_blocksize < XFS_MIN_CRC_BLOCKSIZE) { sbp->sb_blocksize < XFS_MIN_CRC_BLOCKSIZE) {
xfs_notice(mp, "v5 SB sanity check failed"); xfs_notice(mp, "v5 SB sanity check failed");
return -EFSCORRUPTED; return -EFSCORRUPTED;
...@@ -489,7 +489,7 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp) ...@@ -489,7 +489,7 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp)
* We need to do these manipilations only if we are working * We need to do these manipilations only if we are working
* with an older version of on-disk superblock. * with an older version of on-disk superblock.
*/ */
if (xfs_sb_version_has_pquotino(sbp)) if (xfs_sb_version_haspquotino(sbp))
return; return;
if (sbp->sb_qflags & XFS_OQUOTA_ENFD) if (sbp->sb_qflags & XFS_OQUOTA_ENFD)
...@@ -607,7 +607,7 @@ xfs_sb_quota_to_disk( ...@@ -607,7 +607,7 @@ xfs_sb_quota_to_disk(
uint16_t qflags = from->sb_qflags; uint16_t qflags = from->sb_qflags;
to->sb_uquotino = cpu_to_be64(from->sb_uquotino); to->sb_uquotino = cpu_to_be64(from->sb_uquotino);
if (xfs_sb_version_has_pquotino(from)) { if (xfs_sb_version_haspquotino(from)) {
to->sb_qflags = cpu_to_be16(from->sb_qflags); to->sb_qflags = cpu_to_be16(from->sb_qflags);
to->sb_gquotino = cpu_to_be64(from->sb_gquotino); to->sb_gquotino = cpu_to_be64(from->sb_gquotino);
to->sb_pquotino = cpu_to_be64(from->sb_pquotino); to->sb_pquotino = cpu_to_be64(from->sb_pquotino);
...@@ -832,7 +832,7 @@ xfs_sb_write_verify( ...@@ -832,7 +832,7 @@ xfs_sb_write_verify(
if (error) if (error)
goto out_error; goto out_error;
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_sb_version_hascrc(&sb))
return; return;
if (bip) if (bip)
...@@ -1201,7 +1201,7 @@ xfs_fs_geometry( ...@@ -1201,7 +1201,7 @@ xfs_fs_geometry(
geo->flags |= XFS_FSOP_GEOM_FLAGS_LAZYSB; geo->flags |= XFS_FSOP_GEOM_FLAGS_LAZYSB;
if (xfs_sb_version_hasattr2(sbp)) if (xfs_sb_version_hasattr2(sbp))
geo->flags |= XFS_FSOP_GEOM_FLAGS_ATTR2; geo->flags |= XFS_FSOP_GEOM_FLAGS_ATTR2;
if (xfs_sb_version_hasprojid32bit(sbp)) if (xfs_sb_version_hasprojid32(sbp))
geo->flags |= XFS_FSOP_GEOM_FLAGS_PROJID32; geo->flags |= XFS_FSOP_GEOM_FLAGS_PROJID32;
if (xfs_sb_version_hascrc(sbp)) if (xfs_sb_version_hascrc(sbp))
geo->flags |= XFS_FSOP_GEOM_FLAGS_V5SB; geo->flags |= XFS_FSOP_GEOM_FLAGS_V5SB;
......
...@@ -42,7 +42,7 @@ xfs_symlink_hdr_set( ...@@ -42,7 +42,7 @@ xfs_symlink_hdr_set(
{ {
struct xfs_dsymlink_hdr *dsl = bp->b_addr; struct xfs_dsymlink_hdr *dsl = bp->b_addr;
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return 0; return 0;
memset(dsl, 0, sizeof(struct xfs_dsymlink_hdr)); memset(dsl, 0, sizeof(struct xfs_dsymlink_hdr));
...@@ -89,7 +89,7 @@ xfs_symlink_verify( ...@@ -89,7 +89,7 @@ xfs_symlink_verify(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
struct xfs_dsymlink_hdr *dsl = bp->b_addr; struct xfs_dsymlink_hdr *dsl = bp->b_addr;
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return __this_address; return __this_address;
if (!xfs_verify_magic(bp, dsl->sl_magic)) if (!xfs_verify_magic(bp, dsl->sl_magic))
return __this_address; return __this_address;
...@@ -116,7 +116,7 @@ xfs_symlink_read_verify( ...@@ -116,7 +116,7 @@ xfs_symlink_read_verify(
xfs_failaddr_t fa; xfs_failaddr_t fa;
/* no verification of non-crc buffers */ /* no verification of non-crc buffers */
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
if (!xfs_buf_verify_cksum(bp, XFS_SYMLINK_CRC_OFF)) if (!xfs_buf_verify_cksum(bp, XFS_SYMLINK_CRC_OFF))
...@@ -137,7 +137,7 @@ xfs_symlink_write_verify( ...@@ -137,7 +137,7 @@ xfs_symlink_write_verify(
xfs_failaddr_t fa; xfs_failaddr_t fa;
/* no verification of non-crc buffers */ /* no verification of non-crc buffers */
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
fa = xfs_symlink_verify(bp); fa = xfs_symlink_verify(bp);
...@@ -173,7 +173,7 @@ xfs_symlink_local_to_remote( ...@@ -173,7 +173,7 @@ xfs_symlink_local_to_remote(
xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF); xfs_trans_buf_set_type(tp, bp, XFS_BLFT_SYMLINK_BUF);
if (!xfs_sb_version_hascrc(&mp->m_sb)) { if (!xfs_has_crc(mp)) {
bp->b_ops = NULL; bp->b_ops = NULL;
memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes); memcpy(bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes);
xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1); xfs_trans_log_buf(tp, bp, 0, ifp->if_bytes - 1);
......
...@@ -71,9 +71,9 @@ xfs_allocfree_log_count( ...@@ -71,9 +71,9 @@ xfs_allocfree_log_count(
uint blocks; uint blocks;
blocks = num_ops * 2 * (2 * mp->m_ag_maxlevels - 1); blocks = num_ops * 2 * (2 * mp->m_ag_maxlevels - 1);
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) if (xfs_has_rmapbt(mp))
blocks += num_ops * (2 * mp->m_rmap_maxlevels - 1); blocks += num_ops * (2 * mp->m_rmap_maxlevels - 1);
if (xfs_sb_version_hasreflink(&mp->m_sb)) if (xfs_has_reflink(mp))
blocks += num_ops * (2 * mp->m_refc_maxlevels - 1); blocks += num_ops * (2 * mp->m_refc_maxlevels - 1);
return blocks; return blocks;
...@@ -155,7 +155,7 @@ STATIC uint ...@@ -155,7 +155,7 @@ STATIC uint
xfs_calc_finobt_res( xfs_calc_finobt_res(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
if (!xfs_sb_version_hasfinobt(&mp->m_sb)) if (!xfs_has_finobt(mp))
return 0; return 0;
return xfs_calc_inobt_res(mp); return xfs_calc_inobt_res(mp);
...@@ -819,14 +819,14 @@ xfs_trans_resv_calc( ...@@ -819,14 +819,14 @@ xfs_trans_resv_calc(
* require a permanent reservation on space. * require a permanent reservation on space.
*/ */
resp->tr_write.tr_logres = xfs_calc_write_reservation(mp); resp->tr_write.tr_logres = xfs_calc_write_reservation(mp);
if (xfs_sb_version_hasreflink(&mp->m_sb)) if (xfs_has_reflink(mp))
resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT_REFLINK; resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT_REFLINK;
else else
resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT; resp->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT;
resp->tr_write.tr_logflags |= XFS_TRANS_PERM_LOG_RES; resp->tr_write.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
resp->tr_itruncate.tr_logres = xfs_calc_itruncate_reservation(mp); resp->tr_itruncate.tr_logres = xfs_calc_itruncate_reservation(mp);
if (xfs_sb_version_hasreflink(&mp->m_sb)) if (xfs_has_reflink(mp))
resp->tr_itruncate.tr_logcount = resp->tr_itruncate.tr_logcount =
XFS_ITRUNCATE_LOG_COUNT_REFLINK; XFS_ITRUNCATE_LOG_COUNT_REFLINK;
else else
...@@ -887,7 +887,7 @@ xfs_trans_resv_calc( ...@@ -887,7 +887,7 @@ xfs_trans_resv_calc(
resp->tr_growrtalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES; resp->tr_growrtalloc.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
resp->tr_qm_dqalloc.tr_logres = xfs_calc_qm_dqalloc_reservation(mp); resp->tr_qm_dqalloc.tr_logres = xfs_calc_qm_dqalloc_reservation(mp);
if (xfs_sb_version_hasreflink(&mp->m_sb)) if (xfs_has_reflink(mp))
resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT_REFLINK; resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT_REFLINK;
else else
resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT; resp->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT;
......
...@@ -145,7 +145,7 @@ xfs_internal_inum( ...@@ -145,7 +145,7 @@ xfs_internal_inum(
xfs_ino_t ino) xfs_ino_t ino)
{ {
return ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino || return ino == mp->m_sb.sb_rbmino || ino == mp->m_sb.sb_rsumino ||
(xfs_sb_version_hasquota(&mp->m_sb) && (xfs_has_quota(mp) &&
xfs_is_quota_inode(&mp->m_sb, ino)); xfs_is_quota_inode(&mp->m_sb, ino));
} }
......
...@@ -272,7 +272,7 @@ xchk_superblock( ...@@ -272,7 +272,7 @@ xchk_superblock(
(cpu_to_be32(mp->m_sb.sb_features2) & features_mask)) (cpu_to_be32(mp->m_sb.sb_features2) & features_mask))
xchk_block_set_corrupt(sc, bp); xchk_block_set_corrupt(sc, bp);
if (!xfs_sb_version_hascrc(&mp->m_sb)) { if (!xfs_has_crc(mp)) {
/* all v5 fields must be zero */ /* all v5 fields must be zero */
if (memchr_inv(&sb->sb_features_compat, 0, if (memchr_inv(&sb->sb_features_compat, 0,
sizeof(struct xfs_dsb) - sizeof(struct xfs_dsb) -
...@@ -323,7 +323,7 @@ xchk_superblock( ...@@ -323,7 +323,7 @@ xchk_superblock(
/* Don't care about sb_lsn */ /* Don't care about sb_lsn */
} }
if (xfs_sb_version_hasmetauuid(&mp->m_sb)) { if (xfs_has_metauuid(mp)) {
/* The metadata UUID must be the same for all supers */ /* The metadata UUID must be the same for all supers */
if (!uuid_equal(&sb->sb_meta_uuid, &mp->m_sb.sb_meta_uuid)) if (!uuid_equal(&sb->sb_meta_uuid, &mp->m_sb.sb_meta_uuid))
xchk_block_set_corrupt(sc, bp); xchk_block_set_corrupt(sc, bp);
...@@ -437,7 +437,7 @@ xchk_agf_xref_btreeblks( ...@@ -437,7 +437,7 @@ xchk_agf_xref_btreeblks(
* No rmap cursor; we can't xref if we have the rmapbt feature. * No rmap cursor; we can't xref if we have the rmapbt feature.
* We also can't do it if we're missing the free space btree cursors. * We also can't do it if we're missing the free space btree cursors.
*/ */
if ((xfs_sb_version_hasrmapbt(&mp->m_sb) && !sc->sa.rmap_cur) || if ((xfs_has_rmapbt(mp) && !sc->sa.rmap_cur) ||
!sc->sa.bno_cur || !sc->sa.cnt_cur) !sc->sa.bno_cur || !sc->sa.cnt_cur)
return; return;
...@@ -554,7 +554,7 @@ xchk_agf( ...@@ -554,7 +554,7 @@ xchk_agf(
if (level <= 0 || level > XFS_BTREE_MAXLEVELS) if (level <= 0 || level > XFS_BTREE_MAXLEVELS)
xchk_block_set_corrupt(sc, sc->sa.agf_bp); xchk_block_set_corrupt(sc, sc->sa.agf_bp);
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) { if (xfs_has_rmapbt(mp)) {
agbno = be32_to_cpu(agf->agf_roots[XFS_BTNUM_RMAP]); agbno = be32_to_cpu(agf->agf_roots[XFS_BTNUM_RMAP]);
if (!xfs_verify_agbno(mp, agno, agbno)) if (!xfs_verify_agbno(mp, agno, agbno))
xchk_block_set_corrupt(sc, sc->sa.agf_bp); xchk_block_set_corrupt(sc, sc->sa.agf_bp);
...@@ -564,7 +564,7 @@ xchk_agf( ...@@ -564,7 +564,7 @@ xchk_agf(
xchk_block_set_corrupt(sc, sc->sa.agf_bp); xchk_block_set_corrupt(sc, sc->sa.agf_bp);
} }
if (xfs_sb_version_hasreflink(&mp->m_sb)) { if (xfs_has_reflink(mp)) {
agbno = be32_to_cpu(agf->agf_refcount_root); agbno = be32_to_cpu(agf->agf_refcount_root);
if (!xfs_verify_agbno(mp, agno, agbno)) if (!xfs_verify_agbno(mp, agno, agbno))
xchk_block_set_corrupt(sc, sc->sa.agf_bp); xchk_block_set_corrupt(sc, sc->sa.agf_bp);
...@@ -886,7 +886,7 @@ xchk_agi( ...@@ -886,7 +886,7 @@ xchk_agi(
if (level <= 0 || level > XFS_BTREE_MAXLEVELS) if (level <= 0 || level > XFS_BTREE_MAXLEVELS)
xchk_block_set_corrupt(sc, sc->sa.agi_bp); xchk_block_set_corrupt(sc, sc->sa.agi_bp);
if (xfs_sb_version_hasfinobt(&mp->m_sb)) { if (xfs_has_finobt(mp)) {
agbno = be32_to_cpu(agi->agi_free_root); agbno = be32_to_cpu(agi->agi_free_root);
if (!xfs_verify_agbno(mp, agno, agbno)) if (!xfs_verify_agbno(mp, agno, agbno))
xchk_block_set_corrupt(sc, sc->sa.agi_bp); xchk_block_set_corrupt(sc, sc->sa.agi_bp);
......
...@@ -163,7 +163,7 @@ xrep_agf_find_btrees( ...@@ -163,7 +163,7 @@ xrep_agf_find_btrees(
return -EFSCORRUPTED; return -EFSCORRUPTED;
/* We must find the refcountbt root if that feature is enabled. */ /* We must find the refcountbt root if that feature is enabled. */
if (xfs_sb_version_hasreflink(&sc->mp->m_sb) && if (xfs_has_reflink(sc->mp) &&
!xrep_check_btree_root(sc, &fab[XREP_AGF_REFCOUNTBT])) !xrep_check_btree_root(sc, &fab[XREP_AGF_REFCOUNTBT]))
return -EFSCORRUPTED; return -EFSCORRUPTED;
...@@ -192,7 +192,7 @@ xrep_agf_init_header( ...@@ -192,7 +192,7 @@ xrep_agf_init_header(
agf->agf_flfirst = old_agf->agf_flfirst; agf->agf_flfirst = old_agf->agf_flfirst;
agf->agf_fllast = old_agf->agf_fllast; agf->agf_fllast = old_agf->agf_fllast;
agf->agf_flcount = old_agf->agf_flcount; agf->agf_flcount = old_agf->agf_flcount;
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_has_crc(mp))
uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid); uuid_copy(&agf->agf_uuid, &mp->m_sb.sb_meta_uuid);
/* Mark the incore AGF data stale until we're done fixing things. */ /* Mark the incore AGF data stale until we're done fixing things. */
...@@ -222,7 +222,7 @@ xrep_agf_set_roots( ...@@ -222,7 +222,7 @@ xrep_agf_set_roots(
agf->agf_levels[XFS_BTNUM_RMAPi] = agf->agf_levels[XFS_BTNUM_RMAPi] =
cpu_to_be32(fab[XREP_AGF_RMAPBT].height); cpu_to_be32(fab[XREP_AGF_RMAPBT].height);
if (xfs_sb_version_hasreflink(&sc->mp->m_sb)) { if (xfs_has_reflink(sc->mp)) {
agf->agf_refcount_root = agf->agf_refcount_root =
cpu_to_be32(fab[XREP_AGF_REFCOUNTBT].root); cpu_to_be32(fab[XREP_AGF_REFCOUNTBT].root);
agf->agf_refcount_level = agf->agf_refcount_level =
...@@ -279,7 +279,7 @@ xrep_agf_calc_from_btrees( ...@@ -279,7 +279,7 @@ xrep_agf_calc_from_btrees(
agf->agf_btreeblks = cpu_to_be32(btreeblks); agf->agf_btreeblks = cpu_to_be32(btreeblks);
/* Update the AGF counters from the refcountbt. */ /* Update the AGF counters from the refcountbt. */
if (xfs_sb_version_hasreflink(&mp->m_sb)) { if (xfs_has_reflink(mp)) {
cur = xfs_refcountbt_init_cursor(mp, sc->tp, agf_bp, cur = xfs_refcountbt_init_cursor(mp, sc->tp, agf_bp,
sc->sa.agno); sc->sa.agno);
error = xfs_btree_count_blocks(cur, &blocks); error = xfs_btree_count_blocks(cur, &blocks);
...@@ -362,7 +362,7 @@ xrep_agf( ...@@ -362,7 +362,7 @@ xrep_agf(
int error; int error;
/* We require the rmapbt to rebuild anything. */ /* We require the rmapbt to rebuild anything. */
if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) if (!xfs_has_rmapbt(mp))
return -EOPNOTSUPP; return -EOPNOTSUPP;
xchk_perag_get(sc->mp, &sc->sa); xchk_perag_get(sc->mp, &sc->sa);
...@@ -637,7 +637,7 @@ xrep_agfl( ...@@ -637,7 +637,7 @@ xrep_agfl(
int error; int error;
/* We require the rmapbt to rebuild anything. */ /* We require the rmapbt to rebuild anything. */
if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) if (!xfs_has_rmapbt(mp))
return -EOPNOTSUPP; return -EOPNOTSUPP;
xchk_perag_get(sc->mp, &sc->sa); xchk_perag_get(sc->mp, &sc->sa);
...@@ -736,7 +736,7 @@ xrep_agi_find_btrees( ...@@ -736,7 +736,7 @@ xrep_agi_find_btrees(
return -EFSCORRUPTED; return -EFSCORRUPTED;
/* We must find the finobt root if that feature is enabled. */ /* We must find the finobt root if that feature is enabled. */
if (xfs_sb_version_hasfinobt(&mp->m_sb) && if (xfs_has_finobt(mp) &&
!xrep_check_btree_root(sc, &fab[XREP_AGI_FINOBT])) !xrep_check_btree_root(sc, &fab[XREP_AGI_FINOBT]))
return -EFSCORRUPTED; return -EFSCORRUPTED;
...@@ -764,7 +764,7 @@ xrep_agi_init_header( ...@@ -764,7 +764,7 @@ xrep_agi_init_header(
agi->agi_length = cpu_to_be32(xfs_ag_block_count(mp, sc->sa.agno)); agi->agi_length = cpu_to_be32(xfs_ag_block_count(mp, sc->sa.agno));
agi->agi_newino = cpu_to_be32(NULLAGINO); agi->agi_newino = cpu_to_be32(NULLAGINO);
agi->agi_dirino = cpu_to_be32(NULLAGINO); agi->agi_dirino = cpu_to_be32(NULLAGINO);
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_has_crc(mp))
uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid); uuid_copy(&agi->agi_uuid, &mp->m_sb.sb_meta_uuid);
/* We don't know how to fix the unlinked list yet. */ /* We don't know how to fix the unlinked list yet. */
...@@ -786,7 +786,7 @@ xrep_agi_set_roots( ...@@ -786,7 +786,7 @@ xrep_agi_set_roots(
agi->agi_root = cpu_to_be32(fab[XREP_AGI_INOBT].root); agi->agi_root = cpu_to_be32(fab[XREP_AGI_INOBT].root);
agi->agi_level = cpu_to_be32(fab[XREP_AGI_INOBT].height); agi->agi_level = cpu_to_be32(fab[XREP_AGI_INOBT].height);
if (xfs_sb_version_hasfinobt(&sc->mp->m_sb)) { if (xfs_has_finobt(sc->mp)) {
agi->agi_free_root = cpu_to_be32(fab[XREP_AGI_FINOBT].root); agi->agi_free_root = cpu_to_be32(fab[XREP_AGI_FINOBT].root);
agi->agi_free_level = cpu_to_be32(fab[XREP_AGI_FINOBT].height); agi->agi_free_level = cpu_to_be32(fab[XREP_AGI_FINOBT].height);
} }
...@@ -894,7 +894,7 @@ xrep_agi( ...@@ -894,7 +894,7 @@ xrep_agi(
int error; int error;
/* We require the rmapbt to rebuild anything. */ /* We require the rmapbt to rebuild anything. */
if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) if (!xfs_has_rmapbt(mp))
return -EOPNOTSUPP; return -EOPNOTSUPP;
xchk_perag_get(sc->mp, &sc->sa); xchk_perag_get(sc->mp, &sc->sa);
......
...@@ -337,7 +337,7 @@ xchk_xattr_block( ...@@ -337,7 +337,7 @@ xchk_xattr_block(
bitmap_zero(usedmap, mp->m_attr_geo->blksize); bitmap_zero(usedmap, mp->m_attr_geo->blksize);
/* Check all the padding. */ /* Check all the padding. */
if (xfs_sb_version_hascrc(&ds->sc->mp->m_sb)) { if (xfs_has_crc(ds->sc->mp)) {
struct xfs_attr3_leafblock *leaf = bp->b_addr; struct xfs_attr3_leafblock *leaf = bp->b_addr;
if (leaf->hdr.pad1 != 0 || leaf->hdr.pad2 != 0 || if (leaf->hdr.pad1 != 0 || leaf->hdr.pad2 != 0 ||
......
...@@ -406,7 +406,7 @@ xchk_bmapbt_rec( ...@@ -406,7 +406,7 @@ xchk_bmapbt_rec(
* Check the owners of the btree blocks up to the level below * Check the owners of the btree blocks up to the level below
* the root since the verifiers don't do that. * the root since the verifiers don't do that.
*/ */
if (xfs_sb_version_hascrc(&bs->cur->bc_mp->m_sb) && if (xfs_has_crc(bs->cur->bc_mp) &&
bs->cur->bc_ptrs[0] == 1) { bs->cur->bc_ptrs[0] == 1) {
for (i = 0; i < bs->cur->bc_nlevels - 1; i++) { for (i = 0; i < bs->cur->bc_nlevels - 1; i++) {
block = xfs_btree_get_block(bs->cur, i, &bp); block = xfs_btree_get_block(bs->cur, i, &bp);
...@@ -592,7 +592,7 @@ xchk_bmap_check_rmaps( ...@@ -592,7 +592,7 @@ xchk_bmap_check_rmaps(
bool zero_size; bool zero_size;
int error; int error;
if (!xfs_sb_version_hasrmapbt(&sc->mp->m_sb) || if (!xfs_has_rmapbt(sc->mp) ||
whichfork == XFS_COW_FORK || whichfork == XFS_COW_FORK ||
(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT))
return 0; return 0;
......
...@@ -863,7 +863,7 @@ xchk_metadata_inode_forks( ...@@ -863,7 +863,7 @@ xchk_metadata_inode_forks(
return error; return error;
/* Look for incorrect shared blocks. */ /* Look for incorrect shared blocks. */
if (xfs_sb_version_hasreflink(&sc->mp->m_sb)) { if (xfs_has_reflink(sc->mp)) {
error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip, error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip,
&shared); &shared);
if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0, if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0,
......
...@@ -367,11 +367,11 @@ xchk_da_btree_block( ...@@ -367,11 +367,11 @@ xchk_da_btree_block(
pmaxrecs = &ds->maxrecs[level]; pmaxrecs = &ds->maxrecs[level];
/* We only started zeroing the header on v5 filesystems. */ /* We only started zeroing the header on v5 filesystems. */
if (xfs_sb_version_hascrc(&ds->sc->mp->m_sb) && hdr3->hdr.pad) if (xfs_has_crc(ds->sc->mp) && hdr3->hdr.pad)
xchk_da_set_corrupt(ds, level); xchk_da_set_corrupt(ds, level);
/* Check the owner. */ /* Check the owner. */
if (xfs_sb_version_hascrc(&ip->i_mount->m_sb)) { if (xfs_has_crc(ip->i_mount)) {
owner = be64_to_cpu(hdr3->owner); owner = be64_to_cpu(hdr3->owner);
if (owner != ip->i_ino) if (owner != ip->i_ino)
xchk_da_set_corrupt(ds, level); xchk_da_set_corrupt(ds, level);
......
...@@ -52,7 +52,7 @@ xchk_dir_check_ftype( ...@@ -52,7 +52,7 @@ xchk_dir_check_ftype(
int ino_dtype; int ino_dtype;
int error = 0; int error = 0;
if (!xfs_sb_version_hasftype(&mp->m_sb)) { if (!xfs_has_ftype(mp)) {
if (dtype != DT_UNKNOWN && dtype != DT_DIR) if (dtype != DT_UNKNOWN && dtype != DT_DIR)
xchk_fblock_set_corrupt(sdc->sc, XFS_DATA_FORK, xchk_fblock_set_corrupt(sdc->sc, XFS_DATA_FORK,
offset); offset);
...@@ -141,7 +141,7 @@ xchk_dir_actor( ...@@ -141,7 +141,7 @@ xchk_dir_actor(
if (!strncmp(".", name, namelen)) { if (!strncmp(".", name, namelen)) {
/* If this is "." then check that the inum matches the dir. */ /* If this is "." then check that the inum matches the dir. */
if (xfs_sb_version_hasftype(&mp->m_sb) && type != DT_DIR) if (xfs_has_ftype(mp) && type != DT_DIR)
xchk_fblock_set_corrupt(sdc->sc, XFS_DATA_FORK, xchk_fblock_set_corrupt(sdc->sc, XFS_DATA_FORK,
offset); offset);
checked_ftype = true; checked_ftype = true;
...@@ -153,7 +153,7 @@ xchk_dir_actor( ...@@ -153,7 +153,7 @@ xchk_dir_actor(
* If this is ".." in the root inode, check that the inum * If this is ".." in the root inode, check that the inum
* matches this dir. * matches this dir.
*/ */
if (xfs_sb_version_hasftype(&mp->m_sb) && type != DT_DIR) if (xfs_has_ftype(mp) && type != DT_DIR)
xchk_fblock_set_corrupt(sdc->sc, XFS_DATA_FORK, xchk_fblock_set_corrupt(sdc->sc, XFS_DATA_FORK,
offset); offset);
checked_ftype = true; checked_ftype = true;
...@@ -527,7 +527,7 @@ xchk_directory_leaf1_bestfree( ...@@ -527,7 +527,7 @@ xchk_directory_leaf1_bestfree(
bestcount = be32_to_cpu(ltp->bestcount); bestcount = be32_to_cpu(ltp->bestcount);
bestp = xfs_dir2_leaf_bests_p(ltp); bestp = xfs_dir2_leaf_bests_p(ltp);
if (xfs_sb_version_hascrc(&sc->mp->m_sb)) { if (xfs_has_crc(sc->mp)) {
struct xfs_dir3_leaf_hdr *hdr3 = bp->b_addr; struct xfs_dir3_leaf_hdr *hdr3 = bp->b_addr;
if (hdr3->pad != cpu_to_be32(0)) if (hdr3->pad != cpu_to_be32(0))
...@@ -624,7 +624,7 @@ xchk_directory_free_bestfree( ...@@ -624,7 +624,7 @@ xchk_directory_free_bestfree(
return error; return error;
xchk_buffer_recheck(sc, bp); xchk_buffer_recheck(sc, bp);
if (xfs_sb_version_hascrc(&sc->mp->m_sb)) { if (xfs_has_crc(sc->mp)) {
struct xfs_dir3_free_hdr *hdr3 = bp->b_addr; struct xfs_dir3_free_hdr *hdr3 = bp->b_addr;
if (hdr3->pad != cpu_to_be32(0)) if (hdr3->pad != cpu_to_be32(0))
......
...@@ -518,7 +518,7 @@ xchk_iallocbt_xref_rmap_btreeblks( ...@@ -518,7 +518,7 @@ xchk_iallocbt_xref_rmap_btreeblks(
int error; int error;
if (!sc->sa.ino_cur || !sc->sa.rmap_cur || if (!sc->sa.ino_cur || !sc->sa.rmap_cur ||
(xfs_sb_version_hasfinobt(&sc->mp->m_sb) && !sc->sa.fino_cur) || (xfs_has_finobt(sc->mp) && !sc->sa.fino_cur) ||
xchk_skip_xref(sc->sm)) xchk_skip_xref(sc->sm))
return; return;
......
...@@ -168,7 +168,7 @@ xchk_inode_flags2( ...@@ -168,7 +168,7 @@ xchk_inode_flags2(
/* reflink flag requires reflink feature */ /* reflink flag requires reflink feature */
if ((flags2 & XFS_DIFLAG2_REFLINK) && if ((flags2 & XFS_DIFLAG2_REFLINK) &&
!xfs_sb_version_hasreflink(&mp->m_sb)) !xfs_has_reflink(mp))
goto bad; goto bad;
/* cowextsize flag is checked w.r.t. mode separately */ /* cowextsize flag is checked w.r.t. mode separately */
...@@ -265,7 +265,7 @@ xchk_dinode( ...@@ -265,7 +265,7 @@ xchk_dinode(
xchk_ino_set_corrupt(sc, ino); xchk_ino_set_corrupt(sc, ino);
if (dip->di_projid_hi != 0 && if (dip->di_projid_hi != 0 &&
!xfs_sb_version_hasprojid32bit(&mp->m_sb)) !xfs_has_projid32(mp))
xchk_ino_set_corrupt(sc, ino); xchk_ino_set_corrupt(sc, ino);
break; break;
default: default:
...@@ -548,7 +548,7 @@ xchk_inode_check_reflink_iflag( ...@@ -548,7 +548,7 @@ xchk_inode_check_reflink_iflag(
bool has_shared; bool has_shared;
int error; int error;
if (!xfs_sb_version_hasreflink(&mp->m_sb)) if (!xfs_has_reflink(mp))
return; return;
error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip, error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip,
......
...@@ -244,19 +244,19 @@ xrep_calc_ag_resblks( ...@@ -244,19 +244,19 @@ xrep_calc_ag_resblks(
* bnobt/cntbt or inobt/finobt as pairs. * bnobt/cntbt or inobt/finobt as pairs.
*/ */
bnobt_sz = 2 * xfs_allocbt_calc_size(mp, freelen); bnobt_sz = 2 * xfs_allocbt_calc_size(mp, freelen);
if (xfs_sb_version_hassparseinodes(&mp->m_sb)) if (xfs_has_sparseinodes(mp))
inobt_sz = xfs_iallocbt_calc_size(mp, icount / inobt_sz = xfs_iallocbt_calc_size(mp, icount /
XFS_INODES_PER_HOLEMASK_BIT); XFS_INODES_PER_HOLEMASK_BIT);
else else
inobt_sz = xfs_iallocbt_calc_size(mp, icount / inobt_sz = xfs_iallocbt_calc_size(mp, icount /
XFS_INODES_PER_CHUNK); XFS_INODES_PER_CHUNK);
if (xfs_sb_version_hasfinobt(&mp->m_sb)) if (xfs_has_finobt(mp))
inobt_sz *= 2; inobt_sz *= 2;
if (xfs_sb_version_hasreflink(&mp->m_sb)) if (xfs_has_reflink(mp))
refcbt_sz = xfs_refcountbt_calc_size(mp, usedlen); refcbt_sz = xfs_refcountbt_calc_size(mp, usedlen);
else else
refcbt_sz = 0; refcbt_sz = 0;
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) { if (xfs_has_rmapbt(mp)) {
/* /*
* Guess how many blocks we need to rebuild the rmapbt. * Guess how many blocks we need to rebuild the rmapbt.
* For non-reflink filesystems we can't have more records than * For non-reflink filesystems we can't have more records than
...@@ -265,7 +265,7 @@ xrep_calc_ag_resblks( ...@@ -265,7 +265,7 @@ xrep_calc_ag_resblks(
* many rmaps there could be in the AG, so we start off with * many rmaps there could be in the AG, so we start off with
* what we hope is an generous over-estimation. * what we hope is an generous over-estimation.
*/ */
if (xfs_sb_version_hasreflink(&mp->m_sb)) if (xfs_has_reflink(mp))
rmapbt_sz = xfs_rmapbt_calc_size(mp, rmapbt_sz = xfs_rmapbt_calc_size(mp,
(unsigned long long)aglen * 2); (unsigned long long)aglen * 2);
else else
...@@ -606,7 +606,7 @@ xrep_reap_extents( ...@@ -606,7 +606,7 @@ xrep_reap_extents(
xfs_fsblock_t fsbno; xfs_fsblock_t fsbno;
int error = 0; int error = 0;
ASSERT(xfs_sb_version_hasrmapbt(&sc->mp->m_sb)); ASSERT(xfs_has_rmapbt(sc->mp));
for_each_xbitmap_block(fsbno, bmr, n, bitmap) { for_each_xbitmap_block(fsbno, bmr, n, bitmap) {
ASSERT(sc->ip != NULL || ASSERT(sc->ip != NULL ||
......
...@@ -416,7 +416,7 @@ xchk_validate_inputs( ...@@ -416,7 +416,7 @@ xchk_validate_inputs(
*/ */
if (sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) { if (sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) {
error = -EOPNOTSUPP; error = -EOPNOTSUPP;
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
goto out; goto out;
error = -EROFS; error = -EROFS;
......
...@@ -1227,7 +1227,7 @@ xfs_swap_extents_check_format( ...@@ -1227,7 +1227,7 @@ xfs_swap_extents_check_format(
* If we have to use the (expensive) rmap swap method, we can * If we have to use the (expensive) rmap swap method, we can
* handle any number of extents and any format. * handle any number of extents and any format.
*/ */
if (xfs_sb_version_hasrmapbt(&ip->i_mount->m_sb)) if (xfs_has_rmapbt(ip->i_mount))
return 0; return 0;
/* /*
...@@ -1461,7 +1461,7 @@ xfs_swap_extent_forks( ...@@ -1461,7 +1461,7 @@ xfs_swap_extent_forks(
* event of a crash. Set the owner change log flags now and leave the * event of a crash. Set the owner change log flags now and leave the
* bmbt scan as the last step. * bmbt scan as the last step.
*/ */
if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) { if (xfs_has_v3inodes(ip->i_mount)) {
if (ip->i_df.if_format == XFS_DINODE_FMT_BTREE) if (ip->i_df.if_format == XFS_DINODE_FMT_BTREE)
(*target_log_flags) |= XFS_ILOG_DOWNER; (*target_log_flags) |= XFS_ILOG_DOWNER;
if (tip->i_df.if_format == XFS_DINODE_FMT_BTREE) if (tip->i_df.if_format == XFS_DINODE_FMT_BTREE)
...@@ -1498,7 +1498,7 @@ xfs_swap_extent_forks( ...@@ -1498,7 +1498,7 @@ xfs_swap_extent_forks(
(*src_log_flags) |= XFS_ILOG_DEXT; (*src_log_flags) |= XFS_ILOG_DEXT;
break; break;
case XFS_DINODE_FMT_BTREE: case XFS_DINODE_FMT_BTREE:
ASSERT(!xfs_sb_version_has_v3inode(&ip->i_mount->m_sb) || ASSERT(!xfs_has_v3inodes(ip->i_mount) ||
(*src_log_flags & XFS_ILOG_DOWNER)); (*src_log_flags & XFS_ILOG_DOWNER));
(*src_log_flags) |= XFS_ILOG_DBROOT; (*src_log_flags) |= XFS_ILOG_DBROOT;
break; break;
...@@ -1510,7 +1510,7 @@ xfs_swap_extent_forks( ...@@ -1510,7 +1510,7 @@ xfs_swap_extent_forks(
break; break;
case XFS_DINODE_FMT_BTREE: case XFS_DINODE_FMT_BTREE:
(*target_log_flags) |= XFS_ILOG_DBROOT; (*target_log_flags) |= XFS_ILOG_DBROOT;
ASSERT(!xfs_sb_version_has_v3inode(&ip->i_mount->m_sb) || ASSERT(!xfs_has_v3inodes(ip->i_mount) ||
(*target_log_flags & XFS_ILOG_DOWNER)); (*target_log_flags & XFS_ILOG_DOWNER));
break; break;
} }
...@@ -1624,7 +1624,7 @@ xfs_swap_extents( ...@@ -1624,7 +1624,7 @@ xfs_swap_extents(
* a block reservation because it's really just a remap operation * a block reservation because it's really just a remap operation
* performed with log redo items! * performed with log redo items!
*/ */
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) { if (xfs_has_rmapbt(mp)) {
int w = XFS_DATA_FORK; int w = XFS_DATA_FORK;
uint32_t ipnext = ip->i_df.if_nextents; uint32_t ipnext = ip->i_df.if_nextents;
uint32_t tipnext = tip->i_df.if_nextents; uint32_t tipnext = tip->i_df.if_nextents;
...@@ -1706,7 +1706,7 @@ xfs_swap_extents( ...@@ -1706,7 +1706,7 @@ xfs_swap_extents(
src_log_flags = XFS_ILOG_CORE; src_log_flags = XFS_ILOG_CORE;
target_log_flags = XFS_ILOG_CORE; target_log_flags = XFS_ILOG_CORE;
if (xfs_sb_version_hasrmapbt(&mp->m_sb)) if (xfs_has_rmapbt(mp))
error = xfs_swap_extent_rmap(&tp, ip, tip); error = xfs_swap_extent_rmap(&tp, ip, tip);
else else
error = xfs_swap_extent_forks(tp, ip, tip, &src_log_flags, error = xfs_swap_extent_forks(tp, ip, tip, &src_log_flags,
...@@ -1725,7 +1725,7 @@ xfs_swap_extents( ...@@ -1725,7 +1725,7 @@ xfs_swap_extents(
} }
/* Swap the cow forks. */ /* Swap the cow forks. */
if (xfs_sb_version_hasreflink(&mp->m_sb)) { if (xfs_has_reflink(mp)) {
ASSERT(!ip->i_cowfp || ASSERT(!ip->i_cowfp ||
ip->i_cowfp->if_format == XFS_DINODE_FMT_EXTENTS); ip->i_cowfp->if_format == XFS_DINODE_FMT_EXTENTS);
ASSERT(!tip->i_cowfp || ASSERT(!tip->i_cowfp ||
......
...@@ -1596,7 +1596,7 @@ _xfs_buf_ioapply( ...@@ -1596,7 +1596,7 @@ _xfs_buf_ioapply(
* non-crc filesystems don't attach verifiers during * non-crc filesystems don't attach verifiers during
* log recovery, so don't warn for such filesystems. * log recovery, so don't warn for such filesystems.
*/ */
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
xfs_warn(mp, xfs_warn(mp,
"%s: no buf ops on daddr 0x%llx len %d", "%s: no buf ops on daddr 0x%llx len %d",
__func__, bp->b_bn, bp->b_length); __func__, bp->b_bn, bp->b_length);
...@@ -2385,7 +2385,7 @@ xfs_verify_magic( ...@@ -2385,7 +2385,7 @@ xfs_verify_magic(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
int idx; int idx;
idx = xfs_sb_version_hascrc(&mp->m_sb); idx = xfs_has_crc(mp);
if (WARN_ON(!bp->b_ops || !bp->b_ops->magic[idx])) if (WARN_ON(!bp->b_ops || !bp->b_ops->magic[idx]))
return false; return false;
return dmagic == bp->b_ops->magic[idx]; return dmagic == bp->b_ops->magic[idx];
...@@ -2403,7 +2403,7 @@ xfs_verify_magic16( ...@@ -2403,7 +2403,7 @@ xfs_verify_magic16(
struct xfs_mount *mp = bp->b_mount; struct xfs_mount *mp = bp->b_mount;
int idx; int idx;
idx = xfs_sb_version_hascrc(&mp->m_sb); idx = xfs_has_crc(mp);
if (WARN_ON(!bp->b_ops || !bp->b_ops->magic16[idx])) if (WARN_ON(!bp->b_ops || !bp->b_ops->magic16[idx]))
return false; return false;
return dmagic == bp->b_ops->magic16[idx]; return dmagic == bp->b_ops->magic16[idx];
......
...@@ -348,7 +348,7 @@ xfs_buf_item_format( ...@@ -348,7 +348,7 @@ xfs_buf_item_format(
* occurs during recovery. * occurs during recovery.
*/ */
if (bip->bli_flags & XFS_BLI_INODE_BUF) { if (bip->bli_flags & XFS_BLI_INODE_BUF) {
if (xfs_sb_version_has_v3inode(&lip->li_log->l_mp->m_sb) || if (xfs_has_v3inodes(lip->li_log->l_mp) ||
!((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) && !((bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF) &&
xfs_log_item_in_current_chkpt(lip))) xfs_log_item_in_current_chkpt(lip)))
bip->__bli_format.blf_flags |= XFS_BLF_INODE_BUF; bip->__bli_format.blf_flags |= XFS_BLF_INODE_BUF;
......
...@@ -228,7 +228,7 @@ xlog_recover_validate_buf_type( ...@@ -228,7 +228,7 @@ xlog_recover_validate_buf_type(
* inconsistent state resulting in verification failures. Hence for now * inconsistent state resulting in verification failures. Hence for now
* just avoid the verification stage for non-crc filesystems * just avoid the verification stage for non-crc filesystems
*/ */
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
return; return;
magic32 = be32_to_cpu(*(__be32 *)bp->b_addr); magic32 = be32_to_cpu(*(__be32 *)bp->b_addr);
...@@ -606,7 +606,7 @@ xlog_recover_do_inode_buffer( ...@@ -606,7 +606,7 @@ xlog_recover_do_inode_buffer(
* Post recovery validation only works properly on CRC enabled * Post recovery validation only works properly on CRC enabled
* filesystems. * filesystems.
*/ */
if (xfs_sb_version_hascrc(&mp->m_sb)) if (xfs_has_crc(mp))
bp->b_ops = &xfs_inode_buf_ops; bp->b_ops = &xfs_inode_buf_ops;
inodes_per_buf = BBTOB(bp->b_length) >> mp->m_sb.sb_inodelog; inodes_per_buf = BBTOB(bp->b_length) >> mp->m_sb.sb_inodelog;
...@@ -719,7 +719,7 @@ xlog_recover_get_buf_lsn( ...@@ -719,7 +719,7 @@ xlog_recover_get_buf_lsn(
uint16_t blft; uint16_t blft;
/* v4 filesystems always recover immediately */ /* v4 filesystems always recover immediately */
if (!xfs_sb_version_hascrc(&mp->m_sb)) if (!xfs_has_crc(mp))
goto recover_immediately; goto recover_immediately;
/* /*
...@@ -796,7 +796,7 @@ xlog_recover_get_buf_lsn( ...@@ -796,7 +796,7 @@ xlog_recover_get_buf_lsn(
* the relevant UUID in the superblock. * the relevant UUID in the superblock.
*/ */
lsn = be64_to_cpu(((struct xfs_dsb *)blk)->sb_lsn); lsn = be64_to_cpu(((struct xfs_dsb *)blk)->sb_lsn);
if (xfs_sb_version_hasmetauuid(&mp->m_sb)) if (xfs_has_metauuid(mp))
uuid = &((struct xfs_dsb *)blk)->sb_meta_uuid; uuid = &((struct xfs_dsb *)blk)->sb_meta_uuid;
else else
uuid = &((struct xfs_dsb *)blk)->sb_uuid; uuid = &((struct xfs_dsb *)blk)->sb_uuid;
......
...@@ -32,7 +32,7 @@ xfs_dir3_get_dtype( ...@@ -32,7 +32,7 @@ xfs_dir3_get_dtype(
struct xfs_mount *mp, struct xfs_mount *mp,
uint8_t filetype) uint8_t filetype)
{ {
if (!xfs_sb_version_hasftype(&mp->m_sb)) if (!xfs_has_ftype(mp))
return DT_UNKNOWN; return DT_UNKNOWN;
if (filetype >= XFS_DIR3_FT_MAX) if (filetype >= XFS_DIR3_FT_MAX)
......
...@@ -223,9 +223,9 @@ xfs_qm_init_dquot_blk( ...@@ -223,9 +223,9 @@ xfs_qm_init_dquot_blk(
d->dd_diskdq.d_version = XFS_DQUOT_VERSION; d->dd_diskdq.d_version = XFS_DQUOT_VERSION;
d->dd_diskdq.d_id = cpu_to_be32(curid); d->dd_diskdq.d_id = cpu_to_be32(curid);
d->dd_diskdq.d_type = type; d->dd_diskdq.d_type = type;
if (curid > 0 && xfs_sb_version_hasbigtime(&mp->m_sb)) if (curid > 0 && xfs_has_bigtime(mp))
d->dd_diskdq.d_type |= XFS_DQTYPE_BIGTIME; d->dd_diskdq.d_type |= XFS_DQTYPE_BIGTIME;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
uuid_copy(&d->dd_uuid, &mp->m_sb.sb_meta_uuid); uuid_copy(&d->dd_uuid, &mp->m_sb.sb_meta_uuid);
xfs_update_cksum((char *)d, sizeof(struct xfs_dqblk), xfs_update_cksum((char *)d, sizeof(struct xfs_dqblk),
XFS_DQUOT_CRC_OFF); XFS_DQUOT_CRC_OFF);
...@@ -526,7 +526,7 @@ xfs_dquot_check_type( ...@@ -526,7 +526,7 @@ xfs_dquot_check_type(
* expect an exact match for user dquots and for non-root group and * expect an exact match for user dquots and for non-root group and
* project dquots. * project dquots.
*/ */
if (xfs_sb_version_hascrc(&dqp->q_mount->m_sb) || if (xfs_has_crc(dqp->q_mount) ||
dqp_type == XFS_DQTYPE_USER || dqp->q_id != 0) dqp_type == XFS_DQTYPE_USER || dqp->q_id != 0)
return ddqp_type == dqp_type; return ddqp_type == dqp_type;
...@@ -1221,7 +1221,7 @@ xfs_qm_dqflush_check( ...@@ -1221,7 +1221,7 @@ xfs_qm_dqflush_check(
/* bigtime flag should never be set on root dquots */ /* bigtime flag should never be set on root dquots */
if (dqp->q_type & XFS_DQTYPE_BIGTIME) { if (dqp->q_type & XFS_DQTYPE_BIGTIME) {
if (!xfs_sb_version_hasbigtime(&dqp->q_mount->m_sb)) if (!xfs_has_bigtime(dqp->q_mount))
return __this_address; return __this_address;
if (dqp->q_id == 0) if (dqp->q_id == 0)
return __this_address; return __this_address;
...@@ -1300,7 +1300,7 @@ xfs_qm_dqflush( ...@@ -1300,7 +1300,7 @@ xfs_qm_dqflush(
* buffer always has a valid CRC. This ensures there is no possibility * buffer always has a valid CRC. This ensures there is no possibility
* of a dquot without an up-to-date CRC getting to disk. * of a dquot without an up-to-date CRC getting to disk.
*/ */
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
dqblk->dd_lsn = cpu_to_be64(dqp->q_logitem.qli_item.li_lsn); dqblk->dd_lsn = cpu_to_be64(dqp->q_logitem.qli_item.li_lsn);
xfs_update_cksum((char *)dqblk, sizeof(struct xfs_dqblk), xfs_update_cksum((char *)dqblk, sizeof(struct xfs_dqblk),
XFS_DQUOT_CRC_OFF); XFS_DQUOT_CRC_OFF);
......
...@@ -136,7 +136,7 @@ xlog_recover_dquot_commit_pass2( ...@@ -136,7 +136,7 @@ xlog_recover_dquot_commit_pass2(
* If the dquot has an LSN in it, recover the dquot only if it's less * If the dquot has an LSN in it, recover the dquot only if it's less
* than the lsn of the transaction we are replaying. * than the lsn of the transaction we are replaying.
*/ */
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
struct xfs_dqblk *dqb = (struct xfs_dqblk *)ddq; struct xfs_dqblk *dqb = (struct xfs_dqblk *)ddq;
xfs_lsn_t lsn = be64_to_cpu(dqb->dd_lsn); xfs_lsn_t lsn = be64_to_cpu(dqb->dd_lsn);
...@@ -146,7 +146,7 @@ xlog_recover_dquot_commit_pass2( ...@@ -146,7 +146,7 @@ xlog_recover_dquot_commit_pass2(
} }
memcpy(ddq, recddq, item->ri_buf[1].i_len); memcpy(ddq, recddq, item->ri_buf[1].i_len);
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
xfs_update_cksum((char *)ddq, sizeof(struct xfs_dqblk), xfs_update_cksum((char *)ddq, sizeof(struct xfs_dqblk),
XFS_DQUOT_CRC_OFF); XFS_DQUOT_CRC_OFF);
} }
......
...@@ -1132,7 +1132,7 @@ xfs_file_remap_range( ...@@ -1132,7 +1132,7 @@ xfs_file_remap_range(
if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY)) if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY))
return -EINVAL; return -EINVAL;
if (!xfs_sb_version_hasreflink(&mp->m_sb)) if (!xfs_has_reflink(mp))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (XFS_FORCED_SHUTDOWN(mp)) if (XFS_FORCED_SHUTDOWN(mp))
......
...@@ -201,7 +201,7 @@ xfs_getfsmap_is_shared( ...@@ -201,7 +201,7 @@ xfs_getfsmap_is_shared(
int error; int error;
*stat = false; *stat = false;
if (!xfs_sb_version_hasreflink(&mp->m_sb)) if (!xfs_has_reflink(mp))
return 0; return 0;
/* rt files will have agno set to NULLAGNUMBER */ /* rt files will have agno set to NULLAGNUMBER */
if (info->agno == NULLAGNUMBER) if (info->agno == NULLAGNUMBER)
...@@ -848,7 +848,7 @@ xfs_getfsmap( ...@@ -848,7 +848,7 @@ xfs_getfsmap(
!xfs_getfsmap_is_valid_device(mp, &head->fmh_keys[1])) !xfs_getfsmap_is_valid_device(mp, &head->fmh_keys[1]))
return -EINVAL; return -EINVAL;
use_rmap = xfs_sb_version_hasrmapbt(&mp->m_sb) && use_rmap = xfs_has_rmapbt(mp) &&
has_capability_noaudit(current, CAP_SYS_ADMIN); has_capability_noaudit(current, CAP_SYS_ADMIN);
head->fmh_entries = 0; head->fmh_entries = 0;
......
...@@ -603,7 +603,7 @@ xfs_iget_cache_miss( ...@@ -603,7 +603,7 @@ xfs_iget_cache_miss(
* value and hence we must also read the inode off disk even when * value and hence we must also read the inode off disk even when
* initializing new inodes. * initializing new inodes.
*/ */
if (xfs_sb_version_has_v3inode(&mp->m_sb) && if (xfs_has_v3inodes(mp) &&
(flags & XFS_IGET_CREATE) && !(mp->m_flags & XFS_MOUNT_IKEEP)) { (flags & XFS_IGET_CREATE) && !(mp->m_flags & XFS_MOUNT_IKEEP)) {
VFS_I(ip)->i_generation = prandom_u32(); VFS_I(ip)->i_generation = prandom_u32();
} else { } else {
......
...@@ -719,7 +719,7 @@ xfs_inode_inherit_flags( ...@@ -719,7 +719,7 @@ xfs_inode_inherit_flags(
di_flags |= XFS_DIFLAG_PROJINHERIT; di_flags |= XFS_DIFLAG_PROJINHERIT;
} else if (S_ISREG(mode)) { } else if (S_ISREG(mode)) {
if ((pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) && if ((pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) &&
xfs_sb_version_hasrealtime(&ip->i_mount->m_sb)) xfs_has_realtime(ip->i_mount))
di_flags |= XFS_DIFLAG_REALTIME; di_flags |= XFS_DIFLAG_REALTIME;
if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) {
di_flags |= XFS_DIFLAG_EXTSIZE; di_flags |= XFS_DIFLAG_EXTSIZE;
...@@ -885,7 +885,7 @@ xfs_ialloc( ...@@ -885,7 +885,7 @@ xfs_ialloc(
ip->i_d.di_dmstate = 0; ip->i_d.di_dmstate = 0;
ip->i_d.di_flags = 0; ip->i_d.di_flags = 0;
if (xfs_sb_version_has_v3inode(&mp->m_sb)) { if (xfs_has_v3inodes(mp)) {
inode_set_iversion(inode, 1); inode_set_iversion(inode, 1);
ip->i_d.di_flags2 = mp->m_ino_geo.new_diflags2; ip->i_d.di_flags2 = mp->m_ino_geo.new_diflags2;
ip->i_d.di_cowextsize = 0; ip->i_d.di_cowextsize = 0;
...@@ -3645,7 +3645,7 @@ xfs_iflush( ...@@ -3645,7 +3645,7 @@ xfs_iflush(
* backwards compatibility with old kernels that predate logging all * backwards compatibility with old kernels that predate logging all
* inode changes. * inode changes.
*/ */
if (!xfs_sb_version_has_v3inode(&mp->m_sb)) if (!xfs_has_v3inodes(mp))
ip->i_d.di_flushiter++; ip->i_d.di_flushiter++;
/* /*
......
...@@ -371,7 +371,7 @@ xfs_inode_to_log_dinode( ...@@ -371,7 +371,7 @@ xfs_inode_to_log_dinode(
/* log a dummy value to ensure log structure is fully initialised */ /* log a dummy value to ensure log structure is fully initialised */
to->di_next_unlinked = NULLAGINO; to->di_next_unlinked = NULLAGINO;
if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) { if (xfs_has_v3inodes(ip->i_mount)) {
to->di_version = 3; to->di_version = 3;
to->di_changecount = inode_peek_iversion(inode); to->di_changecount = inode_peek_iversion(inode);
to->di_crtime = xfs_inode_to_log_dinode_ts(ip, from->di_crtime); to->di_crtime = xfs_inode_to_log_dinode_ts(ip, from->di_crtime);
......
...@@ -295,7 +295,7 @@ xlog_recover_inode_commit_pass2( ...@@ -295,7 +295,7 @@ xlog_recover_inode_commit_pass2(
* superblock flag to determine whether we need to look at di_flushiter * superblock flag to determine whether we need to look at di_flushiter
* to skip replay when the on disk inode is newer than the log one * to skip replay when the on disk inode is newer than the log one
*/ */
if (!xfs_sb_version_has_v3inode(&mp->m_sb) && if (!xfs_has_v3inodes(mp) &&
ldip->di_flushiter < be16_to_cpu(dip->di_flushiter)) { ldip->di_flushiter < be16_to_cpu(dip->di_flushiter)) {
/* /*
* Deal with the wrap case, DI_MAX_FLUSH is less * Deal with the wrap case, DI_MAX_FLUSH is less
......
...@@ -1233,7 +1233,7 @@ xfs_ioctl_setattr_xflags( ...@@ -1233,7 +1233,7 @@ xfs_ioctl_setattr_xflags(
/* diflags2 only valid for v3 inodes. */ /* diflags2 only valid for v3 inodes. */
di_flags2 = xfs_flags2diflags2(ip, fa->fsx_xflags); di_flags2 = xfs_flags2diflags2(ip, fa->fsx_xflags);
if (di_flags2 && !xfs_sb_version_has_v3inode(&mp->m_sb)) if (di_flags2 && !xfs_has_v3inodes(mp))
return -EINVAL; return -EINVAL;
ip->i_d.di_flags = xfs_flags2diflags(ip, fa->fsx_xflags); ip->i_d.di_flags = xfs_flags2diflags(ip, fa->fsx_xflags);
...@@ -1419,9 +1419,9 @@ xfs_ioctl_setattr_check_projid( ...@@ -1419,9 +1419,9 @@ xfs_ioctl_setattr_check_projid(
struct xfs_inode *ip, struct xfs_inode *ip,
struct fsxattr *fa) struct fsxattr *fa)
{ {
/* Disallow 32bit project ids if projid32bit feature is not enabled. */ /* Disallow 32bit project ids if 32bit IDs are not enabled. */
if (fa->fsx_projid > (uint16_t)-1 && if (fa->fsx_projid > (uint16_t)-1 &&
!xfs_sb_version_hasprojid32bit(&ip->i_mount->m_sb)) !xfs_has_projid32(ip->i_mount))
return -EINVAL; return -EINVAL;
return 0; return 0;
} }
...@@ -1515,7 +1515,7 @@ xfs_ioctl_setattr( ...@@ -1515,7 +1515,7 @@ xfs_ioctl_setattr(
ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog; ip->i_d.di_extsize = fa->fsx_extsize >> mp->m_sb.sb_blocklog;
else else
ip->i_d.di_extsize = 0; ip->i_d.di_extsize = 0;
if (xfs_sb_version_has_v3inode(&mp->m_sb) && if (xfs_has_v3inodes(mp) &&
(ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE)) (ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE))
ip->i_d.di_cowextsize = fa->fsx_cowextsize >> ip->i_d.di_cowextsize = fa->fsx_cowextsize >>
mp->m_sb.sb_blocklog; mp->m_sb.sb_blocklog;
......
...@@ -355,7 +355,7 @@ xfs_vn_unlink( ...@@ -355,7 +355,7 @@ xfs_vn_unlink(
* but still hashed. This is incompatible with case-insensitive * but still hashed. This is incompatible with case-insensitive
* mode, so invalidate (unhash) the dentry in CI-mode. * mode, so invalidate (unhash) the dentry in CI-mode.
*/ */
if (xfs_sb_version_hasasciici(&XFS_M(dir->i_sb)->m_sb)) if (xfs_has_asciici(XFS_M(dir->i_sb)))
d_invalidate(dentry); d_invalidate(dentry);
return 0; return 0;
} }
...@@ -557,7 +557,7 @@ xfs_vn_getattr( ...@@ -557,7 +557,7 @@ xfs_vn_getattr(
stat->blocks = stat->blocks =
XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks); XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks);
if (xfs_sb_version_has_v3inode(&mp->m_sb)) { if (xfs_has_v3inodes(mp)) {
if (request_mask & STATX_BTIME) { if (request_mask & STATX_BTIME) {
stat->result_mask |= STATX_BTIME; stat->result_mask |= STATX_BTIME;
stat->btime = ip->i_d.di_crtime; stat->btime = ip->i_d.di_crtime;
...@@ -747,7 +747,7 @@ xfs_setattr_nonsize( ...@@ -747,7 +747,7 @@ xfs_setattr_nonsize(
} }
if (!gid_eq(igid, gid)) { if (!gid_eq(igid, gid)) {
if (XFS_IS_GQUOTA_ON(mp)) { if (XFS_IS_GQUOTA_ON(mp)) {
ASSERT(xfs_sb_version_has_pquotino(&mp->m_sb) || ASSERT(xfs_has_pquotino(mp) ||
!XFS_IS_PQUOTA_ON(mp)); !XFS_IS_PQUOTA_ON(mp));
ASSERT(mask & ATTR_GID); ASSERT(mask & ATTR_GID);
ASSERT(gdqp); ASSERT(gdqp);
...@@ -1362,7 +1362,7 @@ xfs_setup_iops( ...@@ -1362,7 +1362,7 @@ xfs_setup_iops(
inode->i_mapping->a_ops = &xfs_address_space_operations; inode->i_mapping->a_ops = &xfs_address_space_operations;
break; break;
case S_IFDIR: case S_IFDIR:
if (xfs_sb_version_hasasciici(&XFS_M(inode->i_sb)->m_sb)) if (xfs_has_asciici(XFS_M(inode->i_sb)))
inode->i_op = &xfs_dir_ci_inode_operations; inode->i_op = &xfs_dir_ci_inode_operations;
else else
inode->i_op = &xfs_dir_inode_operations; inode->i_op = &xfs_dir_inode_operations;
......
...@@ -111,7 +111,7 @@ xfs_bulkstat_one_int( ...@@ -111,7 +111,7 @@ xfs_bulkstat_one_int(
buf->bs_forkoff = xfs_inode_fork_boff(ip); buf->bs_forkoff = xfs_inode_fork_boff(ip);
buf->bs_version = XFS_BULKSTAT_VERSION_V5; buf->bs_version = XFS_BULKSTAT_VERSION_V5;
if (xfs_sb_version_has_v3inode(&mp->m_sb)) { if (xfs_has_v3inodes(mp)) {
if (dic->di_flags2 & XFS_DIFLAG2_COWEXTSIZE) if (dic->di_flags2 & XFS_DIFLAG2_COWEXTSIZE)
buf->bs_cowextsize_blks = dic->di_cowextsize; buf->bs_cowextsize_blks = dic->di_cowextsize;
} }
......
...@@ -613,7 +613,7 @@ xfs_log_mount( ...@@ -613,7 +613,7 @@ xfs_log_mount(
int num_bblks) int num_bblks)
{ {
struct xlog *log; struct xlog *log;
bool fatal = xfs_sb_version_hascrc(&mp->m_sb); bool fatal = xfs_has_crc(mp);
int error = 0; int error = 0;
int min_logfsbs; int min_logfsbs;
...@@ -1434,7 +1434,7 @@ xlog_alloc_log( ...@@ -1434,7 +1434,7 @@ xlog_alloc_log(
xlog_assign_atomic_lsn(&log->l_last_sync_lsn, 1, 0); xlog_assign_atomic_lsn(&log->l_last_sync_lsn, 1, 0);
log->l_curr_cycle = 1; /* 0 is bad since this is initial value */ log->l_curr_cycle = 1; /* 0 is bad since this is initial value */
if (xfs_sb_version_haslogv2(&mp->m_sb) && mp->m_sb.sb_logsunit > 1) if (xfs_has_logv2(mp) && mp->m_sb.sb_logsunit > 1)
log->l_iclog_roundoff = mp->m_sb.sb_logsunit; log->l_iclog_roundoff = mp->m_sb.sb_logsunit;
else else
log->l_iclog_roundoff = BBSIZE; log->l_iclog_roundoff = BBSIZE;
...@@ -1443,7 +1443,7 @@ xlog_alloc_log( ...@@ -1443,7 +1443,7 @@ xlog_alloc_log(
xlog_grant_head_init(&log->l_write_head); xlog_grant_head_init(&log->l_write_head);
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
if (xfs_sb_version_hassector(&mp->m_sb)) { if (xfs_has_sector(mp)) {
log2_size = mp->m_sb.sb_logsectlog; log2_size = mp->m_sb.sb_logsectlog;
if (log2_size < BBSHIFT) { if (log2_size < BBSHIFT) {
xfs_warn(mp, "Log sector size too small (0x%x < 0x%x)", xfs_warn(mp, "Log sector size too small (0x%x < 0x%x)",
...@@ -1460,7 +1460,7 @@ xlog_alloc_log( ...@@ -1460,7 +1460,7 @@ xlog_alloc_log(
/* for larger sector sizes, must have v2 or external log */ /* for larger sector sizes, must have v2 or external log */
if (log2_size && log->l_logBBstart > 0 && if (log2_size && log->l_logBBstart > 0 &&
!xfs_sb_version_haslogv2(&mp->m_sb)) { !xfs_has_logv2(mp)) {
xfs_warn(mp, xfs_warn(mp,
"log sector size (0x%x) invalid for configuration.", "log sector size (0x%x) invalid for configuration.",
log2_size); log2_size);
...@@ -1506,7 +1506,7 @@ xlog_alloc_log( ...@@ -1506,7 +1506,7 @@ xlog_alloc_log(
memset(head, 0, sizeof(xlog_rec_header_t)); memset(head, 0, sizeof(xlog_rec_header_t));
head->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM); head->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM);
head->h_version = cpu_to_be32( head->h_version = cpu_to_be32(
xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? 2 : 1); xfs_has_logv2(log->l_mp) ? 2 : 1);
head->h_size = cpu_to_be32(log->l_iclog_size); head->h_size = cpu_to_be32(log->l_iclog_size);
/* new fields */ /* new fields */
head->h_fmt = cpu_to_be32(XLOG_FMT); head->h_fmt = cpu_to_be32(XLOG_FMT);
...@@ -1665,7 +1665,7 @@ xlog_pack_data( ...@@ -1665,7 +1665,7 @@ xlog_pack_data(
dp += BBSIZE; dp += BBSIZE;
} }
if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { if (xfs_has_logv2(log->l_mp)) {
xlog_in_core_2_t *xhdr = iclog->ic_data; xlog_in_core_2_t *xhdr = iclog->ic_data;
for ( ; i < BTOBB(size); i++) { for ( ; i < BTOBB(size); i++) {
...@@ -1702,7 +1702,7 @@ xlog_cksum( ...@@ -1702,7 +1702,7 @@ xlog_cksum(
offsetof(struct xlog_rec_header, h_crc)); offsetof(struct xlog_rec_header, h_crc));
/* ... then for additional cycle data for v2 logs ... */ /* ... then for additional cycle data for v2 logs ... */
if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { if (xfs_has_logv2(log->l_mp)) {
union xlog_in_core2 *xhdr = (union xlog_in_core2 *)rhead; union xlog_in_core2 *xhdr = (union xlog_in_core2 *)rhead;
int i; int i;
int xheads; int xheads;
...@@ -1929,7 +1929,7 @@ xlog_sync( ...@@ -1929,7 +1929,7 @@ xlog_sync(
/* real byte length */ /* real byte length */
size = iclog->ic_offset; size = iclog->ic_offset;
if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) if (xfs_has_logv2(log->l_mp))
size += roundoff; size += roundoff;
iclog->ic_header.h_len = cpu_to_be32(size); iclog->ic_header.h_len = cpu_to_be32(size);
......
...@@ -373,7 +373,7 @@ xlog_find_verify_cycle( ...@@ -373,7 +373,7 @@ xlog_find_verify_cycle(
static inline int static inline int
xlog_logrec_hblks(struct xlog *log, struct xlog_rec_header *rh) xlog_logrec_hblks(struct xlog *log, struct xlog_rec_header *rh)
{ {
if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { if (xfs_has_logv2(log->l_mp)) {
int h_size = be32_to_cpu(rh->h_size); int h_size = be32_to_cpu(rh->h_size);
if ((be32_to_cpu(rh->h_version) & XLOG_VERSION_2) && if ((be32_to_cpu(rh->h_version) & XLOG_VERSION_2) &&
...@@ -1502,7 +1502,7 @@ xlog_add_record( ...@@ -1502,7 +1502,7 @@ xlog_add_record(
recp->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM); recp->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM);
recp->h_cycle = cpu_to_be32(cycle); recp->h_cycle = cpu_to_be32(cycle);
recp->h_version = cpu_to_be32( recp->h_version = cpu_to_be32(
xfs_sb_version_haslogv2(&log->l_mp->m_sb) ? 2 : 1); xfs_has_logv2(log->l_mp) ? 2 : 1);
recp->h_lsn = cpu_to_be64(xlog_assign_lsn(cycle, block)); recp->h_lsn = cpu_to_be64(xlog_assign_lsn(cycle, block));
recp->h_tail_lsn = cpu_to_be64(xlog_assign_lsn(tail_cycle, tail_block)); recp->h_tail_lsn = cpu_to_be64(xlog_assign_lsn(tail_cycle, tail_block));
recp->h_fmt = cpu_to_be32(XLOG_FMT); recp->h_fmt = cpu_to_be32(XLOG_FMT);
...@@ -2816,7 +2816,7 @@ xlog_unpack_data( ...@@ -2816,7 +2816,7 @@ xlog_unpack_data(
dp += BBSIZE; dp += BBSIZE;
} }
if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { if (xfs_has_logv2(log->l_mp)) {
xlog_in_core_2_t *xhdr = (xlog_in_core_2_t *)rhead; xlog_in_core_2_t *xhdr = (xlog_in_core_2_t *)rhead;
for ( ; i < BTOBB(be32_to_cpu(rhead->h_len)); i++) { for ( ; i < BTOBB(be32_to_cpu(rhead->h_len)); i++) {
j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE); j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
...@@ -2864,7 +2864,7 @@ xlog_recover_process( ...@@ -2864,7 +2864,7 @@ xlog_recover_process(
* the kernel from one that does not add CRCs by default. * the kernel from one that does not add CRCs by default.
*/ */
if (crc != old_crc) { if (crc != old_crc) {
if (old_crc || xfs_sb_version_hascrc(&log->l_mp->m_sb)) { if (old_crc || xfs_has_crc(log->l_mp)) {
xfs_alert(log->l_mp, xfs_alert(log->l_mp,
"log record CRC mismatch: found 0x%x, expected 0x%x.", "log record CRC mismatch: found 0x%x, expected 0x%x.",
le32_to_cpu(old_crc), le32_to_cpu(old_crc),
...@@ -2876,7 +2876,7 @@ xlog_recover_process( ...@@ -2876,7 +2876,7 @@ xlog_recover_process(
* If the filesystem is CRC enabled, this mismatch becomes a * If the filesystem is CRC enabled, this mismatch becomes a
* fatal log corruption failure. * fatal log corruption failure.
*/ */
if (xfs_sb_version_hascrc(&log->l_mp->m_sb)) { if (xfs_has_crc(log->l_mp)) {
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp); XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp);
return -EFSCORRUPTED; return -EFSCORRUPTED;
} }
...@@ -2962,7 +2962,7 @@ xlog_do_recovery_pass( ...@@ -2962,7 +2962,7 @@ xlog_do_recovery_pass(
* Read the header of the tail block and get the iclog buffer size from * Read the header of the tail block and get the iclog buffer size from
* h_size. Use this to tell how many sectors make up the log header. * h_size. Use this to tell how many sectors make up the log header.
*/ */
if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { if (xfs_has_logv2(log->l_mp)) {
/* /*
* When using variable length iclogs, read first sector of * When using variable length iclogs, read first sector of
* iclog header and extract the header size from it. Get a * iclog header and extract the header size from it. Get a
...@@ -3355,7 +3355,7 @@ xlog_recover( ...@@ -3355,7 +3355,7 @@ xlog_recover(
* could not be verified. Check the superblock LSN against the current * could not be verified. Check the superblock LSN against the current
* LSN now that it's known. * LSN now that it's known.
*/ */
if (xfs_sb_version_hascrc(&log->l_mp->m_sb) && if (xfs_has_crc(log->l_mp) &&
!xfs_log_check_lsn(log->l_mp, log->l_mp->m_sb.sb_lsn)) !xfs_log_check_lsn(log->l_mp, log->l_mp->m_sb.sb_lsn))
return -EINVAL; return -EINVAL;
......
...@@ -443,7 +443,7 @@ xfs_validate_new_dalign( ...@@ -443,7 +443,7 @@ xfs_validate_new_dalign(
} }
} }
if (!xfs_sb_version_hasdalign(&mp->m_sb)) { if (!xfs_has_dalign(mp)) {
xfs_warn(mp, xfs_warn(mp,
"cannot change alignment: superblock does not support data alignment"); "cannot change alignment: superblock does not support data alignment");
return -EINVAL; return -EINVAL;
...@@ -475,7 +475,7 @@ xfs_update_alignment( ...@@ -475,7 +475,7 @@ xfs_update_alignment(
sbp->sb_width = mp->m_swidth; sbp->sb_width = mp->m_swidth;
mp->m_update_sb = true; mp->m_update_sb = true;
} else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN && } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN &&
xfs_sb_version_hasdalign(&mp->m_sb)) { xfs_has_dalign(mp)) {
mp->m_dalign = sbp->sb_unit; mp->m_dalign = sbp->sb_unit;
mp->m_swidth = sbp->sb_width; mp->m_swidth = sbp->sb_width;
} }
...@@ -630,7 +630,7 @@ xfs_check_summary_counts( ...@@ -630,7 +630,7 @@ xfs_check_summary_counts(
* superblock to be correct and we don't need to do anything here. * superblock to be correct and we don't need to do anything here.
* Otherwise, recalculate the summary counters. * Otherwise, recalculate the summary counters.
*/ */
if ((!xfs_sb_version_haslazysbcount(&mp->m_sb) || if ((!xfs_has_lazysbcount(mp) ||
XFS_LAST_UNMOUNT_WAS_CLEAN(mp)) && XFS_LAST_UNMOUNT_WAS_CLEAN(mp)) &&
!xfs_fs_has_sickness(mp, XFS_SICK_FS_COUNTERS)) !xfs_fs_has_sickness(mp, XFS_SICK_FS_COUNTERS))
return 0; return 0;
...@@ -745,6 +745,7 @@ xfs_mountfs( ...@@ -745,6 +745,7 @@ xfs_mountfs(
/* always use v2 inodes by default now */ /* always use v2 inodes by default now */
if (!(mp->m_sb.sb_versionnum & XFS_SB_VERSION_NLINKBIT)) { if (!(mp->m_sb.sb_versionnum & XFS_SB_VERSION_NLINKBIT)) {
mp->m_sb.sb_versionnum |= XFS_SB_VERSION_NLINKBIT; mp->m_sb.sb_versionnum |= XFS_SB_VERSION_NLINKBIT;
mp->m_features |= XFS_FEAT_NLINK;
mp->m_update_sb = true; mp->m_update_sb = true;
} }
...@@ -817,7 +818,7 @@ xfs_mountfs( ...@@ -817,7 +818,7 @@ xfs_mountfs(
* cluster size. Full inode chunk alignment must match the chunk size, * cluster size. Full inode chunk alignment must match the chunk size,
* but that is checked on sb read verification... * but that is checked on sb read verification...
*/ */
if (xfs_sb_version_hassparseinodes(&mp->m_sb) && if (xfs_has_sparseinodes(mp) &&
mp->m_sb.sb_spino_align != mp->m_sb.sb_spino_align !=
XFS_B_TO_FSBT(mp, igeo->inode_cluster_size_raw)) { XFS_B_TO_FSBT(mp, igeo->inode_cluster_size_raw)) {
xfs_warn(mp, xfs_warn(mp,
...@@ -912,7 +913,7 @@ xfs_mountfs( ...@@ -912,7 +913,7 @@ xfs_mountfs(
* behaviour specified by the superblock feature bit. * behaviour specified by the superblock feature bit.
*/ */
if (!(mp->m_flags & (XFS_MOUNT_ATTR2|XFS_MOUNT_NOATTR2)) && if (!(mp->m_flags & (XFS_MOUNT_ATTR2|XFS_MOUNT_NOATTR2)) &&
xfs_sb_version_hasattr2(&mp->m_sb)) xfs_has_attr2(mp))
mp->m_flags |= XFS_MOUNT_ATTR2; mp->m_flags |= XFS_MOUNT_ATTR2;
/* /*
...@@ -1376,7 +1377,7 @@ void ...@@ -1376,7 +1377,7 @@ void
xfs_force_summary_recalc( xfs_force_summary_recalc(
struct xfs_mount *mp) struct xfs_mount *mp)
{ {
if (!xfs_sb_version_haslazysbcount(&mp->m_sb)) if (!xfs_has_lazysbcount(mp))
return; return;
xfs_fs_mark_sick(mp, XFS_SICK_FS_COUNTERS); xfs_fs_mark_sick(mp, XFS_SICK_FS_COUNTERS);
......
...@@ -314,9 +314,9 @@ __XFS_HAS_FEAT(reflink, REFLINK) ...@@ -314,9 +314,9 @@ __XFS_HAS_FEAT(reflink, REFLINK)
__XFS_HAS_FEAT(sparseinodes, SPINODES) __XFS_HAS_FEAT(sparseinodes, SPINODES)
__XFS_HAS_FEAT(metauuid, META_UUID) __XFS_HAS_FEAT(metauuid, META_UUID)
__XFS_HAS_FEAT(realtime, REALTIME) __XFS_HAS_FEAT(realtime, REALTIME)
__XFS_HAS_FEAT(inobtcounts, REALTIME) __XFS_HAS_FEAT(inobtcounts, INOBTCNT)
__XFS_HAS_FEAT(bigtime, REALTIME) __XFS_HAS_FEAT(bigtime, BIGTIME)
__XFS_HAS_FEAT(needsrepair, REALTIME) __XFS_HAS_FEAT(needsrepair, NEEDSREPAIR)
/* /*
* Flags for m_flags. * Flags for m_flags.
......
...@@ -654,7 +654,7 @@ xfs_qm_init_quotainfo( ...@@ -654,7 +654,7 @@ xfs_qm_init_quotainfo(
/* Precalc some constants */ /* Precalc some constants */
qinf->qi_dqchunklen = XFS_FSB_TO_BB(mp, XFS_DQUOT_CLUSTER_SIZE_FSB); qinf->qi_dqchunklen = XFS_FSB_TO_BB(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
qinf->qi_dqperchunk = xfs_calc_dquots_per_chunk(qinf->qi_dqchunklen); qinf->qi_dqperchunk = xfs_calc_dquots_per_chunk(qinf->qi_dqchunklen);
if (xfs_sb_version_hasbigtime(&mp->m_sb)) { if (xfs_has_bigtime(mp)) {
qinf->qi_expiry_min = qinf->qi_expiry_min =
xfs_dq_bigtime_to_unix(XFS_DQ_BIGTIME_EXPIRY_MIN); xfs_dq_bigtime_to_unix(XFS_DQ_BIGTIME_EXPIRY_MIN);
qinf->qi_expiry_max = qinf->qi_expiry_max =
...@@ -747,7 +747,7 @@ xfs_qm_qino_alloc( ...@@ -747,7 +747,7 @@ xfs_qm_qino_alloc(
* with PQUOTA, just use sb_gquotino for sb_pquotino and * with PQUOTA, just use sb_gquotino for sb_pquotino and
* vice-versa. * vice-versa.
*/ */
if (!xfs_sb_version_has_pquotino(&mp->m_sb) && if (!xfs_has_pquotino(mp) &&
(flags & (XFS_QMOPT_PQUOTA|XFS_QMOPT_GQUOTA))) { (flags & (XFS_QMOPT_PQUOTA|XFS_QMOPT_GQUOTA))) {
xfs_ino_t ino = NULLFSINO; xfs_ino_t ino = NULLFSINO;
...@@ -795,9 +795,9 @@ xfs_qm_qino_alloc( ...@@ -795,9 +795,9 @@ xfs_qm_qino_alloc(
*/ */
spin_lock(&mp->m_sb_lock); spin_lock(&mp->m_sb_lock);
if (flags & XFS_QMOPT_SBVERSION) { if (flags & XFS_QMOPT_SBVERSION) {
ASSERT(!xfs_sb_version_hasquota(&mp->m_sb)); ASSERT(!xfs_has_quota(mp));
xfs_sb_version_addquota(&mp->m_sb); xfs_add_quota(mp);
mp->m_sb.sb_uquotino = NULLFSINO; mp->m_sb.sb_uquotino = NULLFSINO;
mp->m_sb.sb_gquotino = NULLFSINO; mp->m_sb.sb_gquotino = NULLFSINO;
mp->m_sb.sb_pquotino = NULLFSINO; mp->m_sb.sb_pquotino = NULLFSINO;
...@@ -883,11 +883,11 @@ xfs_qm_reset_dqcounts( ...@@ -883,11 +883,11 @@ xfs_qm_reset_dqcounts(
ddq->d_bwarns = 0; ddq->d_bwarns = 0;
ddq->d_iwarns = 0; ddq->d_iwarns = 0;
ddq->d_rtbwarns = 0; ddq->d_rtbwarns = 0;
if (xfs_sb_version_hasbigtime(&mp->m_sb)) if (xfs_has_bigtime(mp))
ddq->d_type |= XFS_DQTYPE_BIGTIME; ddq->d_type |= XFS_DQTYPE_BIGTIME;
} }
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
xfs_update_cksum((char *)&dqb[j], xfs_update_cksum((char *)&dqb[j],
sizeof(struct xfs_dqblk), sizeof(struct xfs_dqblk),
XFS_DQUOT_CRC_OFF); XFS_DQUOT_CRC_OFF);
...@@ -1500,7 +1500,7 @@ xfs_qm_init_quotainos( ...@@ -1500,7 +1500,7 @@ xfs_qm_init_quotainos(
/* /*
* Get the uquota and gquota inodes * Get the uquota and gquota inodes
*/ */
if (xfs_sb_version_hasquota(&mp->m_sb)) { if (xfs_has_quota(mp)) {
if (XFS_IS_UQUOTA_ON(mp) && if (XFS_IS_UQUOTA_ON(mp) &&
mp->m_sb.sb_uquotino != NULLFSINO) { mp->m_sb.sb_uquotino != NULLFSINO) {
ASSERT(mp->m_sb.sb_uquotino > 0); ASSERT(mp->m_sb.sb_uquotino > 0);
......
...@@ -75,7 +75,7 @@ xfs_qm_newmount( ...@@ -75,7 +75,7 @@ xfs_qm_newmount(
uint quotaondisk; uint quotaondisk;
uint uquotaondisk = 0, gquotaondisk = 0, pquotaondisk = 0; uint uquotaondisk = 0, gquotaondisk = 0, pquotaondisk = 0;
quotaondisk = xfs_sb_version_hasquota(&mp->m_sb) && quotaondisk = xfs_has_quota(mp) &&
(mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT); (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT);
if (quotaondisk) { if (quotaondisk) {
......
...@@ -105,7 +105,7 @@ xfs_qm_scall_trunc_qfiles( ...@@ -105,7 +105,7 @@ xfs_qm_scall_trunc_qfiles(
{ {
int error = -EINVAL; int error = -EINVAL;
if (!xfs_sb_version_hasquota(&mp->m_sb) || flags == 0 || if (!xfs_has_quota(mp) || flags == 0 ||
(flags & ~XFS_QMOPT_QUOTALL)) { (flags & ~XFS_QMOPT_QUOTALL)) {
xfs_debug(mp, "%s: flags=%x m_qflags=%x", xfs_debug(mp, "%s: flags=%x m_qflags=%x",
__func__, flags, mp->m_qflags); __func__, flags, mp->m_qflags);
......
...@@ -761,7 +761,7 @@ xfs_reflink_recover_cow( ...@@ -761,7 +761,7 @@ xfs_reflink_recover_cow(
xfs_agnumber_t agno; xfs_agnumber_t agno;
int error = 0; int error = 0;
if (!xfs_sb_version_hasreflink(&mp->m_sb)) if (!xfs_has_reflink(mp))
return 0; return 0;
for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) { for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
...@@ -967,7 +967,7 @@ xfs_reflink_ag_has_free_space( ...@@ -967,7 +967,7 @@ xfs_reflink_ag_has_free_space(
struct xfs_perag *pag; struct xfs_perag *pag;
int error = 0; int error = 0;
if (!xfs_sb_version_hasrmapbt(&mp->m_sb)) if (!xfs_has_rmapbt(mp))
return 0; return 0;
pag = xfs_perag_get(mp, agno); pag = xfs_perag_get(mp, agno);
......
...@@ -491,7 +491,7 @@ xfs_setup_devices( ...@@ -491,7 +491,7 @@ xfs_setup_devices(
if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) {
unsigned int log_sector_size = BBSIZE; unsigned int log_sector_size = BBSIZE;
if (xfs_sb_version_hassector(&mp->m_sb)) if (xfs_has_sector(mp))
log_sector_size = mp->m_sb.sb_logsectsize; log_sector_size = mp->m_sb.sb_logsectsize;
error = xfs_setsize_buftarg(mp->m_logdev_targp, error = xfs_setsize_buftarg(mp->m_logdev_targp,
log_sector_size); log_sector_size);
...@@ -978,7 +978,7 @@ xfs_finish_flags( ...@@ -978,7 +978,7 @@ xfs_finish_flags(
int ronly = (mp->m_flags & XFS_MOUNT_RDONLY); int ronly = (mp->m_flags & XFS_MOUNT_RDONLY);
/* Fail a mount where the logbuf is smaller than the log stripe */ /* Fail a mount where the logbuf is smaller than the log stripe */
if (xfs_sb_version_haslogv2(&mp->m_sb)) { if (xfs_has_logv2(mp)) {
if (mp->m_logbsize <= 0 && if (mp->m_logbsize <= 0 &&
mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) { mp->m_sb.sb_logsunit > XLOG_BIG_RECORD_BSIZE) {
mp->m_logbsize = mp->m_sb.sb_logsunit; mp->m_logbsize = mp->m_sb.sb_logsunit;
...@@ -1000,7 +1000,7 @@ xfs_finish_flags( ...@@ -1000,7 +1000,7 @@ xfs_finish_flags(
/* /*
* V5 filesystems always use attr2 format for attributes. * V5 filesystems always use attr2 format for attributes.
*/ */
if (xfs_sb_version_hascrc(&mp->m_sb) && if (xfs_has_crc(mp) &&
(mp->m_flags & XFS_MOUNT_NOATTR2)) { (mp->m_flags & XFS_MOUNT_NOATTR2)) {
xfs_warn(mp, "Cannot mount a V5 filesystem as noattr2. " xfs_warn(mp, "Cannot mount a V5 filesystem as noattr2. "
"attr2 is always enabled for V5 filesystems."); "attr2 is always enabled for V5 filesystems.");
...@@ -1018,7 +1018,7 @@ xfs_finish_flags( ...@@ -1018,7 +1018,7 @@ xfs_finish_flags(
if ((mp->m_qflags & XFS_GQUOTA_ACCT) && if ((mp->m_qflags & XFS_GQUOTA_ACCT) &&
(mp->m_qflags & XFS_PQUOTA_ACCT) && (mp->m_qflags & XFS_PQUOTA_ACCT) &&
!xfs_sb_version_has_pquotino(&mp->m_sb)) { !xfs_has_pquotino(mp)) {
xfs_warn(mp, xfs_warn(mp,
"Super block does not support project and group quota together"); "Super block does not support project and group quota together");
return -EINVAL; return -EINVAL;
...@@ -1536,7 +1536,7 @@ xfs_fc_fill_super( ...@@ -1536,7 +1536,7 @@ xfs_fc_fill_super(
goto out_free_sb; goto out_free_sb;
/* V4 support is undergoing deprecation. */ /* V4 support is undergoing deprecation. */
if (!xfs_sb_version_hascrc(&mp->m_sb)) { if (!xfs_has_crc(mp)) {
#ifdef CONFIG_XFS_SUPPORT_V4 #ifdef CONFIG_XFS_SUPPORT_V4
xfs_warn_once(mp, xfs_warn_once(mp,
"Deprecated V4 format (crc=0) will not be supported after September 2030."); "Deprecated V4 format (crc=0) will not be supported after September 2030.");
...@@ -1614,7 +1614,7 @@ xfs_fc_fill_super( ...@@ -1614,7 +1614,7 @@ xfs_fc_fill_super(
sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_max_links = XFS_MAXLINK; sb->s_max_links = XFS_MAXLINK;
sb->s_time_gran = 1; sb->s_time_gran = 1;
if (xfs_sb_version_hasbigtime(&mp->m_sb)) { if (xfs_has_bigtime(mp)) {
sb->s_time_min = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MIN); sb->s_time_min = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MIN);
sb->s_time_max = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MAX); sb->s_time_max = xfs_bigtime_to_unix(XFS_BIGTIME_TIME_MAX);
} else { } else {
...@@ -1650,7 +1650,7 @@ xfs_fc_fill_super( ...@@ -1650,7 +1650,7 @@ xfs_fc_fill_super(
"DAX unsupported by block device. Turning off DAX."); "DAX unsupported by block device. Turning off DAX.");
xfs_mount_set_dax_mode(mp, XFS_DAX_NEVER); xfs_mount_set_dax_mode(mp, XFS_DAX_NEVER);
} }
if (xfs_sb_version_hasreflink(&mp->m_sb)) { if (xfs_has_reflink(mp)) {
xfs_alert(mp, xfs_alert(mp,
"DAX and reflink cannot be used together!"); "DAX and reflink cannot be used together!");
error = -EINVAL; error = -EINVAL;
...@@ -1668,7 +1668,7 @@ xfs_fc_fill_super( ...@@ -1668,7 +1668,7 @@ xfs_fc_fill_super(
} }
} }
if (xfs_sb_version_hasreflink(&mp->m_sb)) { if (xfs_has_reflink(mp)) {
if (mp->m_sb.sb_rblocks) { if (mp->m_sb.sb_rblocks) {
xfs_alert(mp, xfs_alert(mp,
"reflink not compatible with realtime device!"); "reflink not compatible with realtime device!");
...@@ -1682,7 +1682,7 @@ xfs_fc_fill_super( ...@@ -1682,7 +1682,7 @@ xfs_fc_fill_super(
} }
} }
if (xfs_sb_version_hasrmapbt(&mp->m_sb) && mp->m_sb.sb_rblocks) { if (xfs_has_rmapbt(mp) && mp->m_sb.sb_rblocks) {
xfs_alert(mp, xfs_alert(mp,
"reverse mapping btree not compatible with realtime device!"); "reverse mapping btree not compatible with realtime device!");
error = -EINVAL; error = -EINVAL;
......
...@@ -62,7 +62,7 @@ xfs_readlink_bmap_ilocked( ...@@ -62,7 +62,7 @@ xfs_readlink_bmap_ilocked(
byte_cnt = pathlen; byte_cnt = pathlen;
cur_chunk = bp->b_addr; cur_chunk = bp->b_addr;
if (xfs_sb_version_hascrc(&mp->m_sb)) { if (xfs_has_crc(mp)) {
if (!xfs_symlink_hdr_ok(ip->i_ino, offset, if (!xfs_symlink_hdr_ok(ip->i_ino, offset,
byte_cnt, bp)) { byte_cnt, bp)) {
error = -EFSCORRUPTED; error = -EFSCORRUPTED;
......
...@@ -275,7 +275,7 @@ xfs_trans_alloc( ...@@ -275,7 +275,7 @@ xfs_trans_alloc(
WARN_ON(resp->tr_logres > 0 && WARN_ON(resp->tr_logres > 0 &&
mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE); mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);
ASSERT(!(flags & XFS_TRANS_RES_FDBLKS) || ASSERT(!(flags & XFS_TRANS_RES_FDBLKS) ||
xfs_sb_version_haslazysbcount(&mp->m_sb)); xfs_has_lazysbcount(mp));
tp->t_magic = XFS_TRANS_HEADER_MAGIC; tp->t_magic = XFS_TRANS_HEADER_MAGIC;
tp->t_flags = flags; tp->t_flags = flags;
...@@ -364,12 +364,12 @@ xfs_trans_mod_sb( ...@@ -364,12 +364,12 @@ xfs_trans_mod_sb(
switch (field) { switch (field) {
case XFS_TRANS_SB_ICOUNT: case XFS_TRANS_SB_ICOUNT:
tp->t_icount_delta += delta; tp->t_icount_delta += delta;
if (xfs_sb_version_haslazysbcount(&mp->m_sb)) if (xfs_has_lazysbcount(mp))
flags &= ~XFS_TRANS_SB_DIRTY; flags &= ~XFS_TRANS_SB_DIRTY;
break; break;
case XFS_TRANS_SB_IFREE: case XFS_TRANS_SB_IFREE:
tp->t_ifree_delta += delta; tp->t_ifree_delta += delta;
if (xfs_sb_version_haslazysbcount(&mp->m_sb)) if (xfs_has_lazysbcount(mp))
flags &= ~XFS_TRANS_SB_DIRTY; flags &= ~XFS_TRANS_SB_DIRTY;
break; break;
case XFS_TRANS_SB_FDBLOCKS: case XFS_TRANS_SB_FDBLOCKS:
...@@ -398,7 +398,7 @@ xfs_trans_mod_sb( ...@@ -398,7 +398,7 @@ xfs_trans_mod_sb(
delta -= blkres_delta; delta -= blkres_delta;
} }
tp->t_fdblocks_delta += delta; tp->t_fdblocks_delta += delta;
if (xfs_sb_version_haslazysbcount(&mp->m_sb)) if (xfs_has_lazysbcount(mp))
flags &= ~XFS_TRANS_SB_DIRTY; flags &= ~XFS_TRANS_SB_DIRTY;
break; break;
case XFS_TRANS_SB_RES_FDBLOCKS: case XFS_TRANS_SB_RES_FDBLOCKS:
...@@ -408,7 +408,7 @@ xfs_trans_mod_sb( ...@@ -408,7 +408,7 @@ xfs_trans_mod_sb(
* be applied to the on-disk superblock. * be applied to the on-disk superblock.
*/ */
tp->t_res_fdblocks_delta += delta; tp->t_res_fdblocks_delta += delta;
if (xfs_sb_version_haslazysbcount(&mp->m_sb)) if (xfs_has_lazysbcount(mp))
flags &= ~XFS_TRANS_SB_DIRTY; flags &= ~XFS_TRANS_SB_DIRTY;
break; break;
case XFS_TRANS_SB_FREXTENTS: case XFS_TRANS_SB_FREXTENTS:
...@@ -488,7 +488,7 @@ xfs_trans_apply_sb_deltas( ...@@ -488,7 +488,7 @@ xfs_trans_apply_sb_deltas(
/* /*
* Only update the superblock counters if we are logging them * Only update the superblock counters if we are logging them
*/ */
if (!xfs_sb_version_haslazysbcount(&(tp->t_mountp->m_sb))) { if (!xfs_has_lazysbcount((tp->t_mountp))) {
if (tp->t_icount_delta) if (tp->t_icount_delta)
be64_add_cpu(&sbp->sb_icount, tp->t_icount_delta); be64_add_cpu(&sbp->sb_icount, tp->t_icount_delta);
if (tp->t_ifree_delta) if (tp->t_ifree_delta)
...@@ -586,7 +586,7 @@ xfs_trans_unreserve_and_mod_sb( ...@@ -586,7 +586,7 @@ xfs_trans_unreserve_and_mod_sb(
if (tp->t_blk_res > 0) if (tp->t_blk_res > 0)
blkdelta = tp->t_blk_res; blkdelta = tp->t_blk_res;
if ((tp->t_fdblocks_delta != 0) && if ((tp->t_fdblocks_delta != 0) &&
(xfs_sb_version_haslazysbcount(&mp->m_sb) || (xfs_has_lazysbcount(mp) ||
(tp->t_flags & XFS_TRANS_SB_DIRTY))) (tp->t_flags & XFS_TRANS_SB_DIRTY)))
blkdelta += tp->t_fdblocks_delta; blkdelta += tp->t_fdblocks_delta;
...@@ -596,7 +596,7 @@ xfs_trans_unreserve_and_mod_sb( ...@@ -596,7 +596,7 @@ xfs_trans_unreserve_and_mod_sb(
(tp->t_flags & XFS_TRANS_SB_DIRTY)) (tp->t_flags & XFS_TRANS_SB_DIRTY))
rtxdelta += tp->t_frextents_delta; rtxdelta += tp->t_frextents_delta;
if (xfs_sb_version_haslazysbcount(&mp->m_sb) || if (xfs_has_lazysbcount(mp) ||
(tp->t_flags & XFS_TRANS_SB_DIRTY)) { (tp->t_flags & XFS_TRANS_SB_DIRTY)) {
idelta = tp->t_icount_delta; idelta = tp->t_icount_delta;
ifreedelta = tp->t_ifree_delta; ifreedelta = tp->t_ifree_delta;
......
...@@ -58,7 +58,7 @@ xfs_trans_log_dquot( ...@@ -58,7 +58,7 @@ xfs_trans_log_dquot(
/* Upgrade the dquot to bigtime format if possible. */ /* Upgrade the dquot to bigtime format if possible. */
if (dqp->q_id != 0 && if (dqp->q_id != 0 &&
xfs_sb_version_hasbigtime(&tp->t_mountp->m_sb) && xfs_has_bigtime(tp->t_mountp) &&
!(dqp->q_type & XFS_DQTYPE_BIGTIME)) !(dqp->q_type & XFS_DQTYPE_BIGTIME))
dqp->q_type |= XFS_DQTYPE_BIGTIME; dqp->q_type |= XFS_DQTYPE_BIGTIME;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册