xfs: rework feature flags
v3 cover xfs: rework feature flags
With the shutdown rework, it became very clear that we needed to make atomic state changes to the mount so that shutdown would be run once and once only. To do this, we used the mp->m_sb_lock as a serialisation mechanism rather than introduce a new single use spinlock for this purpose.
However, what we really need to is to separate the operational state changes from static feature flag information kept in the mp->m_flags field. This would allow the m_flags field to remain largely read-only, and we can make the operational state use atomic bit operations to set, check and clear the current state.
This separation between state and features was done for the log as part of the shutdown cleanup work. Reworking the way the xfs mount feature flags are used is a much bigger undertaking, hence this separate patchset.
One of the big things we need to address is that features for the xfs mount can come from multiple sources. They can come from on-disk state via flags in the superblock, mount options, proc and sysfs variables, and so on. Each different mechanism has it's own special way of setting what is effectively read-only boolean state in the xfs mount that is then checked at runtime by executing code.
In some cases, these boolean checks can be expensive because we have to do multiple cheaks and mask variables in the superblock to get the flag information. The naming can be verbose, and the combination of open coded flag checks vs wrapper based flag checks does little to improve the readability of the code.
To clean all this up, introduce a m_features field and a m_opstate field. The m_features field holds all the features the filesysetm has enabled or disabled, and the m_opstate field holds all the atomic operational state. m_features is currently a 64 bit variable with on-disk features starting at bit 0 counting up and mount features starting at bit 63 and counting down. At the end of the series, we have roughly 26 on-disk and 16 mount feature flags used, so there's still plenty of flag space available for future additions.
The result of moving all the feature flags to the mount is that we get rid of all the xfs_sb_version_has() wrappers in libxfs/xfs_format.h. We really want this file to contain the on-disk format defintion, not code used to access or interpret it. This gets rid of a large amount of boiler plate wrappers from this file and replaces them with mount features checks which are much simpler and lower overhead.
Getting rid of all the sueprblock feature checks reduces the code size by about 5kB on x86-64. There are about 400 xfs_sb_version_has() feature checks in the code, so saving a few instructions on every check ends up making a substantial difference to code size. It also means this patchset is rather large....
There are a few cleanups needed before the patch set starts. We need to fix up the attr2/noattr2 mount option/superblock bit issues, as well as properly namespace some internal attribute code so we can use the global "xfs_" namespace for global feature and operational state functions.
There are many further cleanups that can be done following on from this patch set. e.g the xfs_mount has several boolean state/flag fields that can be moved into the m_opstate and/or m_features variables, we can shadow state and or features into the log fields so the log doesn't need to access the xfs_mount to check current state, runtime quota state can move into the m_opstate field instead of needing separate flags, etc.
This passes fstests for all the simple configurations (defaults, quotas, different directory block sizes, etc) without regressions, so nothing has been obviously broken. The only obvious issue is xfs/187, which expects "-o noattr2" to remove feature bits from the superblock and this behaviour is explicitly removed during this patchset. It is not clear if xfs/187 is a valid test to perform anymore now that noattr2 behaves this way.
Version 3:
- only need a single call to xfs_attr_lookup()
- fix rebase mis-merge of attr2 mount flag setting.
- set the realtime feature flag correctly when adding a rt device via growfs
- fixed attr2 upgrade behaviour regressions.
Version 2:
- https://lore.kernel.org/linux-xfs/[email protected]/
- rebased on 5.14-rc4 + for-next + "xfs: strictly order log start records"
- added comment about not using bp->b_bn directly for the buffer disk address.
- fix typos in commit messages
- Fixed incorrect feature flag macro definitions in original introduction patch rather than fixing them in a subsequent patch.
- Updated open coded superblock checks to check sparse inodes directly instead of via xfs_sb_has_incompat_feature().
- use xfs_has_v3inodes() consistently in inode size/version checks.
Version 1:
- https://lore.kernel.org/linux-xfs/[email protected]/
- based on 5.14-rc1 + "xfs: strictly order log start records"
PATCH v3 1/16 xfs: sb verifier doesn't handle uncached sb buffer
From: Dave Chinner <[email protected]>
The verifier checks explicitly for bp->b_bn == XFS_SB_DADDR to match the primary superblock buffer, but the primary superblock is an uncached buffer and so bp->b_bn is always -1ULL. Hence this never matches and the CRC error reporting is wholly dependent on the mount superblock already being populated so CRC feature checks pass and allow CRC errors to be reported.
Fix this so that the primary superblock CRC error reporting is not dependent on already having read the superblock into memory.
--- fs/xfs/libxfs/xfs_sb.c | 2 +- fs/xfs/xfs_buf.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
fs/xfs/libxfs/xfs_sb.c +1 -1
@@ -636,7 +636,7 @@ xfs_sb_read_verify(if (!xfs_buf_verify_cksum (bp,XFS_SB_CRC_OFF )) {/* Only fail bad secondaries on a known V5 filesystem */ -if (bp->b_bn ==XFS_SB_DADDR || +if (bp->b_maps[0 ].bm_bn ==XFS_SB_DADDR ||xfs_sb_version_hascrc (&mp->m_sb)) { error = -EFSBADCRC ; goto out_error;
fs/xfs/xfs_buf.h +6 -1
@@ -133,7 +133,12 @@ struct xfs_buf {* fast-path on locking. */ struct rhash_head b_rhash_head;/* pag buffer hash node */ -xfs_daddr_t b_bn;/* block number of buffer */ + +/* +* b_bn is the cache index. Do not use directly, use b_maps[0].bm_bn +* for the buffer disk address instead. +*/ +xfs_daddr_t b_bn;int b_length;/* size of buffer in BBs */ atomic_t b_hold;/* reference count */ atomic_t b_lru_ref;/* lru reclaim ref count */
Signature · 1 line
2.31.1
PATCH v3 2/16 xfs: rename xfs_has_attr()
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
xfs_has_attr() is poorly named. It has global scope as it is defined in a header file, but it has no namespace scope that tells us what it is checking has attributes. It's not even clear what "has_attr" means, because what it is actually doing is an attribute fork lookup to see if the attribute exists.
Upcoming patches use this "xfs_has_<foo>" namespace for global filesystem features, which conflicts with this function.
Rename xfs_has_attr() to xfs_attr_lookup() and make it a static function, freeing up the "xfs_has_" namespace for global scope usage.
--- fs/xfs/libxfs/xfs_attr.c | 7 +++---- fs/xfs/libxfs/xfs_attr.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-)
fs/xfs/libxfs/xfs_attr.c +3 -4
@@ -642,8 +642,8 @@ xfs_attr_set_iter(/* * Return EEXIST if attr is found, or ENOATTR if not */ -int -xfs_has_attr ( +static int +xfs_attr_lookup (struct xfs_da_args *args) {struct xfs_inode *dp = args->dp;
@@ -780,8 +780,8 @@ xfs_attr_set( goto out_trans_cancel; } + error =xfs_attr_lookup (args);if (args->value) { - error =xfs_has_attr (args);if (error == -EEXIST && (args->attr_flags &XATTR_CREATE )) goto out_trans_cancel;if (error == -ENOATTR && (args->attr_flags &XATTR_REPLACE ))
@@ -796,7 +796,6 @@ xfs_attr_set(if (!args->trans) goto out_unlock; }else { - error =xfs_has_attr (args);if (error != -EEXIST ) goto out_trans_cancel;
fs/xfs/libxfs/xfs_attr.h +0 -1
@@ -490,7 +490,6 @@ int xfs_attr_get_ilocked(struct xfs_da_args *args);int xfs_attr_get (struct xfs_da_args *args);int xfs_attr_set (struct xfs_da_args *args);int xfs_attr_set_args (struct xfs_da_args *args); -int xfs_has_attr (struct xfs_da_args *args);int xfs_attr_remove_args (struct xfs_da_args *args);int xfs_attr_remove_iter (struct xfs_delattr_context *dac);bool xfs_attr_namecheck (const void *name,size_t length);
Signature · 1 line
2.31.1
PATCH v3 3/16 xfs: rework attr2 feature and mount options
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The attr2 feature is somewhat unique in that it has both a superblock feature bit to enable it and mount options to enable and disable it.
Back when it was first introduced in 2005, attr2 was disabled unless either the attr2 superblock feature bit was set, or the attr2 mount option was set. If the superblock feature bit was not set but the mount option was set, then when the first attr2 format inode fork was created, it would set the superblock feature bit. This is as it should be - the superblock feature bit indicated the presence of the attr2 on disk format.
The noattr2 mount option, however, did not affect the superblock feature bit. If noattr2 was specified, the on-disk superblock feature bit was ignored and the code always just created attr1 format inode forks. If neither of the attr2 or noattr2 mounts option were specified, then the behaviour was determined by the superblock feature bit.
This was all pretty sane.
Fast foward 3 years, and we are dealing with fallout from the botched sb_features2 addition and having to deal with feature mismatches between the sb_features2 and sb_bad_features2 fields. The attr2 feature bit was one of these flags. The reconciliation was done well after mount option parsing and, unfortunately, the feature reconciliation had a bug where it ignored the noattr2 mount option.
For reasons lost to the mists of time, it was decided that resolving this issue in commit 7c12f296500e ("[XFS] Fix up noattr2 so that it will properly update the versionnum and features2 fields.") required noattr2 to clear the superblock attr2 feature bit. This greatly complicated the attr2 behaviour and broke rules about feature bits needing to be set when those specific features are present in the filesystem.
By complicated, I mean that it introduced problems due to feature bit interactions with log recovery. All of the superblock feature bit checks are done prior to log recovery, but if we crash after removing a feature bit, then on the next mount we see the feature bit in the unrecovered superblock, only to have it go away after the log has been replayed. This means our mount time feature processing could be all wrong.
Hence you can mount with noattr2, crash shortly afterwards, and mount again without attr2 or noattr2 and still have attr2 enabled because the second mount sees attr2 still enabled in the superblock before recovery runs and removes the feature bit. It's just a mess.
Further, this is all legacy code as the v5 format requires attr2 to be enabled at all times and it cannot be disabled. i.e. the noattr2 mount option returns an error when used on v5 format filesystems.
To straighten this all out, this patch reverts the attr2/noattr2 mount option behaviour back to the original behaviour. There is no reason for disabling attr2 these days, so we will only do this when the noattr2 mount option is set. This will not remove the superblock feature bit. The superblock bit will provide the default behaviour and only track whether attr2 is present on disk or not. The attr2 mount option will enable the creation of attr2 format inode forks, and if the superblock feature bit is not set it will be added when the first attr2 inode fork is created.
--- fs/xfs/libxfs/xfs_format.h | 7 ------- fs/xfs/xfs_mount.c | 27 ++++++++++----------------- fs/xfs/xfs_super.c | 16 +++++++--------- 3 files changed, 17 insertions(+), 33 deletions(-)
fs/xfs/libxfs/xfs_format.h +0 -7
@@ -398,13 +398,6 @@ static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp) sbp->sb_features2 |=XFS_SB_VERSION2_ATTR2BIT ; } -static inline void xfs_sb_version_removeattr2 (struct xfs_sb *sbp) -{ - sbp->sb_features2 &= ~XFS_SB_VERSION2_ATTR2BIT ; -if (!sbp->sb_features2) - sbp->sb_versionnum &= ~XFS_SB_VERSION_MOREBITSBIT ; -} -static inline bool xfs_sb_version_hasprojid32bit (struct xfs_sb *sbp) { return (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) ||
fs/xfs/xfs_mount.c +10 -17
@@ -612,25 +612,8 @@ xfs_mountfs(xfs_warn (mp,"correcting sb_features alignment problem" ); sbp->sb_features2 |= sbp->sb_bad_features2; mp->m_update_sb = true; - -/* -* Re-check for ATTR2 in case it was found in bad_features2 -* slot. -*/ -if (xfs_sb_version_hasattr2 (&mp->m_sb) && - !(mp->m_flags &XFS_MOUNT_NOATTR2 )) - mp->m_flags |=XFS_MOUNT_ATTR2 ; } -if (xfs_sb_version_hasattr2 (&mp->m_sb) && - (mp->m_flags &XFS_MOUNT_NOATTR2 )) { -xfs_sb_version_removeattr2 (&mp->m_sb); - mp->m_update_sb = true; - -/* update sb_versionnum for the clearing of the morebits */ -if (!sbp->sb_features2) - mp->m_update_sb = true; - }/* always use v2 inodes by default now */ if (!(mp->m_sb.sb_versionnum &XFS_SB_VERSION_NLINKBIT )) {
@@ -795,6 +778,16 @@ xfs_mountfs(xfs_inodegc_start (mp);xfs_blockgc_start (mp); +/* +* Now that we've recovered any pending superblock feature bit +* additions, we can finish setting up the attr2 behaviour for the +* mount. If no attr2 mount options were specified, the we use the +* behaviour specified by the superblock feature bit. +*/ +if (!(mp->m_flags & (XFS_MOUNT_ATTR2 |XFS_MOUNT_NOATTR2 )) && +xfs_sb_version_hasattr2 (&mp->m_sb)) + mp->m_flags |=XFS_MOUNT_ATTR2 ; +/* * Get and sanity-check the root inode. * Save the pointer to it in the mount structure.
fs/xfs/xfs_super.c +7 -9
@@ -968,14 +968,6 @@ xfs_finish_flags(return -EINVAL ; } -/* -* mkfs'ed attr2 will turn on attr2 mount unless explicitly -* told by noattr2 to turn it off -*/ -if (xfs_sb_version_hasattr2 (&mp->m_sb) && - !(mp->m_flags &XFS_MOUNT_NOATTR2 )) - mp->m_flags |=XFS_MOUNT_ATTR2 ; -/* * prohibit r/w mounts of read-only filesystems */
@@ -1338,7 +1330,6 @@ xfs_fs_parse_param(return 0 ;case Opt_noattr2:xfs_fs_warn_deprecated (fc, param,XFS_MOUNT_NOATTR2 , true); - parsing_mp->m_flags &= ~XFS_MOUNT_ATTR2 ; parsing_mp->m_flags |=XFS_MOUNT_NOATTR2 ;return 0 ;default :
@@ -1362,6 +1353,13 @@ xfs_fs_validate_params(return -EINVAL ; } +if ((mp->m_flags & (XFS_MOUNT_ATTR2 |XFS_MOUNT_NOATTR2 )) == + (XFS_MOUNT_ATTR2 |XFS_MOUNT_NOATTR2 )) { +xfs_warn (mp,"attr2 and noattr2 cannot both be specified." ); +return -EINVAL ; + } + +if ((mp->m_flags &XFS_MOUNT_NOALIGN ) && (mp->m_dalign || mp->m_swidth)) { xfs_warn(mp,
Signature · 1 line
2.31.1
PATCH v3 4/16 xfs: reflect sb features in xfs_mount
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Currently on-disk feature checks require decoding the superblock fileds and so can be non-trivial. We have almost 400 hundred individual feature checks in the XFS code, so this is a significant amount of code. To reduce runtime check overhead, pre-process all the version flags into a features field in the xfs_mount at mount time so we can convert all the feature checks to a simple flag check.
There is also a need to convert the dynamic feature flags to update the m_features field. This is required for attr, attr2 and quota features. New xfs_mount based wrappers are added for this.
--- fs/xfs/libxfs/xfs_format.h | 2 +- fs/xfs/libxfs/xfs_sb.c | 66 +++++++++++++++++++++++++++++++++ fs/xfs/libxfs/xfs_sb.h | 1 + fs/xfs/xfs_log_recover.c | 1 + fs/xfs/xfs_mount.c | 1 + fs/xfs/xfs_mount.h | 76 ++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_rtalloc.c | 3 ++ 7 files changed, 149 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_format.h +1 -1
@@ -405,7 +405,7 @@ static inline bool xfs_sb_version_hasprojid32bit(struct xfs_sb *sbp) (sbp->sb_features2 & XFS_SB_VERSION2_PROJID32BIT)); } -static inline void xfs_sb_version_addprojid32bit (struct xfs_sb *sbp) +static inline void xfs_sb_version_addprojid32 (struct xfs_sb *sbp) { sbp->sb_versionnum |=XFS_SB_VERSION_MOREBITSBIT ; sbp->sb_features2 |=XFS_SB_VERSION2_PROJID32BIT ;
fs/xfs/libxfs/xfs_sb.c +66 -0
72 lines not on this page · raw message
fs/xfs/libxfs/xfs_sb.h +1 -0
@@ -20,6 +20,7 @@ extern void xfs_sb_mount_common(struct xfs_mount *mp, struct xfs_sb *sbp);extern void xfs_sb_from_disk (struct xfs_sb *to,struct xfs_dsb *from);extern void xfs_sb_to_disk (struct xfs_dsb *to,struct xfs_sb *from);extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); +extern uint64_t xfs_sb_version_to_features (struct xfs_sb *sbp);extern int xfs_update_secondary_sbs (struct xfs_mount *mp);
fs/xfs/xfs_log_recover.c +1 -0
@@ -3348,6 +3348,7 @@ xlog_do_recover(xfs_buf_relse (bp);/* re-initialise in-core superblock and geometry structures */ + mp->m_features |=xfs_sb_version_to_features (sbp);xfs_reinit_percpu_counters (mp); error =xfs_initialize_perag (mp, sbp->sb_agcount, &mp->m_maxagi);if (error) {
fs/xfs/xfs_mount.c +1 -0
@@ -225,6 +225,7 @@ xfs_readsb( goto reread; } + mp->m_features |=xfs_sb_version_to_features (sbp);xfs_reinit_percpu_counters (mp);/* no need to be quiet anymore, so reset the buf ops */
fs/xfs/xfs_mount.h +76 -0
88 lines not on this page · raw message
fs/xfs/xfs_rtalloc.c +3 -0
@@ -1131,6 +1131,9 @@ xfs_growfs_rt( error =xfs_trans_commit (tp);if (error)break ; + +/* Ensure the mount RT feature flag is now set. */ + mp->m_features |=XFS_FEAT_REALTIME ; }if (error) goto out_free;
Signature · 1 line
2.31.1
PATCH v3 5/16 xfs: replace xfs_sb_version checks with feature flag checks
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
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)
--- fs/xfs/libxfs/xfs_ag.c | 20 +++++++++--------- fs/xfs/libxfs/xfs_alloc.c | 34 +++++++++++++++--------------- fs/xfs/libxfs/xfs_alloc_btree.c | 2 +- fs/xfs/libxfs/xfs_alloc_btree.h | 2 +- fs/xfs/libxfs/xfs_attr_leaf.c | 14 ++++++------ fs/xfs/libxfs/xfs_attr_remote.c | 10 ++++----- fs/xfs/libxfs/xfs_bmap.c | 12 +++++------ fs/xfs/libxfs/xfs_bmap_btree.c | 4 ++-- fs/xfs/libxfs/xfs_bmap_btree.h | 2 +- fs/xfs/libxfs/xfs_btree.c | 14 ++++++------ fs/xfs/libxfs/xfs_da_btree.c | 4 ++-- fs/xfs/libxfs/xfs_da_format.h | 2 +- fs/xfs/libxfs/xfs_dir2_block.c | 6 +++--- fs/xfs/libxfs/xfs_dir2_data.c | 6 +++--- fs/xfs/libxfs/xfs_dir2_leaf.c | 6 +++--- fs/xfs/libxfs/xfs_dir2_node.c | 10 ++++----- fs/xfs/libxfs/xfs_dir2_sf.c | 2 +- fs/xfs/libxfs/xfs_dquot_buf.c | 6 +++--- fs/xfs/libxfs/xfs_format.h | 10 ++++----- fs/xfs/libxfs/xfs_ialloc.c | 14 ++++++------ fs/xfs/libxfs/xfs_ialloc_btree.c | 6 +++--- fs/xfs/libxfs/xfs_ialloc_btree.h | 2 +- fs/xfs/libxfs/xfs_inode_buf.c | 6 +++--- fs/xfs/libxfs/xfs_log_format.h | 4 ++-- fs/xfs/libxfs/xfs_log_rlimit.c | 2 +- fs/xfs/libxfs/xfs_refcount_btree.c | 4 ++-- fs/xfs/libxfs/xfs_rmap.c | 6 +++--- fs/xfs/libxfs/xfs_rmap_btree.c | 6 +++--- fs/xfs/libxfs/xfs_sb.c | 12 +++++------ fs/xfs/libxfs/xfs_symlink_remote.c | 10 ++++----- fs/xfs/libxfs/xfs_trans_resv.c | 12 +++++------ fs/xfs/libxfs/xfs_types.c | 2 +- fs/xfs/scrub/agheader.c | 12 +++++------ fs/xfs/scrub/agheader_repair.c | 20 +++++++++--------- fs/xfs/scrub/attr.c | 2 +- fs/xfs/scrub/bmap.c | 4 ++-- fs/xfs/scrub/common.c | 2 +- fs/xfs/scrub/dabtree.c | 4 ++-- fs/xfs/scrub/dir.c | 10 ++++----- fs/xfs/scrub/ialloc.c | 2 +- fs/xfs/scrub/inode.c | 6 +++--- fs/xfs/scrub/repair.c | 12 +++++------ fs/xfs/scrub/scrub.c | 2 +- fs/xfs/xfs_bmap_util.c | 14 ++++++------ fs/xfs/xfs_buf.c | 6 +++--- fs/xfs/xfs_buf_item.c | 2 +- fs/xfs/xfs_buf_item_recover.c | 8 +++---- fs/xfs/xfs_dir2_readdir.c | 2 +- fs/xfs/xfs_dquot.c | 10 ++++----- fs/xfs/xfs_dquot_item_recover.c | 4 ++-- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_fsmap.c | 4 ++-- fs/xfs/xfs_fsops.c | 2 +- fs/xfs/xfs_icache.c | 2 +- fs/xfs/xfs_inode.c | 10 ++++----- fs/xfs/xfs_inode_item.c | 2 +- fs/xfs/xfs_inode_item_recover.c | 2 +- fs/xfs/xfs_ioctl.c | 8 +++---- fs/xfs/xfs_iops.c | 8 +++---- fs/xfs/xfs_itable.c | 2 +- fs/xfs/xfs_log.c | 18 ++++++++-------- fs/xfs/xfs_log_recover.c | 14 ++++++------ fs/xfs/xfs_mount.c | 13 ++++++------ fs/xfs/xfs_mount.h | 6 +++--- fs/xfs/xfs_qm.c | 14 ++++++------ fs/xfs/xfs_qm_bhv.c | 2 +- fs/xfs/xfs_qm_syscalls.c | 2 +- fs/xfs/xfs_refcount_item.c | 2 +- fs/xfs/xfs_reflink.c | 4 ++-- fs/xfs/xfs_rmap_item.c | 2 +- fs/xfs/xfs_rtalloc.c | 3 +-- fs/xfs/xfs_super.c | 18 ++++++++-------- fs/xfs/xfs_symlink.c | 2 +- fs/xfs/xfs_trans.c | 16 +++++++------- fs/xfs/xfs_trans_dquot.c | 2 +- 75 files changed, 267 insertions(+), 267 deletions(-)
fs/xfs/libxfs/xfs_ag.c +10 -10
@@ -469,7 +469,7 @@ xfs_rmaproot_init( rrec->rm_offset =0 ;/* 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->rm_startblock =cpu_to_be32 (xfs_refc_block (mp)); rrec->rm_blockcount =cpu_to_be32 (1 );
@@ -528,7 +528,7 @@ xfs_agfblock_init( 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_CNTi] =cpu_to_be32 (1 ); -if (xfs_sb_version_hasrmapbt (&mp->m_sb)) { +if (xfs_has_rmapbt (mp)) { agf->agf_roots[XFS_BTNUM_RMAPi] =cpu_to_be32 (XFS_RMAP_BLOCK (mp)); agf->agf_levels[XFS_BTNUM_RMAPi] =cpu_to_be32 (1 );
@@ -541,9 +541,9 @@ xfs_agfblock_init( tmpsize = id->agsize - mp->m_ag_prealloc_blocks; agf->agf_freeblks =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); -if (xfs_sb_version_hasreflink (&mp->m_sb)) { +if (xfs_has_reflink (mp)) { agf->agf_refcount_root =cpu_to_be32 (xfs_refc_block (mp)); agf->agf_refcount_level =cpu_to_be32 (1 );
@@ -569,7 +569,7 @@ xfs_agflblock_init(__be32 *agfl_bno;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_seqno =cpu_to_be32 (id->agno);uuid_copy (&agfl->agfl_uuid, &mp->m_sb.sb_meta_uuid);
@@ -599,9 +599,9 @@ xfs_agiblock_init( agi->agi_freecount =0 ; agi->agi_newino =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); -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_level =cpu_to_be32 (1 ); }
@@ -719,14 +719,14 @@ xfs_ag_init_headers( .ops = &xfs_finobt_buf_ops, .work = &xfs_btroot_init, .type = XFS_BTNUM_FINO, - .need_init = xfs_sb_version_hasfinobt(&mp->m_sb) + .need_init = xfs_has_finobt(mp) }, {/* RMAP root block */ .daddr = XFS_AGB_TO_DADDR(mp, id->agno, XFS_RMAP_BLOCK(mp)), .numblks = BTOBB(mp->m_sb.sb_blocksize), .ops = &xfs_rmapbt_buf_ops, .work = &xfs_rmaproot_init, - .need_init = xfs_sb_version_hasrmapbt(&mp->m_sb) + .need_init = xfs_has_rmapbt(mp) }, {/* REFC root block */ .daddr = XFS_AGB_TO_DADDR(mp, id->agno, xfs_refc_block(mp)),
@@ -734,7 +734,7 @@ xfs_ag_init_headers( .ops = &xfs_refcountbt_buf_ops, .work = &xfs_btroot_init, .type = XFS_BTNUM_REFC, - .need_init = xfs_sb_version_hasreflink(&mp->m_sb) + .need_init = xfs_has_reflink(mp) }, {/* NULL terminating block */ .daddr = XFS_BUF_DADDR_NULL,
fs/xfs/libxfs/xfs_alloc.c +17 -17
@@ -51,7 +51,7 @@ xfs_agfl_size( {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 );return size /sizeof (xfs_agblock_t);
@@ -61,9 +61,9 @@ unsigned intxfs_refc_block ( struct xfs_mount *mp) { -if (xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (xfs_has_rmapbt (mp))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_IBT_BLOCK (mp) +1 ; }
@@ -72,11 +72,11 @@ xfs_extlen_txfs_prealloc_blocks ( struct xfs_mount *mp) { -if (xfs_sb_version_hasreflink (&mp->m_sb)) +if (xfs_has_reflink (mp))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 ; -if (xfs_sb_version_hasfinobt (&mp->m_sb)) +if (xfs_has_finobt (mp))return XFS_FIBT_BLOCK (mp) +1 ;return XFS_IBT_BLOCK (mp) +1 ; }
@@ -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_ALLOC_AGFL_RESERVE ; blocks +=3 ;/* AGF, AGI btree root blocks */ -if (xfs_sb_version_hasfinobt (&mp->m_sb)) +if (xfs_has_finobt (mp)) blocks++;/* finobt root block */ -if (xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (xfs_has_rmapbt (mp)) blocks++;/* rmap root block */ -if (xfs_sb_version_hasreflink (&mp->m_sb)) +if (xfs_has_reflink (mp)) blocks++;/* refcount root block */ return mp->m_sb.sb_agblocks - blocks;
@@ -598,7 +598,7 @@ xfs_agfl_verify(* 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. */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return NULL ;if (!xfs_verify_magic (bp, agfl->agfl_magicnum))
@@ -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 * can't verify just those entries are valid. */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ;if (!xfs_buf_verify_cksum (bp,XFS_AGFL_CRC_OFF ))
@@ -659,7 +659,7 @@ xfs_agfl_write_verify(xfs_failaddr_t fa;/* no verification of non-crc AGFLs */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ; fa =xfs_agfl_verify (bp);
@@ -2373,7 +2373,7 @@ xfs_agfl_needs_reset(int active;/* no agfl header on v4 supers */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return false;/*
@@ -2877,7 +2877,7 @@ xfs_agf_verify(struct xfs_mount *mp = bp->b_mount;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))return __this_address;if (!xfs_log_check_lsn (mp,be64_to_cpu (agf->agf_lsn)))
@@ -2907,7 +2907,7 @@ xfs_agf_verify( be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]) > mp->m_ag_maxlevels)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 ]) > mp->m_rmap_maxlevels))return __this_address;
@@ -2950,7 +2950,7 @@ xfs_agf_read_verify(struct xfs_mount *mp = bp->b_mount;xfs_failaddr_t fa; -if (xfs_sb_version_hascrc (&mp->m_sb) && +if (xfs_has_crc (mp) && !xfs_buf_verify_cksum (bp,XFS_AGF_CRC_OFF ))xfs_verifier_error (bp, -EFSBADCRC , __this_address);else {
@@ -2975,7 +2975,7 @@ xfs_agf_write_verify(return ; } -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ;if (bip)
fs/xfs/libxfs/xfs_alloc_btree.c +1 -1
@@ -498,7 +498,7 @@ xfs_allocbt_init_common(atomic_inc (&pag->pag_ref); cur->bc_ag.pag = pag; -if (xfs_sb_version_hascrc (&mp->m_sb)) +if (xfs_has_crc (mp)) cur->bc_flags |=XFS_BTREE_CRC_BLOCKS ;return cur;
fs/xfs/libxfs/xfs_alloc_btree.h +1 -1
@@ -20,7 +20,7 @@ struct xbtree_afakeroot;* Btree block header size depends on a superblock flag. */ #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)/*
fs/xfs/libxfs/xfs_attr_leaf.c +7 -7
@@ -384,7 +384,7 @@ xfs_attr3_leaf_write_verify(return ; } -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ;if (bip)
@@ -406,7 +406,7 @@ xfs_attr3_leaf_read_verify(struct xfs_mount *mp = bp->b_mount;xfs_failaddr_t fa; -if (xfs_sb_version_hascrc (&mp->m_sb) && +if (xfs_has_crc (mp) && !xfs_buf_verify_cksum (bp,XFS_ATTR3_LEAF_CRC_OFF ))xfs_verifier_error (bp, -EFSBADCRC , __this_address);else {
@@ -627,10 +627,10 @@ STATIC void xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp) {if ((mp->m_flags &XFS_MOUNT_ATTR2 ) && - !(xfs_sb_version_hasattr2 (&mp->m_sb))) { + !(xfs_has_attr2 (mp))) {spin_lock (&mp->m_sb_lock); -if (!xfs_sb_version_hasattr2 (&mp->m_sb)) { -xfs_sb_version_addattr2 (&mp->m_sb); +if (!xfs_has_attr2 (mp)) { +xfs_add_attr2 (mp);spin_unlock (&mp->m_sb_lock);xfs_log_sb (tp); }else
@@ -1199,7 +1199,7 @@ xfs_attr3_leaf_to_node(xfs_trans_buf_set_type (args->trans, bp2,XFS_BLFT_ATTR_LEAF_BUF ); bp2->b_ops = bp1->b_ops;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; hdr3->blkno =cpu_to_be64 (bp2->b_bn); }
@@ -1264,7 +1264,7 @@ xfs_attr3_leaf_create(memset (&ichdr,0 ,sizeof (ichdr)); 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; ichdr.magic =XFS_ATTR3_LEAF_MAGIC ;
fs/xfs/libxfs/xfs_attr_remote.c +5 -5
@@ -51,7 +51,7 @@ xfs_attr3_rmt_blocks(struct xfs_mount *mp, 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);return (attrlen + buflen -1 ) / buflen; }
@@ -126,7 +126,7 @@ __xfs_attr3_rmt_read_verify(int blksize = mp->m_attr_geo->blksize;/* no verification of non-crc buffers */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return 0 ; ptr = bp->b_addr;
@@ -191,7 +191,7 @@ xfs_attr3_rmt_write_verify(xfs_daddr_t bno;/* no verification of non-crc buffers */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ; ptr = bp->b_addr;
@@ -246,7 +246,7 @@ xfs_attr3_rmt_hdr_set( {struct xfs_attr3_rmt_hdr *rmt = ptr; -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return 0 ; rmt->rm_magic =cpu_to_be32 (XFS_ATTR3_RMT_MAGIC );
@@ -296,7 +296,7 @@ xfs_attr_rmtval_copyout( 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, byte_cnt, bno)) { xfs_alert(mp,
fs/xfs/libxfs/xfs_bmap.c +6 -6
@@ -1115,17 +1115,17 @@ xfs_bmap_add_attrfork(xfs_trans_log_inode (tp, ip, logflags);if (error) goto trans_cancel; -if (!xfs_sb_version_hasattr (&mp->m_sb) || - (!xfs_sb_version_hasattr2 (&mp->m_sb) && version ==2 )) { +if (!xfs_has_attr (mp) || + (!xfs_has_attr2 (mp) && version ==2 )) {bool log_sb = false;spin_lock (&mp->m_sb_lock); -if (!xfs_sb_version_hasattr (&mp->m_sb)) { -xfs_sb_version_addattr (&mp->m_sb); +if (!xfs_has_attr (mp)) { +xfs_add_attr (mp); log_sb = true; } -if (!xfs_sb_version_hasattr2 (&mp->m_sb) && version ==2 ) { -xfs_sb_version_addattr2 (&mp->m_sb); +if (!xfs_has_attr2 (mp) && version ==2 ) { +xfs_add_attr2 (mp); log_sb = true; }spin_unlock (&mp->m_sb_lock);
fs/xfs/libxfs/xfs_bmap_btree.c +2 -2
@@ -136,7 +136,7 @@ xfs_bmbt_to_bmdr(xfs_bmbt_key_t *tkp;__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 (uuid_equal (&rblock->bb_u.l.bb_uuid, &mp->m_sb.sb_meta_uuid));
@@ -563,7 +563,7 @@ xfs_bmbt_init_cursor( cur->bc_ops = &xfs_bmbt_ops; 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_ino.forksize =XFS_IFORK_SIZE (ip, whichfork);
fs/xfs/libxfs/xfs_bmap_btree.h +1 -1
@@ -16,7 +16,7 @@ struct xfs_trans;* Btree block header size depends on a superblock flag. */ #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)#define XFS_BMBT_REC_ADDR (mp, block, index) \
fs/xfs/libxfs/xfs_btree.c +7 -7
@@ -64,7 +64,7 @@ __xfs_btree_check_lblock( {struct xfs_mount *mp = cur->bc_mp;xfs_btnum_t btnum = cur->bc_btnum; -int crc =xfs_sb_version_hascrc (&mp->m_sb); +int crc =xfs_has_crc (mp);if (crc) {if (!uuid_equal (&block->bb_u.l.bb_uuid, &mp->m_sb.sb_meta_uuid))
@@ -129,7 +129,7 @@ __xfs_btree_check_sblock( {struct xfs_mount *mp = cur->bc_mp;xfs_btnum_t btnum = cur->bc_btnum; -int crc =xfs_sb_version_hascrc (&mp->m_sb); +int crc =xfs_has_crc (mp);if (crc) {if (!uuid_equal (&block->bb_u.s.bb_uuid, &mp->m_sb.sb_meta_uuid))
@@ -287,7 +287,7 @@ xfs_btree_lblock_verify_crc(struct xfs_btree_block *block =XFS_BUF_TO_BLOCK (bp);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)))return false;return xfs_buf_verify_cksum (bp,XFS_BTREE_LBLOCK_CRC_OFF );
@@ -325,7 +325,7 @@ xfs_btree_sblock_verify_crc(struct xfs_btree_block *block =XFS_BUF_TO_BLOCK (bp);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)))return false;return xfs_buf_verify_cksum (bp,XFS_BTREE_SBLOCK_CRC_OFF );
@@ -1090,7 +1090,7 @@ xfs_btree_init_block_int(__u64 owner, 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); buf->bb_magic =cpu_to_be32 (magic);
@@ -4418,7 +4418,7 @@ xfs_btree_lblock_v5hdr_verify(struct xfs_mount *mp = bp->b_mount;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;if (!uuid_equal (&block->bb_u.l.bb_uuid, &mp->m_sb.sb_meta_uuid))return __this_address;
@@ -4468,7 +4468,7 @@ xfs_btree_sblock_v5hdr_verify(struct xfs_btree_block *block =XFS_BUF_TO_BLOCK (bp);struct xfs_perag *pag = bp->b_pag; -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return __this_address;if (!uuid_equal (&block->bb_u.s.bb_uuid, &mp->m_sb.sb_meta_uuid))return __this_address;
fs/xfs/libxfs/xfs_da_btree.c +2 -2
@@ -253,7 +253,7 @@ xfs_da3_node_write_verify(return ; } -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ;if (bip)
@@ -442,7 +442,7 @@ xfs_da3_node_create(xfs_trans_buf_set_type (tp, bp,XFS_BLFT_DA_NODE_BUF ); 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;memset (hdr3,0 ,sizeof (struct xfs_da3_node_hdr ));
fs/xfs/libxfs/xfs_da_format.h +1 -1
@@ -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_BUF_SPACE (mp, bufsize) \ - ((bufsize) - (xfs_sb_version_hascrc(&(mp)->m_sb) ? \ + ((bufsize) - (xfs_has_crc((mp)) ? \ sizeof(struct xfs_attr3_rmt_hdr) : 0))/* Number of bytes in a directory block. */
fs/xfs/libxfs/xfs_dir2_block.c +3 -3
@@ -71,7 +71,7 @@ xfs_dir3_block_read_verify(struct xfs_mount *mp = bp->b_mount;xfs_failaddr_t fa; -if (xfs_sb_version_hascrc (&mp->m_sb) && +if (xfs_has_crc (mp) && !xfs_buf_verify_cksum (bp,XFS_DIR3_DATA_CRC_OFF ))xfs_verifier_error (bp, -EFSBADCRC , __this_address);else {
@@ -96,7 +96,7 @@ xfs_dir3_block_write_verify(return ; } -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ;if (bip)
@@ -171,7 +171,7 @@ xfs_dir3_block_init( bp->b_ops = &xfs_dir3_block_buf_ops;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)); hdr3->magic =cpu_to_be32 (XFS_DIR3_BLOCK_MAGIC ); hdr3->blkno =cpu_to_be64 (bp->b_bn);
fs/xfs/libxfs/xfs_dir2_data.c +3 -3
@@ -343,7 +343,7 @@ xfs_dir3_data_read_verify(struct xfs_mount *mp = bp->b_mount;xfs_failaddr_t fa; -if (xfs_sb_version_hascrc (&mp->m_sb) && +if (xfs_has_crc (mp) && !xfs_buf_verify_cksum (bp,XFS_DIR3_DATA_CRC_OFF ))xfs_verifier_error (bp, -EFSBADCRC , __this_address);else {
@@ -368,7 +368,7 @@ xfs_dir3_data_write_verify(return ; } -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ;if (bip)
@@ -717,7 +717,7 @@ xfs_dir3_data_init(* Initialize the header. */ 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;memset (hdr3,0 ,sizeof (*hdr3));
fs/xfs/libxfs/xfs_dir2_leaf.c +3 -3
@@ -209,7 +209,7 @@ xfs_dir3_leaf_read_verify(struct xfs_mount *mp = bp->b_mount;xfs_failaddr_t fa; -if (xfs_sb_version_hascrc (&mp->m_sb) && +if (xfs_has_crc (mp) && !xfs_buf_verify_cksum (bp,XFS_DIR3_LEAF_CRC_OFF ))xfs_verifier_error (bp, -EFSBADCRC , __this_address);else {
@@ -234,7 +234,7 @@ xfs_dir3_leaf_write_verify(return ; } -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ;if (bip)
@@ -308,7 +308,7 @@ xfs_dir3_leaf_init(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;memset (leaf3,0 ,sizeof (*leaf3));
fs/xfs/libxfs/xfs_dir2_node.c +5 -5
@@ -105,7 +105,7 @@ xfs_dir3_free_verify(if (!xfs_verify_magic (bp, hdr->magic))return __this_address; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;if (!uuid_equal (&hdr3->uuid, &mp->m_sb.sb_meta_uuid))
@@ -128,7 +128,7 @@ xfs_dir3_free_read_verify(struct xfs_mount *mp = bp->b_mount;xfs_failaddr_t fa; -if (xfs_sb_version_hascrc (&mp->m_sb) && +if (xfs_has_crc (mp) && !xfs_buf_verify_cksum (bp,XFS_DIR3_FREE_CRC_OFF ))xfs_verifier_error (bp, -EFSBADCRC , __this_address);else {
@@ -153,7 +153,7 @@ xfs_dir3_free_write_verify(return ; } -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ;if (bip)
@@ -185,7 +185,7 @@ xfs_dir3_free_header_check( firstdb = (xfs_dir2_da_to_db (mp->m_dir_geo, fbno) -xfs_dir2_byte_to_db (mp->m_dir_geo,XFS_DIR2_FREE_OFFSET )) * maxbests; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {struct xfs_dir3_free_hdr *hdr3 = bp->b_addr;if (be32_to_cpu (hdr3->firstdb) != firstdb)
@@ -341,7 +341,7 @@ xfs_dir3_free_get_buf(memset (bp->b_addr,0 ,sizeof (struct xfs_dir3_free_hdr ));memset (&hdr,0 ,sizeof (hdr)); -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {struct xfs_dir3_free_hdr *hdr3 = bp->b_addr; hdr.magic =XFS_DIR3_FREE_MAGIC ;
fs/xfs/libxfs/xfs_dir2_sf.c +1 -1
@@ -192,7 +192,7 @@ xfs_dir2_block_sfsize(* if there is a filetype field, add the extra byte to the namelen * 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 ; btp =xfs_dir2_block_tail_p (geo, hdr);
fs/xfs/libxfs/xfs_dquot_buf.c +3 -3
@@ -106,7 +106,7 @@ xfs_dqblk_verify( struct xfs_dqblk *dqb, 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)) return __this_address;
@@ -134,7 +134,7 @@ xfs_dqblk_repair( dqb->dd_diskdq.d_type = type; 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);xfs_update_cksum ((char *)dqb,sizeof (struct xfs_dqblk ),XFS_DQUOT_CRC_OFF );
@@ -151,7 +151,7 @@ xfs_dquot_buf_verify_crc(int ndquots;int i; -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return true;/*
fs/xfs/libxfs/xfs_format.h +5 -5
@@ -398,7 +398,7 @@ static inline void xfs_sb_version_addattr2(struct xfs_sb *sbp) 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) || (xfs_sb_version_hasmorebits(sbp) &&
@@ -528,7 +528,7 @@ static inline bool xfs_dinode_good_version(struct xfs_sb *sbp,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 ; }
@@ -1462,7 +1462,7 @@ struct xfs_dsymlink_hdr {#define XFS_SYMLINK_MAPS 3#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))
@@ -1694,7 +1694,7 @@ struct xfs_rmap_key {typedef __be32 xfs_rmap_ptr_t ;#define XFS_RMAP_BLOCK (mp) \ - (xfs_sb_version_hasfinobt(&((mp)->m_sb)) ? \ + (xfs_has_finobt(((mp))) ? \ XFS_FIBT_BLOCK(mp) + 1 : \ XFS_IBT_BLOCK(mp) + 1)
@@ -1926,7 +1926,7 @@ struct xfs_acl {* limited only by the maximum size of the xattr that stores the information. */ #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)) / \ sizeof(struct xfs_acl_entry) \ : 25)
fs/xfs/libxfs/xfs_ialloc.c +7 -7
@@ -58,7 +58,7 @@ xfs_inobt_update(union xfs_btree_rec rec; rec.inobt.ir_startino =cpu_to_be32 (irec->ir_startino); -if (xfs_sb_version_hassparseinodes (&cur->bc_mp->m_sb)) { +if (xfs_has_sparseinodes (cur->bc_mp)) { rec.inobt.ir_u.sp.ir_holemask =cpu_to_be16 (irec->ir_holemask); rec.inobt.ir_u.sp.ir_count = irec->ir_count; rec.inobt.ir_u.sp.ir_freecount = irec->ir_freecount;
@@ -78,7 +78,7 @@ xfs_inobt_btrec_to_irec( struct xfs_inobt_rec_incore *irec) { irec->ir_startino =be32_to_cpu (rec->inobt.ir_startino); -if (xfs_sb_version_hassparseinodes (&mp->m_sb)) { +if (xfs_has_sparseinodes (mp)) { irec->ir_holemask =be16_to_cpu (rec->inobt.ir_u.sp.ir_holemask); irec->ir_count = rec->inobt.ir_u.sp.ir_count; irec->ir_freecount = rec->inobt.ir_u.sp.ir_freecount;
@@ -2478,7 +2478,7 @@ xfs_agi_verify(struct xfs_agi *agi = bp->b_addr;int i; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {if (!uuid_equal (&agi->agi_uuid, &mp->m_sb.sb_meta_uuid))return __this_address;if (!xfs_log_check_lsn (mp,be64_to_cpu (agi->agi_lsn)))
@@ -2497,7 +2497,7 @@ xfs_agi_verify( be32_to_cpu(agi->agi_level) > M_IGEO(mp)->inobt_maxlevels)return __this_address; -if (xfs_sb_version_hasfinobt (&mp->m_sb) && +if (xfs_has_finobt (mp) && (be32_to_cpu (agi->agi_free_level) <1 ||be32_to_cpu (agi->agi_free_level) >M_IGEO (mp)->inobt_maxlevels))return __this_address;
@@ -2528,7 +2528,7 @@ xfs_agi_read_verify(struct xfs_mount *mp = bp->b_mount;xfs_failaddr_t fa; -if (xfs_sb_version_hascrc (&mp->m_sb) && +if (xfs_has_crc (mp) && !xfs_buf_verify_cksum (bp,XFS_AGI_CRC_OFF ))xfs_verifier_error (bp, -EFSBADCRC , __this_address);else {
@@ -2553,7 +2553,7 @@ xfs_agi_write_verify(return ; } -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ;if (bip)
@@ -2953,7 +2953,7 @@ xfs_ialloc_check_shrink(int has;int error; -if (!xfs_sb_version_hassparseinodes (&mp->m_sb)) +if (!xfs_has_sparseinodes (mp))return 0 ; pag =xfs_perag_get (mp, agno);
fs/xfs/libxfs/xfs_ialloc_btree.c +3 -3
@@ -212,7 +212,7 @@ xfs_inobt_init_rec_from_cur( union xfs_btree_rec *rec) { 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 =cpu_to_be16 (cur->bc_rec.i.ir_holemask); rec->inobt.ir_u.sp.ir_count = cur->bc_rec.i.ir_count;
@@ -446,7 +446,7 @@ xfs_inobt_init_common( 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 ;/* take a reference for the cursor */
@@ -737,7 +737,7 @@ xfs_finobt_calc_reserves(xfs_extlen_t tree_len =0 ;int error; -if (!xfs_sb_version_hasfinobt (&mp->m_sb)) +if (!xfs_has_finobt (mp))return 0 ;if (xfs_sb_version_hasinobtcounts (&mp->m_sb))
fs/xfs/libxfs/xfs_ialloc_btree.h +1 -1
@@ -19,7 +19,7 @@ struct xfs_perag;* Btree block header size depends on a superblock flag. */ #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)/*
fs/xfs/libxfs/xfs_inode_buf.c +3 -3
@@ -515,7 +515,7 @@ xfs_dinode_verify(/* don't allow reflink/cowextsize if we don't have reflink */ if ((flags2 & (XFS_DIFLAG2_REFLINK |XFS_DIFLAG2_COWEXTSIZE )) && - !xfs_sb_version_hasreflink (&mp->m_sb)) + !xfs_has_reflink (mp))return __this_address;/* only regular files get reflink */
@@ -550,7 +550,7 @@ xfs_dinode_calc_crc(if (dip->di_version <3 )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,XFS_DINODE_CRC_OFF ); dip->di_crc =xfs_end_cksum (crc);
@@ -677,7 +677,7 @@ xfs_inode_validate_cowextsize( hint_flag = (flags2 &XFS_DIFLAG2_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;if (hint_flag && !(S_ISDIR (mode) ||S_ISREG (mode)))
fs/xfs/libxfs/xfs_log_format.h +2 -2
@@ -41,10 +41,10 @@ typedef uint32_t xlog_tid_t;#define XFS_MIN_LOG_FACTOR 3#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))#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))/* get lsn fields */
fs/xfs/libxfs/xfs_log_rlimit.c +1 -1
@@ -92,7 +92,7 @@ xfs_log_calc_minimum_size(if (tres.tr_logcount >1 ) 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);/*
fs/xfs/libxfs/xfs_refcount_btree.c +2 -2
@@ -209,7 +209,7 @@ xfs_refcountbt_verify(if (!xfs_verify_magic (bp, block->bb_magic))return __this_address; -if (!xfs_sb_version_hasreflink (&mp->m_sb)) +if (!xfs_has_reflink (mp))return __this_address; fa =xfs_btree_sblock_v5hdr_verify (bp);if (fa)
@@ -462,7 +462,7 @@ xfs_refcountbt_calc_reserves(xfs_extlen_t tree_len;int error; -if (!xfs_sb_version_hasreflink (&mp->m_sb)) +if (!xfs_has_reflink (mp))return 0 ; error =xfs_alloc_read_agf (mp, tp, pag->pag_agno,0 , &agbp);
fs/xfs/libxfs/xfs_rmap.c +3 -3
@@ -705,7 +705,7 @@ xfs_rmap_free(struct xfs_btree_cur *cur;int error; -if (!xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (!xfs_has_rmapbt (mp))return 0 ; cur =xfs_rmapbt_init_cursor (mp, tp, agbp, pag);
@@ -959,7 +959,7 @@ xfs_rmap_alloc(struct xfs_btree_cur *cur;int error; -if (!xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (!xfs_has_rmapbt (mp))return 0 ; cur =xfs_rmapbt_init_cursor (mp, tp, agbp, pag);
@@ -2459,7 +2459,7 @@ xfs_rmap_update_is_needed( struct xfs_mount *mp, int whichfork) { -return xfs_sb_version_hasrmapbt (&mp->m_sb) && whichfork !=XFS_COW_FORK ; +return xfs_has_rmapbt (mp) && whichfork !=XFS_COW_FORK ; }/*
fs/xfs/libxfs/xfs_rmap_btree.c +3 -3
@@ -304,7 +304,7 @@ xfs_rmapbt_verify(if (!xfs_verify_magic (bp, block->bb_magic))return __this_address; -if (!xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (!xfs_has_rmapbt (mp))return __this_address; fa =xfs_btree_sblock_v5hdr_verify (bp);if (fa)
@@ -558,7 +558,7 @@ xfs_rmapbt_compute_maxlevels(* disallow reflinking when less than 10% of the per-AG metadata * 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 ;else mp->m_rmap_maxlevels = xfs_btree_compute_maxlevels(
@@ -606,7 +606,7 @@ xfs_rmapbt_calc_reserves(xfs_extlen_t tree_len;int error; -if (!xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (!xfs_has_rmapbt (mp))return 0 ; error =xfs_alloc_read_agf (mp, tp, pag->pag_agno,0 , &agbp);
fs/xfs/libxfs/xfs_sb.c +6 -6
@@ -239,7 +239,7 @@ xfs_validate_sb_common(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 )) {xfs_notice (mp,"Version 5 of Super block has XFS_OQUOTA bits." );
@@ -378,7 +378,7 @@ xfs_validate_sb_common( XFS_FSB_TO_B(mp, sbp->sb_width), 0, false))return -EFSCORRUPTED ; -if (xfs_sb_version_hascrc (&mp->m_sb) && +if (xfs_sb_version_hascrc (sbp) && sbp->sb_blocksize <XFS_MIN_CRC_BLOCKSIZE ) {xfs_notice (mp,"v5 SB sanity check failed" );return -EFSCORRUPTED ;
@@ -427,7 +427,7 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp)* We need to do these manipilations only if we are working * with an older version of on-disk superblock. */ -if (xfs_sb_version_has_pquotino (sbp)) +if (xfs_sb_version_haspquotino (sbp))return ;if (sbp->sb_qflags &XFS_OQUOTA_ENFD )
@@ -545,7 +545,7 @@ xfs_sb_quota_to_disk(uint16_t qflags = from->sb_qflags; 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_gquotino =cpu_to_be64 (from->sb_gquotino); to->sb_pquotino =cpu_to_be64 (from->sb_pquotino);
@@ -770,7 +770,7 @@ xfs_sb_write_verify(if (error) goto out_error; -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_sb_version_hascrc (&sb))return ;if (bip)
@@ -1066,7 +1066,7 @@ xfs_fs_geometry( geo->flags |=XFS_FSOP_GEOM_FLAGS_LAZYSB ;if (xfs_sb_version_hasattr2 (sbp)) 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 ;if (xfs_sb_version_hascrc (sbp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_V5SB ;
fs/xfs/libxfs/xfs_symlink_remote.c +5 -5
@@ -42,7 +42,7 @@ xfs_symlink_hdr_set( {struct xfs_dsymlink_hdr *dsl = bp->b_addr; -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return 0 ;memset (dsl,0 ,sizeof (struct xfs_dsymlink_hdr ));
@@ -89,7 +89,7 @@ xfs_symlink_verify(struct xfs_mount *mp = bp->b_mount;struct xfs_dsymlink_hdr *dsl = bp->b_addr; -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return __this_address;if (!xfs_verify_magic (bp, dsl->sl_magic))return __this_address;
@@ -116,7 +116,7 @@ xfs_symlink_read_verify(xfs_failaddr_t fa;/* no verification of non-crc buffers */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ;if (!xfs_buf_verify_cksum (bp,XFS_SYMLINK_CRC_OFF ))
@@ -137,7 +137,7 @@ xfs_symlink_write_verify(xfs_failaddr_t fa;/* no verification of non-crc buffers */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ; fa =xfs_symlink_verify (bp);
@@ -173,7 +173,7 @@ xfs_symlink_local_to_remote(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 ;memcpy (bp->b_addr, ifp->if_u1.if_data, ifp->if_bytes);xfs_trans_log_buf (tp, bp,0 , ifp->if_bytes -1 );
fs/xfs/libxfs/xfs_trans_resv.c +6 -6
@@ -71,9 +71,9 @@ xfs_allocfree_log_count(uint blocks; 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 ); -if (xfs_sb_version_hasreflink (&mp->m_sb)) +if (xfs_has_reflink (mp)) blocks += num_ops * (2 * mp->m_refc_maxlevels -1 );return blocks;
@@ -155,7 +155,7 @@ STATIC uintxfs_calc_finobt_res ( struct xfs_mount *mp) { -if (!xfs_sb_version_hasfinobt (&mp->m_sb)) +if (!xfs_has_finobt (mp))return 0 ;return xfs_calc_inobt_res (mp);
@@ -819,14 +819,14 @@ xfs_trans_resv_calc(* require a permanent reservation on space. */ 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 ;else resp->tr_write.tr_logcount =XFS_WRITE_LOG_COUNT ; resp->tr_write.tr_logflags |=XFS_TRANS_PERM_LOG_RES ; 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 =XFS_ITRUNCATE_LOG_COUNT_REFLINK ;else
@@ -887,7 +887,7 @@ xfs_trans_resv_calc( resp->tr_growrtalloc.tr_logflags |=XFS_TRANS_PERM_LOG_RES ; 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 ;else resp->tr_qm_dqalloc.tr_logcount =XFS_WRITE_LOG_COUNT ;
fs/xfs/libxfs/xfs_types.c +1 -1
@@ -169,7 +169,7 @@ xfs_internal_inum( xfs_ino_t ino) {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)); }
fs/xfs/scrub/agheader.c +6 -6
@@ -283,7 +283,7 @@ xchk_superblock( (cpu_to_be32(mp->m_sb.sb_features2) & features_mask))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 */ if (memchr_inv(&sb->sb_features_compat, 0, sizeof(struct xfs_dsb) -
@@ -334,7 +334,7 @@ xchk_superblock(/* 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 */ if (!uuid_equal (&sb->sb_meta_uuid, &mp->m_sb.sb_meta_uuid))xchk_block_set_corrupt (sc, bp);
@@ -449,7 +449,7 @@ xchk_agf_xref_btreeblks(* 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. */ -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)return ;
@@ -562,7 +562,7 @@ xchk_agf(if (level <=0 || level >XFS_BTREE_MAXLEVELS )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 ]);if (!xfs_verify_agbno (mp, agno, agbno))xchk_block_set_corrupt (sc, sc->sa.agf_bp);
@@ -572,7 +572,7 @@ xchk_agf(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);if (!xfs_verify_agbno (mp, agno, agbno))xchk_block_set_corrupt (sc, sc->sa.agf_bp);
@@ -883,7 +883,7 @@ xchk_agi(if (level <=0 || level >XFS_BTREE_MAXLEVELS )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);if (!xfs_verify_agbno (mp, agno, agbno))xchk_block_set_corrupt (sc, sc->sa.agi_bp);
fs/xfs/scrub/agheader_repair.c +10 -10
@@ -164,7 +164,7 @@ xrep_agf_find_btrees(return -EFSCORRUPTED ;/* 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 ]))return -EFSCORRUPTED ;
@@ -193,7 +193,7 @@ xrep_agf_init_header( agf->agf_flfirst = old_agf->agf_flfirst; agf->agf_fllast = old_agf->agf_fllast; 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);/* Mark the incore AGF data stale until we're done fixing things. */
@@ -223,7 +223,7 @@ xrep_agf_set_roots( agf->agf_levels[XFS_BTNUM_RMAPi] =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 =cpu_to_be32 (fab[XREP_AGF_REFCOUNTBT ].root); agf->agf_refcount_level =
@@ -280,7 +280,7 @@ xrep_agf_calc_from_btrees( agf->agf_btreeblks =cpu_to_be32 (btreeblks);/* 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, sc->sa.pag); error =xfs_btree_count_blocks (cur, &blocks);
@@ -363,7 +363,7 @@ xrep_agf(int error;/* We require the rmapbt to rebuild anything. */ -if (!xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (!xfs_has_rmapbt (mp))return -EOPNOTSUPP ;/*
@@ -637,7 +637,7 @@ xrep_agfl(int error;/* We require the rmapbt to rebuild anything. */ -if (!xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (!xfs_has_rmapbt (mp))return -EOPNOTSUPP ;xbitmap_init (&agfl_extents);
@@ -735,7 +735,7 @@ xrep_agi_find_btrees(return -EFSCORRUPTED ;/* 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 ]))return -EFSCORRUPTED ;
@@ -763,7 +763,7 @@ xrep_agi_init_header( agi->agi_length =cpu_to_be32 (xfs_ag_block_count (mp, sc->sa.agno)); agi->agi_newino =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);/* We don't know how to fix the unlinked list yet. */
@@ -785,7 +785,7 @@ xrep_agi_set_roots( agi->agi_root =cpu_to_be32 (fab[XREP_AGI_INOBT ].root); 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_level =cpu_to_be32 (fab[XREP_AGI_FINOBT ].height); }
@@ -891,7 +891,7 @@ xrep_agi(int error;/* We require the rmapbt to rebuild anything. */ -if (!xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (!xfs_has_rmapbt (mp))return -EOPNOTSUPP ;/*
fs/xfs/scrub/attr.c +1 -1
@@ -336,7 +336,7 @@ xchk_xattr_block(bitmap_zero (usedmap, mp->m_attr_geo->blksize);/* 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; if (leaf->hdr.pad1 != 0 || leaf->hdr.pad2 != 0 ||
fs/xfs/scrub/bmap.c +2 -2
@@ -400,7 +400,7 @@ xchk_bmapbt_rec(* Check the owners of the btree blocks up to the level below * 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 ) {for (i =0 ; i < bs->cur->bc_nlevels -1 ; i++) { block =xfs_btree_get_block (bs->cur, i, &bp);
@@ -581,7 +581,7 @@ xchk_bmap_check_rmaps(bool zero_size;int error; -if (!xfs_sb_version_hasrmapbt (&sc->mp->m_sb) || +if (!xfs_has_rmapbt (sc->mp) || whichfork ==XFS_COW_FORK || (sc->sm->sm_flags &XFS_SCRUB_OFLAG_CORRUPT ))return 0 ;
fs/xfs/scrub/common.c +1 -1
@@ -832,7 +832,7 @@ xchk_metadata_inode_forks(return error;/* 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, &shared); if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, 0,
fs/xfs/scrub/dabtree.c +2 -2
@@ -367,11 +367,11 @@ xchk_da_btree_block( pmaxrecs = &ds->maxrecs[level];/* 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);/* 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);if (owner != ip->i_ino)xchk_da_set_corrupt (ds, level);
fs/xfs/scrub/dir.c +5 -5
@@ -51,7 +51,7 @@ xchk_dir_check_ftype(int ino_dtype;int error =0 ; -if (!xfs_sb_version_hasftype (&mp->m_sb)) { +if (!xfs_has_ftype (mp)) {if (dtype !=DT_UNKNOWN && dtype !=DT_DIR )xchk_fblock_set_corrupt (sdc->sc,XFS_DATA_FORK , offset);
@@ -140,7 +140,7 @@ xchk_dir_actor(if (!strncmp ("." , name, namelen)) {/* 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 , offset); checked_ftype = true;
@@ -152,7 +152,7 @@ xchk_dir_actor(* If this is ".." in the root inode, check that the inum * 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 , offset); checked_ftype = true;
@@ -526,7 +526,7 @@ xchk_directory_leaf1_bestfree( bestcount =be32_to_cpu (ltp->bestcount); 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;if (hdr3->pad !=cpu_to_be32 (0 ))
@@ -623,7 +623,7 @@ xchk_directory_free_bestfree(return error;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;if (hdr3->pad !=cpu_to_be32 (0 ))
fs/xfs/scrub/ialloc.c +1 -1
@@ -517,7 +517,7 @@ xchk_iallocbt_xref_rmap_btreeblks(int error;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))return ;
fs/xfs/scrub/inode.c +3 -3
@@ -181,7 +181,7 @@ xchk_inode_flags2(/* reflink flag requires reflink feature */ if ((flags2 &XFS_DIFLAG2_REFLINK ) && - !xfs_sb_version_hasreflink (&mp->m_sb)) + !xfs_has_reflink (mp)) goto bad;/* cowextsize flag is checked w.r.t. mode separately */
@@ -278,7 +278,7 @@ xchk_dinode(xchk_ino_set_corrupt (sc, ino);if (dip->di_projid_hi !=0 && - !xfs_sb_version_hasprojid32bit (&mp->m_sb)) + !xfs_has_projid32 (mp))xchk_ino_set_corrupt (sc, ino);break ;default :
@@ -560,7 +560,7 @@ xchk_inode_check_reflink_iflag(bool has_shared;int error; -if (!xfs_sb_version_hasreflink (&mp->m_sb)) +if (!xfs_has_reflink (mp))return ; error = xfs_reflink_inode_has_shared_extents(sc->tp, sc->ip,
fs/xfs/scrub/repair.c +6 -6
@@ -248,19 +248,19 @@ xrep_calc_ag_resblks(* bnobt/cntbt or inobt/finobt as pairs. */ 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 /XFS_INODES_PER_HOLEMASK_BIT );else inobt_sz =xfs_iallocbt_calc_size (mp, icount /XFS_INODES_PER_CHUNK ); -if (xfs_sb_version_hasfinobt (&mp->m_sb)) +if (xfs_has_finobt (mp)) inobt_sz *=2 ; -if (xfs_sb_version_hasreflink (&mp->m_sb)) +if (xfs_has_reflink (mp)) refcbt_sz =xfs_refcountbt_calc_size (mp, usedlen);else 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. * For non-reflink filesystems we can't have more records than
@@ -269,7 +269,7 @@ xrep_calc_ag_resblks(* many rmaps there could be in the AG, so we start off with * 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, (unsigned long long )aglen *2 );else
@@ -611,7 +611,7 @@ xrep_reap_extents(xfs_fsblock_t fsbno;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) { ASSERT(sc->ip != NULL ||
fs/xfs/scrub/scrub.c +1 -1
@@ -415,7 +415,7 @@ xchk_validate_inputs(*/ if (sm->sm_flags &XFS_SCRUB_IFLAG_REPAIR ) { error = -EOPNOTSUPP ; -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp)) goto out; error = -EROFS ;
fs/xfs/xfs_bmap_util.c +7 -7
@@ -1282,7 +1282,7 @@ xfs_swap_extents_check_format(* If we have to use the (expensive) rmap swap method, we can * 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 ;/*
@@ -1516,7 +1516,7 @@ xfs_swap_extent_forks(* event of a crash. Set the owner change log flags now and leave the * 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 ) (*target_log_flags) |=XFS_ILOG_DOWNER ;if (tip->i_df.if_format ==XFS_DINODE_FMT_BTREE )
@@ -1553,7 +1553,7 @@ xfs_swap_extent_forks( (*src_log_flags) |=XFS_ILOG_DEXT ;break ;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_DBROOT ;break ;
@@ -1565,7 +1565,7 @@ xfs_swap_extent_forks(break ;case XFS_DINODE_FMT_BTREE : (*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 ));break ; }
@@ -1679,7 +1679,7 @@ xfs_swap_extents(* a block reservation because it's really just a remap operation * performed with log redo items! */ -if (xfs_sb_version_hasrmapbt (&mp->m_sb)) { +if (xfs_has_rmapbt (mp)) {int w =XFS_DATA_FORK ;uint32_t ipnext = ip->i_df.if_nextents;uint32_t tipnext = tip->i_df.if_nextents;
@@ -1761,7 +1761,7 @@ xfs_swap_extents( src_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);else error = xfs_swap_extent_forks(tp, ip, tip, &src_log_flags,
@@ -1780,7 +1780,7 @@ xfs_swap_extents( }/* Swap the cow forks. */ -if (xfs_sb_version_hasreflink (&mp->m_sb)) { +if (xfs_has_reflink (mp)) {ASSERT (!ip->i_cowfp || ip->i_cowfp->if_format ==XFS_DINODE_FMT_EXTENTS ); ASSERT(!tip->i_cowfp ||
fs/xfs/xfs_buf.c +3 -3
@@ -1520,7 +1520,7 @@ _xfs_buf_ioapply(* non-crc filesystems don't attach verifiers during * 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,"%s: no buf ops on daddr 0x%llx len %d" , __func__, bp->b_bn, bp->b_length);
@@ -2301,7 +2301,7 @@ xfs_verify_magic(struct xfs_mount *mp = bp->b_mount;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]))return false;return dmagic == bp->b_ops->magic[idx];
@@ -2319,7 +2319,7 @@ xfs_verify_magic16(struct xfs_mount *mp = bp->b_mount;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]))return false;return dmagic == bp->b_ops->magic16[idx];
fs/xfs/xfs_buf_item.c +1 -1
@@ -428,7 +428,7 @@ xfs_buf_item_format(* occurs during recovery. */ if (bip->bli_flags &XFS_BLI_INODE_BUF ) { -if (xfs_sb_version_has_v3inode (&lip->li_mountp->m_sb) || +if (xfs_has_v3inodes (lip->li_mountp) || !((bip->bli_flags &XFS_BLI_INODE_ALLOC_BUF ) &&xfs_log_item_in_current_chkpt (lip))) bip->__bli_format.blf_flags |=XFS_BLF_INODE_BUF ;
fs/xfs/xfs_buf_item_recover.c +4 -4
@@ -219,7 +219,7 @@ xlog_recover_validate_buf_type(* inconsistent state resulting in verification failures. Hence for now * just avoid the verification stage for non-crc filesystems */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp))return ; magic32 =be32_to_cpu (*(__be32 *)bp->b_addr);
@@ -597,7 +597,7 @@ xlog_recover_do_inode_buffer(* Post recovery validation only works properly on CRC enabled * filesystems. */ -if (xfs_sb_version_hascrc (&mp->m_sb)) +if (xfs_has_crc (mp)) bp->b_ops = &xfs_inode_buf_ops; inodes_per_buf =BBTOB (bp->b_length) >> mp->m_sb.sb_inodelog;
@@ -710,7 +710,7 @@ xlog_recover_get_buf_lsn(uint16_t blft;/* v4 filesystems always recover immediately */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) +if (!xfs_has_crc (mp)) goto recover_immediately;/*
@@ -787,7 +787,7 @@ xlog_recover_get_buf_lsn(* the relevant UUID in the superblock. */ 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;else uuid = &((struct xfs_dsb *)blk)->sb_uuid;
fs/xfs/xfs_dir2_readdir.c +1 -1
@@ -32,7 +32,7 @@ xfs_dir3_get_dtype( struct xfs_mount *mp, uint8_t filetype) { -if (!xfs_sb_version_hasftype (&mp->m_sb)) +if (!xfs_has_ftype (mp))return DT_UNKNOWN ;if (filetype >=XFS_DIR3_FT_MAX )
fs/xfs/xfs_dquot.c +5 -5
@@ -223,9 +223,9 @@ xfs_qm_init_dquot_blk( d->dd_diskdq.d_version =XFS_DQUOT_VERSION ; d->dd_diskdq.d_id =cpu_to_be32 (curid); 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 ; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {uuid_copy (&d->dd_uuid, &mp->m_sb.sb_meta_uuid);xfs_update_cksum ((char *)d,sizeof (struct xfs_dqblk ),XFS_DQUOT_CRC_OFF );
@@ -526,7 +526,7 @@ xfs_dquot_check_type(* expect an exact match for user dquots and for non-root group and * 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 )return ddqp_type == dqp_type;
@@ -1219,7 +1219,7 @@ xfs_qm_dqflush_check(/* bigtime flag should never be set on root dquots */ 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;if (dqp->q_id ==0 )return __this_address;
@@ -1298,7 +1298,7 @@ xfs_qm_dqflush(* buffer always has a valid CRC. This ensures there is no possibility * 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);xfs_update_cksum ((char *)dqblk,sizeof (struct xfs_dqblk ),XFS_DQUOT_CRC_OFF );
fs/xfs/xfs_dquot_item_recover.c +2 -2
@@ -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 * 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;xfs_lsn_t lsn =be64_to_cpu (dqb->dd_lsn);
@@ -146,7 +146,7 @@ xlog_recover_dquot_commit_pass2( }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_DQUOT_CRC_OFF ); }
fs/xfs/xfs_file.c +1 -1
@@ -1153,7 +1153,7 @@ xfs_file_remap_range(if (remap_flags & ~(REMAP_FILE_DEDUP |REMAP_FILE_ADVISORY ))return -EINVAL ; -if (!xfs_sb_version_hasreflink (&mp->m_sb)) +if (!xfs_has_reflink (mp))return -EOPNOTSUPP ;if (XFS_FORCED_SHUTDOWN (mp))
fs/xfs/xfs_fsmap.c +2 -2
@@ -202,7 +202,7 @@ xfs_getfsmap_is_shared(int error; *stat = false; -if (!xfs_sb_version_hasreflink (&mp->m_sb)) +if (!xfs_has_reflink (mp))return 0 ;/* rt files will have no perag structure */ if (!info->pag)
@@ -859,7 +859,7 @@ xfs_getfsmap(return -EINVAL ; use_rmap =capable (CAP_SYS_ADMIN ) && -xfs_sb_version_hasrmapbt (&mp->m_sb); +xfs_has_rmapbt (mp); head->fmh_entries =0 ;/* Set up our device handlers. */
fs/xfs/xfs_fsops.c +1 -1
@@ -177,7 +177,7 @@ xfs_growfs_data_private(* particularly important for shrink because the write verifier * will fail if sb_fdblocks is ever larger than sb_dblocks. */ -if (xfs_sb_version_haslazysbcount (&mp->m_sb)) +if (xfs_has_lazysbcount (mp))xfs_log_sb (tp);xfs_trans_set_sync (tp);
fs/xfs/xfs_icache.c +1 -1
@@ -619,7 +619,7 @@ xfs_iget_cache_miss(* value and hence we must also read the inode off disk even when * 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 )) {VFS_I (ip)->i_generation =prandom_u32 (); }else {
fs/xfs/xfs_inode.c +5 -5
@@ -705,7 +705,7 @@ xfs_inode_inherit_flags( di_flags |=XFS_DIFLAG_PROJINHERIT ; }else if (S_ISREG (mode)) {if ((pip->i_diflags &XFS_DIFLAG_RTINHERIT ) && -xfs_sb_version_hasrealtime (&ip->i_mount->m_sb)) +xfs_has_realtime (ip->i_mount)) di_flags |=XFS_DIFLAG_REALTIME ;if (pip->i_diflags &XFS_DIFLAG_EXTSZINHERIT ) { di_flags |=XFS_DIFLAG_EXTSIZE ;
@@ -857,7 +857,7 @@ xfs_init_new_inode( ip->i_extsize =0 ; ip->i_diflags =0 ; -if (xfs_sb_version_has_v3inode (&mp->m_sb)) { +if (xfs_has_v3inodes (mp)) {inode_set_iversion (inode,1 ); ip->i_cowextsize =0 ; ip->i_crtime = tv;
@@ -897,7 +897,7 @@ xfs_init_new_inode(* this saves us from needing to run a separate transaction to set the * fork offset in the immediate future. */ -if (init_xattrs &&xfs_sb_version_hasattr (&mp->m_sb)) { +if (init_xattrs &&xfs_has_attr (mp)) { ip->i_forkoff =xfs_default_attroffset (ip) >>3 ; ip->i_afp =xfs_ifork_alloc (XFS_DINODE_FMT_EXTENTS ,0 ); }
@@ -3515,7 +3515,7 @@ xfs_iflush(* happen but we need to still do it to ensure backwards compatibility * with old kernels that predate logging all inode changes. */ -if (!xfs_sb_version_has_v3inode (&mp->m_sb)) +if (!xfs_has_v3inodes (mp)) ip->i_flushiter++;/*
@@ -3537,7 +3537,7 @@ xfs_iflush(xfs_inode_to_disk (ip, dip, iip->ili_item.li_lsn);/* Wrap, we never let the log put out DI_MAX_FLUSH */ -if (!xfs_sb_version_has_v3inode (&mp->m_sb)) { +if (!xfs_has_v3inodes (mp)) {if (ip->i_flushiter ==DI_MAX_FLUSH ) ip->i_flushiter =0 ; }
fs/xfs/xfs_inode_item.c +1 -1
@@ -396,7 +396,7 @@ xfs_inode_to_log_dinode(/* log a dummy value to ensure log structure is fully initialised */ 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_changecount =inode_peek_iversion (inode); to->di_crtime =xfs_inode_to_log_dinode_ts (ip, ip->i_crtime);
fs/xfs/xfs_inode_item_recover.c +1 -1
@@ -295,7 +295,7 @@ xlog_recover_inode_commit_pass2(* 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 */ -if (!xfs_sb_version_has_v3inode (&mp->m_sb) && +if (!xfs_has_v3inodes (mp) && ldip->di_flushiter <be16_to_cpu (dip->di_flushiter)) {/* * Deal with the wrap case, DI_MAX_FLUSH is less
fs/xfs/xfs_ioctl.c +4 -4
@@ -1213,7 +1213,7 @@ xfs_ioctl_setattr_xflags(/* diflags2 only valid for v3 inodes. */ i_flags2 =xfs_flags2diflags2 (ip, fa->fsx_xflags); -if (i_flags2 && !xfs_sb_version_has_v3inode (&mp->m_sb)) +if (i_flags2 && !xfs_has_v3inodes (mp))return -EINVAL ; ip->i_diflags =xfs_flags2diflags (ip, fa->fsx_xflags);
@@ -1362,9 +1362,9 @@ xfs_ioctl_setattr_check_projid(if (!fa->fsx_valid)return 0 ; -/* 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 && - !xfs_sb_version_hasprojid32bit (&ip->i_mount->m_sb)) + !xfs_has_projid32 (ip->i_mount))return -EINVAL ;return 0 ; }
@@ -1467,7 +1467,7 @@ xfs_fileattr_set(else ip->i_extsize =0 ; -if (xfs_sb_version_has_v3inode (&mp->m_sb)) { +if (xfs_has_v3inodes (mp)) {if (ip->i_diflags2 &XFS_DIFLAG2_COWEXTSIZE ) ip->i_cowextsize =XFS_B_TO_FSB (mp, fa->fsx_cowextsize);else
fs/xfs/xfs_iops.c +4 -4
@@ -393,7 +393,7 @@ xfs_vn_unlink(* but still hashed. This is incompatible with case-insensitive * 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);return 0 ; }
@@ -597,7 +597,7 @@ xfs_vn_getattr( stat->ctime = inode->i_ctime; stat->blocks =XFS_FSB_TO_BB (mp, ip->i_nblocks + ip->i_delayed_blks); -if (xfs_sb_version_has_v3inode (&mp->m_sb)) { +if (xfs_has_v3inodes (mp)) {if (request_mask &STATX_BTIME ) { stat->result_mask |=STATX_BTIME ; stat->btime = ip->i_crtime;
@@ -788,7 +788,7 @@ xfs_setattr_nonsize( }if (!gid_eq (igid, gid)) {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));ASSERT (mask &ATTR_GID );ASSERT (gdqp);
@@ -1401,7 +1401,7 @@ xfs_setup_iops( inode->i_mapping->a_ops = &xfs_address_space_operations;break ;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;else inode->i_op = &xfs_dir_inode_operations;
fs/xfs/xfs_itable.c +1 -1
@@ -108,7 +108,7 @@ xfs_bulkstat_one_int( buf->bs_forkoff =XFS_IFORK_BOFF (ip); buf->bs_version =XFS_BULKSTAT_VERSION_V5 ; -if (xfs_sb_version_has_v3inode (&mp->m_sb)) { +if (xfs_has_v3inodes (mp)) { buf->bs_btime = ip->i_crtime.tv_sec; buf->bs_btime_nsec = ip->i_crtime.tv_nsec;if (ip->i_diflags2 &XFS_DIFLAG2_COWEXTSIZE )
fs/xfs/xfs_log.c +9 -9
@@ -634,7 +634,7 @@ xfs_log_mount( int num_bblks) {struct xlog *log; -bool fatal =xfs_sb_version_hascrc (&mp->m_sb); +bool fatal =xfs_has_crc (mp);int error =0 ;int min_logfsbs;
@@ -1234,7 +1234,7 @@ xfs_log_cover(* handles this for us. */ need_covered =xfs_log_need_covered (mp); -if (!need_covered && !xfs_sb_version_haslazysbcount (&mp->m_sb)) +if (!need_covered && !xfs_has_lazysbcount (mp))return 0 ;/*
@@ -1533,7 +1533,7 @@ xlog_alloc_log(xlog_assign_atomic_lsn (&log->l_last_sync_lsn,1 ,0 ); 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;else log->l_iclog_roundoff =BBSIZE ;
@@ -1542,7 +1542,7 @@ xlog_alloc_log(xlog_grant_head_init (&log->l_write_head); error = -EFSCORRUPTED ; -if (xfs_sb_version_hassector (&mp->m_sb)) { +if (xfs_has_sector (mp)) { log2_size = mp->m_sb.sb_logsectlog;if (log2_size <BBSHIFT ) { xfs_warn(mp, "Log sector size too small (0x%x < 0x%x)",
@@ -1559,7 +1559,7 @@ xlog_alloc_log(/* for larger sector sizes, must have v2 or external log */ if (log2_size && log->l_logBBstart >0 && - !xfs_sb_version_haslogv2 (&mp->m_sb)) { + !xfs_has_logv2 (mp)) {xfs_warn (mp,"log sector size (0x%x) invalid for configuration." , log2_size);
@@ -1607,7 +1607,7 @@ xlog_alloc_log(memset (head,0 ,sizeof (xlog_rec_header_t)); head->h_magicno =cpu_to_be32 (XLOG_HEADER_MAGIC_NUM ); 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);/* new fields */ head->h_fmt =cpu_to_be32 (XLOG_FMT );
@@ -1766,7 +1766,7 @@ xlog_pack_data( 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;for ( ; i <BTOBB (size); i++) {
@@ -1803,7 +1803,7 @@ xlog_cksum( offsetof(struct xlog_rec_header, h_crc));/* ... 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;int i;int xheads;
@@ -2030,7 +2030,7 @@ xlog_sync(/* real byte length */ size = iclog->ic_offset; -if (xfs_sb_version_haslogv2 (&log->l_mp->m_sb)) +if (xfs_has_logv2 (log->l_mp)) size += roundoff; iclog->ic_header.h_len =cpu_to_be32 (size);
fs/xfs/xfs_log_recover.c +7 -7
@@ -375,7 +375,7 @@ xlog_find_verify_cycle(static inline int 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); if ((be32_to_cpu(rh->h_version) & XLOG_VERSION_2) &&
@@ -1504,7 +1504,7 @@ xlog_add_record( recp->h_magicno =cpu_to_be32 (XLOG_HEADER_MAGIC_NUM ); recp->h_cycle =cpu_to_be32 (cycle); 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_tail_lsn =cpu_to_be64 (xlog_assign_lsn (tail_cycle, tail_block)); recp->h_fmt =cpu_to_be32 (XLOG_FMT );
@@ -2835,7 +2835,7 @@ xlog_unpack_data( 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;for ( ; i <BTOBB (be32_to_cpu (rhead->h_len)); i++) { j = i / (XLOG_HEADER_CYCLE_SIZE /BBSIZE );
@@ -2883,7 +2883,7 @@ xlog_recover_process(* the kernel from one that does not add CRCs by default. */ 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, "log record CRC mismatch: found 0x%x, expected 0x%x.", le32_to_cpu(old_crc),
@@ -2895,7 +2895,7 @@ xlog_recover_process(* If the filesystem is CRC enabled, this mismatch becomes a * 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);return -EFSCORRUPTED ; }
@@ -2981,7 +2981,7 @@ xlog_do_recovery_pass(* 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. */ -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 * iclog header and extract the header size from it. Get a
@@ -3386,7 +3386,7 @@ xlog_recover(* could not be verified. Check the superblock LSN against the current * 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))return -EINVAL ;
fs/xfs/xfs_mount.c +7 -6
@@ -319,7 +319,7 @@ xfs_validate_new_dalign( } } -if (!xfs_sb_version_hasdalign (&mp->m_sb)) { +if (!xfs_has_dalign (mp)) {xfs_warn (mp,"cannot change alignment: superblock does not support data alignment" );return -EINVAL ;
@@ -351,7 +351,7 @@ xfs_update_alignment( sbp->sb_width = mp->m_swidth; mp->m_update_sb = true; }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_swidth = sbp->sb_width; }
@@ -506,7 +506,7 @@ xfs_check_summary_counts(* superblock to be correct and we don't need to do anything here. * 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_fs_has_sickness (mp,XFS_SICK_FS_COUNTERS ))return 0 ;
@@ -619,6 +619,7 @@ xfs_mountfs(/* always use v2 inodes by default now */ if (!(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; }
@@ -691,7 +692,7 @@ xfs_mountfs(* cluster size. Full inode chunk alignment must match the chunk size, * 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 !=XFS_B_TO_FSBT (mp, igeo->inode_cluster_size_raw)) { xfs_warn(mp,
@@ -786,7 +787,7 @@ xfs_mountfs(* behaviour specified by the superblock feature bit. */ 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 ;/*
@@ -1229,7 +1230,7 @@ voidxfs_force_summary_recalc ( struct xfs_mount *mp) { -if (!xfs_sb_version_haslazysbcount (&mp->m_sb)) +if (!xfs_has_lazysbcount (mp))return ;xfs_fs_mark_sick (mp,XFS_SICK_FS_COUNTERS );
fs/xfs/xfs_mount.h +3 -3
@@ -316,9 +316,9 @@ __XFS_HAS_FEAT(reflink, REFLINK) __XFS_HAS_FEAT(sparseinodes, SPINODES) __XFS_HAS_FEAT(metauuid, META_UUID) __XFS_HAS_FEAT(realtime, REALTIME) -__XFS_HAS_FEAT(inobtcounts, REALTIME) -__XFS_HAS_FEAT(bigtime, REALTIME) -__XFS_HAS_FEAT (needsrepair,REALTIME ) +__XFS_HAS_FEAT(inobtcounts, INOBTCNT) +__XFS_HAS_FEAT(bigtime, BIGTIME) +__XFS_HAS_FEAT (needsrepair,NEEDSREPAIR )/* * Flags for m_flags.
fs/xfs/xfs_qm.c +7 -7
@@ -656,7 +656,7 @@ xfs_qm_init_quotainfo(/* Precalc some constants */ qinf->qi_dqchunklen =XFS_FSB_TO_BB (mp,XFS_DQUOT_CLUSTER_SIZE_FSB ); 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 =xfs_dq_bigtime_to_unix (XFS_DQ_BIGTIME_EXPIRY_MIN ); qinf->qi_expiry_max =
@@ -749,7 +749,7 @@ xfs_qm_qino_alloc(* with PQUOTA, just use sb_gquotino for sb_pquotino and * vice-versa. */ -if (!xfs_sb_version_has_pquotino (&mp->m_sb) && +if (!xfs_has_pquotino (mp) && (flags & (XFS_QMOPT_PQUOTA |XFS_QMOPT_GQUOTA ))) {xfs_ino_t ino =NULLFSINO ;
@@ -802,9 +802,9 @@ xfs_qm_qino_alloc(*/ spin_lock (&mp->m_sb_lock);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_gquotino =NULLFSINO ; mp->m_sb.sb_pquotino =NULLFSINO ;
@@ -890,11 +890,11 @@ xfs_qm_reset_dqcounts( ddq->d_bwarns =0 ; ddq->d_iwarns =0 ; ddq->d_rtbwarns =0 ; -if (xfs_sb_version_hasbigtime (&mp->m_sb)) +if (xfs_has_bigtime (mp)) 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],sizeof (struct xfs_dqblk ),XFS_DQUOT_CRC_OFF );
@@ -1498,7 +1498,7 @@ xfs_qm_init_quotainos(/* * 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) && mp->m_sb.sb_uquotino !=NULLFSINO ) {ASSERT (mp->m_sb.sb_uquotino >0 );
fs/xfs/xfs_qm_bhv.c +1 -1
@@ -75,7 +75,7 @@ xfs_qm_newmount(uint quotaondisk;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 );if (quotaondisk) {
fs/xfs/xfs_qm_syscalls.c +1 -1
@@ -105,7 +105,7 @@ xfs_qm_scall_trunc_qfiles( {int error = -EINVAL ; -if (!xfs_sb_version_hasquota (&mp->m_sb) || flags ==0 || +if (!xfs_has_quota (mp) || flags ==0 || (flags & ~XFS_QMOPT_QUOTALL )) {xfs_debug (mp,"%s: flags=%x m_qflags=%x" , __func__, flags, mp->m_qflags);
fs/xfs/xfs_refcount_item.c +1 -1
@@ -423,7 +423,7 @@ xfs_cui_validate_phys( struct xfs_mount *mp, struct xfs_phys_extent *refc) { -if (!xfs_sb_version_hasreflink (&mp->m_sb)) +if (!xfs_has_reflink (mp))return false;if (refc->pe_flags & ~XFS_REFCOUNT_EXTENT_FLAGS )
fs/xfs/xfs_reflink.c +2 -2
@@ -759,7 +759,7 @@ xfs_reflink_recover_cow(xfs_agnumber_t agno;int error =0 ; -if (!xfs_sb_version_hasreflink (&mp->m_sb)) +if (!xfs_has_reflink (mp))return 0 ;for_each_perag (mp, agno, pag) {
@@ -967,7 +967,7 @@ xfs_reflink_ag_has_free_space(struct xfs_perag *pag;int error =0 ; -if (!xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (!xfs_has_rmapbt (mp))return 0 ; pag =xfs_perag_get (mp, agno);
fs/xfs/xfs_rmap_item.c +1 -1
@@ -466,7 +466,7 @@ xfs_rui_validate_map( struct xfs_mount *mp, struct xfs_map_extent *rmap) { -if (!xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (!xfs_has_rmapbt (mp))return false;if (rmap->me_flags & ~XFS_RMAP_EXTENT_FLAGS )
fs/xfs/xfs_rtalloc.c +1 -2
@@ -951,8 +951,7 @@ xfs_growfs_rt(return -EINVAL ;/* Unsupported realtime features. */ -if (xfs_sb_version_hasrmapbt (&mp->m_sb) || -xfs_sb_version_hasreflink (&mp->m_sb)) +if (xfs_has_rmapbt (mp) ||xfs_has_reflink (mp))return -EOPNOTSUPP ; nrblocks = in->newblocks;
fs/xfs/xfs_super.c +9 -9
@@ -485,7 +485,7 @@ xfs_setup_devices(if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) {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; error =xfs_setsize_buftarg (mp->m_logdev_targp, log_sector_size);
@@ -939,7 +939,7 @@ xfs_finish_flags(int ronly = (mp->m_flags &XFS_MOUNT_RDONLY );/* 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 && mp->m_sb.sb_logsunit >XLOG_BIG_RECORD_BSIZE ) { mp->m_logbsize = mp->m_sb.sb_logsunit;
@@ -961,7 +961,7 @@ xfs_finish_flags(/* * 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 )) {xfs_warn (mp,"Cannot mount a V5 filesystem as noattr2. " "attr2 is always enabled for V5 filesystems." );
@@ -979,7 +979,7 @@ xfs_finish_flags(if ((mp->m_qflags &XFS_GQUOTA_ACCT ) && (mp->m_qflags &XFS_PQUOTA_ACCT ) && - !xfs_sb_version_has_pquotino (&mp->m_sb)) { + !xfs_has_pquotino (mp)) {xfs_warn (mp,"Super block does not support project and group quota together" );return -EINVAL ;
@@ -1497,7 +1497,7 @@ xfs_fs_fill_super( goto out_free_sb;/* V4 support is undergoing deprecation. */ -if (!xfs_sb_version_hascrc (&mp->m_sb)) { +if (!xfs_has_crc (mp)) {#ifdef CONFIG_XFS_SUPPORT_V4 xfs_warn_once (mp,"Deprecated V4 format (crc=0) will not be supported after September 2030." );
@@ -1582,7 +1582,7 @@ xfs_fs_fill_super( sb->s_maxbytes =MAX_LFS_FILESIZE ; sb->s_max_links =XFS_MAXLINK ; 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_max =xfs_bigtime_to_unix (XFS_BIGTIME_TIME_MAX ); }else {
@@ -1614,7 +1614,7 @@ xfs_fs_fill_super( "DAX unsupported by block device. Turning off DAX.");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,"DAX and reflink cannot be used together!" ); error = -EINVAL ;
@@ -1632,7 +1632,7 @@ xfs_fs_fill_super( } } -if (xfs_sb_version_hasreflink (&mp->m_sb)) { +if (xfs_has_reflink (mp)) {if (mp->m_sb.sb_rblocks) {xfs_alert (mp,"reflink not compatible with realtime device!" );
@@ -1646,7 +1646,7 @@ xfs_fs_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,"reverse mapping btree not compatible with realtime device!" ); error = -EINVAL ;
fs/xfs/xfs_symlink.c +1 -1
@@ -63,7 +63,7 @@ xfs_readlink_bmap_ilocked( byte_cnt = pathlen; 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, byte_cnt, bp)) { error = -EFSCORRUPTED ;
fs/xfs/xfs_trans.c +8 -8
@@ -275,7 +275,7 @@ xfs_trans_alloc(WARN_ON (resp->tr_logres >0 && mp->m_super->s_writers.frozen ==SB_FREEZE_COMPLETE );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_flags = flags;
@@ -364,12 +364,12 @@ xfs_trans_mod_sb(switch (field) {case XFS_TRANS_SB_ICOUNT : tp->t_icount_delta += delta; -if (xfs_sb_version_haslazysbcount (&mp->m_sb)) +if (xfs_has_lazysbcount (mp)) flags &= ~XFS_TRANS_SB_DIRTY ;break ;case XFS_TRANS_SB_IFREE : tp->t_ifree_delta += delta; -if (xfs_sb_version_haslazysbcount (&mp->m_sb)) +if (xfs_has_lazysbcount (mp)) flags &= ~XFS_TRANS_SB_DIRTY ;break ;case XFS_TRANS_SB_FDBLOCKS :
@@ -398,7 +398,7 @@ xfs_trans_mod_sb( delta -= blkres_delta; } tp->t_fdblocks_delta += delta; -if (xfs_sb_version_haslazysbcount (&mp->m_sb)) +if (xfs_has_lazysbcount (mp)) flags &= ~XFS_TRANS_SB_DIRTY ;break ;case XFS_TRANS_SB_RES_FDBLOCKS :
@@ -408,7 +408,7 @@ xfs_trans_mod_sb(* be applied to the on-disk superblock. */ tp->t_res_fdblocks_delta += delta; -if (xfs_sb_version_haslazysbcount (&mp->m_sb)) +if (xfs_has_lazysbcount (mp)) flags &= ~XFS_TRANS_SB_DIRTY ;break ;case XFS_TRANS_SB_FREXTENTS :
@@ -487,7 +487,7 @@ xfs_trans_apply_sb_deltas(/* * 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)be64_add_cpu (&sbp->sb_icount, tp->t_icount_delta);if (tp->t_ifree_delta)
@@ -585,7 +585,7 @@ xfs_trans_unreserve_and_mod_sb(if (tp->t_blk_res >0 ) blkdelta = tp->t_blk_res;if ((tp->t_fdblocks_delta !=0 ) && - (xfs_sb_version_haslazysbcount (&mp->m_sb) || + (xfs_has_lazysbcount (mp) || (tp->t_flags &XFS_TRANS_SB_DIRTY ))) blkdelta += tp->t_fdblocks_delta;
@@ -595,7 +595,7 @@ xfs_trans_unreserve_and_mod_sb( (tp->t_flags & XFS_TRANS_SB_DIRTY)) 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 )) { idelta = tp->t_icount_delta; ifreedelta = tp->t_ifree_delta;
fs/xfs/xfs_trans_dquot.c +1 -1
@@ -58,7 +58,7 @@ xfs_trans_log_dquot(/* Upgrade the dquot to bigtime format if possible. */ 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 ;
Signature · 1 line
2.31.1
PATCH v3 6/16 xfs: consolidate mount option features in m_features
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
This provides separation of mount time feature flags from runtime mount flags and mount option state. It also makes the feature checks use the same interface as the superblock features. i.e. we don't care if the feature is enabled by superblock flags or mount options, we just care if it's enabled or not.
--- fs/xfs/xfs_mount.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
fs/xfs/xfs_mount.h +44 -0
@@ -278,6 +278,25 @@ typedef struct xfs_mount {#define XFS_FEAT_BIGTIME (1ULL << 24)/* large timestamps */ #define XFS_FEAT_NEEDSREPAIR (1ULL << 25)/* needs xfs_repair */ +/* Mount features */ +#define XFS_FEAT_NOATTR2 (1ULL << 48)/* disable attr2 creation */ +#define XFS_FEAT_NOALIGN (1ULL << 49)/* ignore alignment */ +#define XFS_FEAT_ALLOCSIZE (1ULL << 50)/* user specified allocation size */ +#define XFS_FEAT_LARGE_IOSIZE (1ULL << 51)/* report large preferred +* I/O size in stat() */ +#define XFS_FEAT_WSYNC (1ULL << 52)/* synchronous metadata ops */ +#define XFS_FEAT_DIRSYNC (1ULL << 53)/* synchronous directory ops */ +#define XFS_FEAT_DISCARD (1ULL << 54)/* discard unused blocks */ +#define XFS_FEAT_GRPID (1ULL << 55)/* group-ID assigned from directory */ +#define XFS_FEAT_SMALL_INUMS (1ULL << 56)/* user wants 32bit inodes */ +#define XFS_FEAT_IKEEP (1ULL << 57)/* keep empty inode clusters*/ +#define XFS_FEAT_SWALLOC (1ULL << 58)/* stripe width allocation */ +#define XFS_FEAT_FILESTREAMS (1ULL << 59)/* use filestreams allocator */ +#define XFS_FEAT_DAX_ALWAYS (1ULL << 60)/* DAX always enabled */ +#define XFS_FEAT_DAX_NEVER (1ULL << 61)/* DAX never enabled */ +#define XFS_FEAT_NORECOVERY (1ULL << 62)/* no recovery - dirty fs */ +#define XFS_FEAT_NOUUID (1ULL << 63)/* ignore uuid during mount */ +#define __XFS_HAS_FEAT (name,NAME ) \ static inline bool xfs_has_ ## name (struct xfs_mount *mp) \ { \
@@ -293,6 +312,7 @@ static inline void xfs_add_ ## name (struct xfs_mount *mp) \ xfs_sb_version_add ## name(&mp->m_sb); \ } +/* Superblock features */ __XFS_ADD_FEAT(attr, ATTR) __XFS_HAS_FEAT(nlink, NLINK)__XFS_ADD_FEAT (quota,QUOTA )
@@ -320,6 +340,30 @@ __XFS_HAS_FEAT(inobtcounts, INOBTCNT) __XFS_HAS_FEAT(bigtime, BIGTIME)__XFS_HAS_FEAT (needsrepair,NEEDSREPAIR ) +/* +* Mount features +* +* These do not change dynamically - features that can come and go, +* such as 32 bit inodes and read-only state, are kept as flags rather than +* features. + */ +__XFS_HAS_FEAT(noattr2, NOATTR2) +__XFS_HAS_FEAT(noalign, NOALIGN) +__XFS_HAS_FEAT(allocsize, ALLOCSIZE) +__XFS_HAS_FEAT(large_iosize, LARGE_IOSIZE) +__XFS_HAS_FEAT(wsync, WSYNC) +__XFS_HAS_FEAT(dirsync, DIRSYNC) +__XFS_HAS_FEAT(discard, DISCARD) +__XFS_HAS_FEAT(grpid, GRPID) +__XFS_HAS_FEAT(small_inums, SMALL_INUMS) +__XFS_HAS_FEAT(ikeep, IKEEP) +__XFS_HAS_FEAT(swalloc, SWALLOC) +__XFS_HAS_FEAT(filestreams, FILESTREAMS) +__XFS_HAS_FEAT(dax_always, DAX_ALWAYS) +__XFS_HAS_FEAT(dax_never, DAX_NEVER) +__XFS_HAS_FEAT(norecovery, NORECOVERY) +__XFS_HAS_FEAT (nouuid,NOUUID ) +/* * Flags for m_flags. */
Signature · 1 line
2.31.1
PATCH v3 7/16 xfs: convert mount flags to features
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Replace m_flags feature checks with xfs_has_<feature>() calls and rework the setup code to set flags in m_features.
--- fs/xfs/libxfs/xfs_attr.c | 4 +- fs/xfs/libxfs/xfs_attr_leaf.c | 41 +++++----- fs/xfs/libxfs/xfs_bmap.c | 4 +- fs/xfs/libxfs/xfs_ialloc.c | 10 +-- fs/xfs/scrub/scrub.c | 2 +- fs/xfs/xfs_acl.c | 2 +- fs/xfs/xfs_bmap_util.c | 2 +- fs/xfs/xfs_discard.c | 2 +- fs/xfs/xfs_export.c | 2 +- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_filestream.h | 2 +- fs/xfs/xfs_icache.c | 7 +- fs/xfs/xfs_inode.c | 15 ++-- fs/xfs/xfs_inode.h | 3 +- fs/xfs/xfs_ioctl.c | 5 +- fs/xfs/xfs_iomap.c | 4 +- fs/xfs/xfs_iops.c | 12 +-- fs/xfs/xfs_log.c | 14 ++-- fs/xfs/xfs_log_cil.c | 4 +- fs/xfs/xfs_mount.c | 24 +++--- fs/xfs/xfs_mount.h | 26 +------ fs/xfs/xfs_super.c | 141 ++++++++++++++++------------------ fs/xfs/xfs_symlink.c | 3 +- 23 files changed, 152 insertions(+), 179 deletions(-)
fs/xfs/libxfs/xfs_attr.c +2 -2
@@ -224,7 +224,7 @@ xfs_attr_try_sf_addname(if (!error && !(args->op_flags &XFS_DA_OP_NOTIME ))xfs_trans_ichgtime (args->trans, dp,XFS_ICHGTIME_CHG ); -if (dp->i_mount->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (dp->i_mount))xfs_trans_set_sync (args->trans);return error;
@@ -808,7 +808,7 @@ xfs_attr_set(* If this is a synchronous mount, make sure that the * transaction goes to disk before returning to the user. */ -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (args->trans);if (!(args->op_flags &XFS_DA_OP_NOTIME ))
fs/xfs/libxfs/xfs_attr_leaf.c +23 -18
80 lines not on this page · raw message
fs/xfs/libxfs/xfs_bmap.c +2 -2
@@ -1047,7 +1047,7 @@ xfs_bmap_set_attrforkoff( ip->i_forkoff =xfs_attr_shortform_bytesfit (ip, size);if (!ip->i_forkoff) ip->i_forkoff = default_size; -else if ((ip->i_mount->m_flags &XFS_MOUNT_ATTR2 ) && version) +else if (xfs_has_attr2 (ip->i_mount) && version) *version =2 ;break ;default :
@@ -3422,7 +3422,7 @@ xfs_bmap_compute_alignments(int stripe_align =0 ;/* stripe alignment for allocation is determined by mount parameters */ -if (mp->m_swidth && (mp->m_flags &XFS_MOUNT_SWALLOC )) +if (mp->m_swidth &&xfs_has_swalloc (mp)) stripe_align = mp->m_swidth;else if (mp->m_dalign) stripe_align = mp->m_dalign;
fs/xfs/libxfs/xfs_ialloc.c +4 -6
@@ -712,7 +712,7 @@ xfs_ialloc_ag_alloc(*/ isaligned =0 ;if (igeo->ialloc_align) { -ASSERT (!(args.mp->m_flags &XFS_MOUNT_NOALIGN )); +ASSERT (!xfs_has_noalign (args.mp)); args.alignment = args.mp->m_dalign; isaligned =1 ; }else
@@ -1953,8 +1953,7 @@ xfs_difree_inobt(* remove the chunk if the block size is large enough for multiple inode * chunks (that might not be free). */ -if (!(mp->m_flags &XFS_MOUNT_IKEEP ) && - rec.ir_free ==XFS_INOBT_ALL_FREE && +if (!xfs_has_ikeep (mp) && rec.ir_free ==XFS_INOBT_ALL_FREE && mp->m_sb.sb_inopblock <=XFS_INODES_PER_CHUNK ) {struct xfs_perag *pag = agbp->b_pag;
@@ -2098,9 +2097,8 @@ xfs_difree_finobt(* enough for multiple chunks. Leave the finobt record to remain in sync * with the inobt. */ -if (rec.ir_free ==XFS_INOBT_ALL_FREE && - mp->m_sb.sb_inopblock <=XFS_INODES_PER_CHUNK && - !(mp->m_flags &XFS_MOUNT_IKEEP )) { +if (!xfs_has_ikeep (mp) && rec.ir_free ==XFS_INOBT_ALL_FREE && + mp->m_sb.sb_inopblock <=XFS_INODES_PER_CHUNK ) { error =xfs_btree_delete (cur, &i);if (error) goto error;
fs/xfs/scrub/scrub.c +1 -1
@@ -483,7 +483,7 @@ xfs_scrub_metadata(if (XFS_FORCED_SHUTDOWN (mp)) goto out; error = -ENOTRECOVERABLE ; -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) +if (xfs_has_norecovery (mp)) goto out; error =xchk_validate_inputs (mp, sm);
fs/xfs/xfs_acl.c +1 -1
@@ -232,7 +232,7 @@ xfs_acl_set_mode( inode->i_ctime =current_time (inode);xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp);return xfs_trans_commit (tp); }
fs/xfs/xfs_bmap_util.c +1 -1
@@ -1822,7 +1822,7 @@ xfs_swap_extents(* If this is a synchronous mount, make sure that the * transaction goes to disk before returning to the user. */ -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp); error =xfs_trans_commit (tp);
fs/xfs/xfs_discard.c +1 -1
@@ -169,7 +169,7 @@ xfs_ioc_trim(* We haven't recovered the log, so we cannot use our bnobt-guided * storage zapping commands. */ -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) +if (xfs_has_norecovery (mp))return -EROFS ;if (copy_from_user (&range, urange,sizeof (range)))
fs/xfs/xfs_export.c +1 -1
@@ -63,7 +63,7 @@ xfs_fs_encode_fh(* large enough filesystem may contain them, thus the slightly * confusing looking conditional below. */ -if (!(XFS_M (inode->i_sb)->m_flags &XFS_MOUNT_SMALL_INUMS ) || +if (!xfs_has_small_inums (XFS_M (inode->i_sb)) || (XFS_M (inode->i_sb)->m_flags &XFS_MOUNT_32BITINODES )) fileid_type |=XFS_FILEID_TYPE_64FLAG ;
fs/xfs/xfs_file.c +1 -1
@@ -1122,7 +1122,7 @@ static inline bool xfs_file_sync_writes(struct file *filp) {struct xfs_inode *ip =XFS_I (file_inode (filp)); -if (ip->i_mount->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (ip->i_mount))return true;if (filp->f_flags & (__O_SYNC |O_DSYNC ))return true;
fs/xfs/xfs_filestream.h +1 -1
@@ -21,7 +21,7 @@ static inline intxfs_inode_is_filestream ( struct xfs_inode *ip) { -return (ip->i_mount->m_flags &XFS_MOUNT_FILESTREAMS ) || +return xfs_has_filestreams (ip->i_mount) || (ip->i_diflags &XFS_DIFLAG_FILESTREAM ); }
fs/xfs/xfs_icache.c +3 -4
@@ -611,7 +611,7 @@ xfs_iget_cache_miss(/* * For version 5 superblocks, if we are initialising a new inode and we -* are not utilising the XFS_MOUNT_IKEEP inode cluster mode, we can +* are not utilising the XFS_FEAT_IKEEP inode cluster mode, we can * simply build the new inode core with a random generation number. * * For version 4 (and older) superblocks, log recovery is dependent on
@@ -620,7 +620,7 @@ xfs_iget_cache_miss(* initializing new inodes. */ if (xfs_has_v3inodes (mp) && - (flags &XFS_IGET_CREATE ) && !(mp->m_flags &XFS_MOUNT_IKEEP )) { + (flags &XFS_IGET_CREATE ) && !xfs_has_ikeep (mp)) {VFS_I (ip)->i_generation =prandom_u32 (); }else {struct xfs_buf *bp;
@@ -976,8 +976,7 @@ static inline boolxfs_want_reclaim_sick ( struct xfs_mount *mp) { -return (mp->m_flags &XFS_MOUNT_UNMOUNTING ) || - (mp->m_flags &XFS_MOUNT_NORECOVERY ) || +return (mp->m_flags &XFS_MOUNT_UNMOUNTING ) ||xfs_has_norecovery (mp) ||XFS_FORCED_SHUTDOWN (mp); }
fs/xfs/xfs_inode.c +7 -8
@@ -826,8 +826,7 @@ xfs_init_new_inode( inode->i_rdev = rdev; ip->i_projid = prid; -if (dir && !(dir->i_mode &S_ISGID ) && - (mp->m_flags &XFS_MOUNT_GRPID )) { +if (dir && !(dir->i_mode &S_ISGID ) &&xfs_has_grpid (mp)) {inode_fsuid_set (inode, mnt_userns); inode->i_gid = dir->i_gid; inode->i_mode = mode;
@@ -1068,7 +1067,7 @@ xfs_create(* create transaction goes to disk before returning to * the user. */ -if (mp->m_flags & (XFS_MOUNT_WSYNC |XFS_MOUNT_DIRSYNC )) +if (xfs_has_wsync (mp) ||xfs_has_dirsync (mp))xfs_trans_set_sync (tp);/*
@@ -1160,7 +1159,7 @@ xfs_create_tmpfile(if (error) goto out_trans_cancel; -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp);/*
@@ -1294,7 +1293,7 @@ xfs_link(* link transaction goes to disk before returning to * the user. */ -if (mp->m_flags & (XFS_MOUNT_WSYNC |XFS_MOUNT_DIRSYNC )) +if (xfs_has_wsync (mp) ||xfs_has_dirsync (mp))xfs_trans_set_sync (tp);return xfs_trans_commit (tp);
@@ -1679,7 +1678,7 @@ xfs_inode_needs_inactive(return false;/* If the log isn't running, push inodes straight to reclaim. */ -if (XFS_FORCED_SHUTDOWN (mp) || (mp->m_flags &XFS_MOUNT_NORECOVERY )) +if (XFS_FORCED_SHUTDOWN (mp) ||xfs_has_norecovery (mp))return false;/* Metadata inodes require explicit resource cleanup. */
@@ -2855,7 +2854,7 @@ xfs_remove(* remove transaction goes to disk before returning to * the user. */ -if (mp->m_flags & (XFS_MOUNT_WSYNC |XFS_MOUNT_DIRSYNC )) +if (xfs_has_wsync (mp) ||xfs_has_dirsync (mp))xfs_trans_set_sync (tp); error =xfs_trans_commit (tp);
@@ -2932,7 +2931,7 @@ xfs_finish_rename(* If this is a synchronous mount, make sure that the rename transaction * goes to disk before returning to the user. */ -if (tp->t_mountp->m_flags & (XFS_MOUNT_WSYNC |XFS_MOUNT_DIRSYNC )) +if (xfs_has_wsync (tp->t_mountp) ||xfs_has_dirsync (tp->t_mountp))xfs_trans_set_sync (tp);return xfs_trans_commit (tp);
fs/xfs/xfs_inode.h +1 -2
@@ -400,8 +400,7 @@ enum layout_break_reason {* new subdirectory gets S_ISGID bit from parent. */ #define XFS_INHERIT_GID (pip) \ - (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \ - (VFS_I(pip)->i_mode & S_ISGID)) + (xfs_has_grpid((pip)->i_mount) || (VFS_I(pip)->i_mode & S_ISGID))int xfs_release (struct xfs_inode *ip);void xfs_inactive (struct xfs_inode *ip);
fs/xfs/xfs_ioctl.c +2 -3
@@ -1237,8 +1237,7 @@ xfs_ioctl_setattr_prepare_dax(if (S_ISDIR (inode->i_mode))return ; -if ((mp->m_flags &XFS_MOUNT_DAX_ALWAYS ) || - (mp->m_flags &XFS_MOUNT_DAX_NEVER )) +if (xfs_has_dax_always (mp) ||xfs_has_dax_never (mp))return ; if (((fa->fsx_xflags & FS_XFLAG_DAX) &&
@@ -1274,7 +1273,7 @@ xfs_ioctl_setattr_get_trans(if (error) goto out_error; -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp);return tp;
fs/xfs/xfs_iomap.c +2 -2
@@ -132,7 +132,7 @@ xfs_eof_alignment(* If mounted with the "-o swalloc" option the alignment is * increased from the strip unit size to the stripe width. */ -if (mp->m_swidth && (mp->m_flags &XFS_MOUNT_SWALLOC )) +if (mp->m_swidth &&xfs_has_swalloc (mp)) align = mp->m_swidth;else if (mp->m_dalign) align = mp->m_dalign;
@@ -994,7 +994,7 @@ xfs_buffered_write_iomap_begin(* Determine the initial size of the preallocation. * We clean up any extra preallocation when the file is closed. */ -if (mp->m_flags &XFS_MOUNT_ALLOCSIZE ) +if (xfs_has_allocsize (mp)) prealloc_blocks = mp->m_allocsize_blocks;else prealloc_blocks = xfs_iomap_prealloc_size(ip, allocfork,
fs/xfs/xfs_iops.c +6 -6
@@ -558,10 +558,10 @@ xfs_stat_blksize(* default buffered I/O size, return that, otherwise return the compat * default. */ -if (mp->m_flags &XFS_MOUNT_LARGEIO ) { +if (xfs_has_large_iosize (mp)) {if (mp->m_swidth)return XFS_FSB_TO_B (mp, mp->m_swidth); -if (mp->m_flags &XFS_MOUNT_ALLOCSIZE ) +if (xfs_has_allocsize (mp))return 1U << mp->m_allocsize_log; }
@@ -808,7 +808,7 @@ xfs_setattr_nonsize(XFS_STATS_INC (mp, xs_ig_attrchg); -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp); error =xfs_trans_commit (tp);
@@ -1037,7 +1037,7 @@ xfs_setattr_size(XFS_STATS_INC (mp, xs_ig_attrchg); -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp); error =xfs_trans_commit (tp);
@@ -1287,11 +1287,11 @@ xfs_inode_should_enable_dax( {if (!IS_ENABLED (CONFIG_FS_DAX ))return false; -if (ip->i_mount->m_flags &XFS_MOUNT_DAX_NEVER ) +if (xfs_has_dax_never (ip->i_mount))return false;if (!xfs_inode_supports_dax (ip))return false; -if (ip->i_mount->m_flags &XFS_MOUNT_DAX_ALWAYS ) +if (xfs_has_dax_always (ip->i_mount))return true;if (ip->i_diflags2 &XFS_DIFLAG2_DAX )return true;
fs/xfs/xfs_log.c +7 -7
@@ -361,7 +361,7 @@ xfs_log_writable(* mounts allow internal writes for log recovery and unmount purposes, * so don't restrict that case. */ -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) +if (xfs_has_norecovery (mp))return false;if (xfs_readonly_buftarg (mp->m_ddev_targp))return false;
@@ -638,7 +638,7 @@ xfs_log_mount(int error =0 ;int min_logfsbs; -if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { +if (!xfs_has_norecovery (mp)) {xfs_notice (mp,"Mounting V%d Filesystem" ,XFS_SB_VERSION_NUM (&mp->m_sb)); }else {
@@ -724,8 +724,8 @@ xfs_log_mount(* skip log recovery on a norecovery mount. pretend it all * just worked. */ -if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { -int readonly = (mp->m_flags &XFS_MOUNT_RDONLY ); +if (!xfs_has_norecovery (mp)) { +bool readonly = (mp->m_flags &XFS_MOUNT_RDONLY );if (readonly) mp->m_flags &= ~XFS_MOUNT_RDONLY ;
@@ -785,8 +785,8 @@ xfs_log_mount_finish(bool readonly = (mp->m_flags &XFS_MOUNT_RDONLY );int error =0 ; -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) { -ASSERT (mp->m_flags &XFS_MOUNT_RDONLY ); +if (xfs_has_norecovery (mp)) { +ASSERT (readonly);return 0 ; }else if (readonly) {/* Allow unlinked processing to proceed */
@@ -3937,7 +3937,7 @@ xfs_log_check_lsn(* resets the in-core LSN. We can't validate in this mode, but * modifications are not allowed anyways so just return true. */ -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) +if (xfs_has_norecovery (mp))return true;/*
fs/xfs/xfs_log_cil.c +2 -2
@@ -543,7 +543,7 @@ xlog_discard_busy_extents(struct blk_plug plug;int error =0 ; -ASSERT (mp->m_flags &XFS_MOUNT_DISCARD ); +ASSERT (xfs_has_discard (mp));blk_start_plug (&plug);list_for_each_entry (busyp, list, list) {
@@ -605,7 +605,7 @@ xlog_cil_committed(xfs_extent_busy_sort (&ctx->busy_extents);xfs_extent_busy_clear (mp, &ctx->busy_extents, - (mp->m_flags &XFS_MOUNT_DISCARD ) && !abort); +xfs_has_discard (mp) && !abort);spin_lock (&ctx->cil->xc_push_lock);list_del (&ctx->committing);
fs/xfs/xfs_mount.c +12 -12
@@ -62,7 +62,7 @@ xfs_uuid_mount(/* Publish UUID in struct super_block */ uuid_copy (&mp->m_super->s_uuid, uuid); -if (mp->m_flags &XFS_MOUNT_NOUUID ) +if (xfs_has_nouuid (mp))return 0 ;if (uuid_is_null (uuid)) {
@@ -104,7 +104,7 @@ xfs_uuid_unmount(uuid_t *uuid = &mp->m_sb.sb_uuid;int i; -if (mp->m_flags &XFS_MOUNT_NOUUID ) +if (xfs_has_nouuid (mp))return ;mutex_lock (&xfs_uuid_table_mutex);
@@ -350,8 +350,7 @@ xfs_update_alignment( sbp->sb_unit = mp->m_dalign; sbp->sb_width = mp->m_swidth; mp->m_update_sb = true; - }else if ((mp->m_flags &XFS_MOUNT_NOALIGN ) !=XFS_MOUNT_NOALIGN && -xfs_has_dalign (mp)) { + }else if (!xfs_has_noalign (mp) &&xfs_has_dalign (mp)) { mp->m_dalign = sbp->sb_unit; mp->m_swidth = sbp->sb_width; }
@@ -783,12 +782,15 @@ xfs_mountfs(/* * Now that we've recovered any pending superblock feature bit * additions, we can finish setting up the attr2 behaviour for the -* mount. If no attr2 mount options were specified, the we use the -* behaviour specified by the superblock feature bit. +* mount. The noattr2 option overrides the superblock flag, so only +* check the superblock feature flag if the mount option is not set. */ -if (!(mp->m_flags & (XFS_MOUNT_ATTR2 |XFS_MOUNT_NOATTR2 )) && -xfs_has_attr2 (mp)) - mp->m_flags |=XFS_MOUNT_ATTR2 ; +if (xfs_has_noattr2 (mp)) { + mp->m_features &= ~XFS_FEAT_ATTR2 ; + }else if (!xfs_has_attr2 (mp) && + (mp->m_sb.sb_features2 &XFS_SB_VERSION2_ATTR2BIT )) { + mp->m_features |=XFS_FEAT_ATTR2 ; + }/* * Get and sanity-check the root inode.
@@ -890,10 +892,8 @@ xfs_mountfs(* We use the same quiesce mechanism as the rw->ro remount, as they are * semantically identical operations. */ -if ((mp->m_flags & (XFS_MOUNT_RDONLY |XFS_MOUNT_NORECOVERY )) == -XFS_MOUNT_RDONLY ) { +if ((mp->m_flags &XFS_MOUNT_RDONLY ) && !xfs_has_norecovery (mp))xfs_log_clean (mp); - }/* * Complete the quota initialisation, post-log-replay component.
fs/xfs/xfs_mount.h +3 -23
@@ -371,32 +371,12 @@ __XFS_HAS_FEAT(nouuid, NOUUID)must be synchronous except for space allocations */ #define XFS_MOUNT_UNMOUNTING (1ULL << 1)/* filesystem is unmounting */ -#define XFS_MOUNT_WAS_CLEAN (1ULL << 3) -#define XFS_MOUNT_FS_SHUTDOWN (1ULL << 4)/* atomic stop of all filesystem +#define XFS_MOUNT_WAS_CLEAN (1ULL << 2) +#define XFS_MOUNT_FS_SHUTDOWN (1ULL << 3)/* atomic stop of all filesystem operations, typically for disk errors in metadata */ -#define XFS_MOUNT_DISCARD (1ULL << 5)/* discard unused blocks */ -#define XFS_MOUNT_NOALIGN (1ULL << 7)/* turn off stripe alignment -allocations */ -#define XFS_MOUNT_ATTR2 (1ULL << 8)/* allow use of attr2 format */ -#define XFS_MOUNT_GRPID (1ULL << 9)/* group-ID assigned from directory */ -#define XFS_MOUNT_NORECOVERY (1ULL << 10)/* no recovery - dirty fs */ -#define XFS_MOUNT_ALLOCSIZE (1ULL << 12)/* specified allocation size */ -#define XFS_MOUNT_SMALL_INUMS (1ULL << 14)/* user wants 32bit inodes */ #define XFS_MOUNT_32BITINODES (1ULL << 15)/* inode32 allocator active */ -#define XFS_MOUNT_NOUUID (1ULL << 16)/* ignore uuid during mount */ -#define XFS_MOUNT_IKEEP (1ULL << 18)/* keep empty inode clusters*/ -#define XFS_MOUNT_SWALLOC (1ULL << 19)/* turn on stripe width -* allocation */ -#define XFS_MOUNT_RDONLY (1ULL << 20)/* read-only fs */ -#define XFS_MOUNT_DIRSYNC (1ULL << 21)/* synchronous directory ops */ -#define XFS_MOUNT_LARGEIO (1ULL << 22)/* report large preferred -* I/O size in stat() */ -#define XFS_MOUNT_FILESTREAMS (1ULL << 24)/* enable the filestreams -allocator */ -#define XFS_MOUNT_NOATTR2 (1ULL << 25)/* disable use of attr2 format */ -#define XFS_MOUNT_DAX_ALWAYS (1ULL << 26) -#define XFS_MOUNT_DAX_NEVER (1ULL << 27) +#define XFS_MOUNT_RDONLY (1ULL << 4)/* read-only fs */ /* * If set, inactivation worker threads will be scheduled to process queued
fs/xfs/xfs_super.c +68 -73
310 lines not on this page · raw message
fs/xfs/xfs_symlink.c +1 -2
@@ -321,9 +321,8 @@ xfs_symlink(* symlink transaction goes to disk before returning to * the user. */ -if (mp->m_flags & (XFS_MOUNT_WSYNC |XFS_MOUNT_DIRSYNC )) { +if (xfs_has_wsync (mp) ||xfs_has_dirsync (mp))xfs_trans_set_sync (tp); - } error =xfs_trans_commit (tp);if (error)
Signature · 1 line
2.31.1
Re: [PATCH 07/16] xfs: convert mount flags to features
Quoted 6 lines · Dave Chinner
From: Dave Chinner <[email protected]>
Replace
m_flagsfeature checks with xfs_has_<feature>() calls and rework the setup code to set flags inm_features.Signed-off-by Dave Chinner <[email protected]>
The attr2 upgrade logic looks correct now. Aside from removing the ability to downgrade to attr1 via 'noattr2' (which only ever worked for deprecated V4 filesystems), I think the attr2 handling is the same as before.
The rest looks about the same as last time.
--D
Quoted 1,023 lines
--- fs/xfs/libxfs/xfs_attr.c | 4 +- fs/xfs/libxfs/xfs_attr_leaf.c | 41 +++++----- fs/xfs/libxfs/xfs_bmap.c | 4 +- fs/xfs/libxfs/xfs_ialloc.c | 10 +-- fs/xfs/scrub/scrub.c | 2 +- fs/xfs/xfs_acl.c | 2 +- fs/xfs/xfs_bmap_util.c | 2 +- fs/xfs/xfs_discard.c | 2 +- fs/xfs/xfs_export.c | 2 +- fs/xfs/xfs_file.c | 2 +- fs/xfs/xfs_filestream.h | 2 +- fs/xfs/xfs_icache.c | 7 +- fs/xfs/xfs_inode.c | 15 ++-- fs/xfs/xfs_inode.h | 3 +- fs/xfs/xfs_ioctl.c | 5 +- fs/xfs/xfs_iomap.c | 4 +- fs/xfs/xfs_iops.c | 12 +-- fs/xfs/xfs_log.c | 14 ++-- fs/xfs/xfs_log_cil.c | 4 +- fs/xfs/xfs_mount.c | 24 +++--- fs/xfs/xfs_mount.h | 26 +------ fs/xfs/xfs_super.c | 141 ++++++++++++++++------------------ fs/xfs/xfs_symlink.c | 3 +- 23 files changed, 152 insertions(+), 179 deletions(-)fs/xfs/libxfs/xfs_attr.c +2
-2@@ -224,7 +224,7 @@ xfs_attr_try_sf_addname(if (!error && !(args->op_flags &XFS_DA_OP_NOTIME ))xfs_trans_ichgtime (args->trans, dp,XFS_ICHGTIME_CHG ); -if (dp->i_mount->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (dp->i_mount))xfs_trans_set_sync (args->trans);return error;@@ -808,7 +808,7 @@ xfs_attr_set(* If this is a synchronous mount, make sure that the * transaction goes to disk before returning to the user. */ -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (args->trans);if (!(args->op_flags &XFS_DA_OP_NOTIME ))fs/xfs/libxfs/xfs_attr_leaf.c +23
-18@@ -568,7 +568,7 @@ xfs_attr_shortform_bytesfit(* literal area, but for the old format we are done if there is no * space in the fixed attribute fork. */ -if (!(mp->m_flags &XFS_MOUNT_ATTR2 )) +if (!xfs_has_attr2 (mp))return 0 ; dsize = dp->i_df.if_bytes;@@ -621,21 +621,27 @@ xfs_attr_shortform_bytesfit( }/* -* Switch on the ATTR2 superblock bit (implies also FEATURES2) +* Switch on the ATTR2 superblock bit (implies also FEATURES2) unless: +* - noattr2 mount option is set, +* - on-disk version bit says it is already set, or +* - the attr2 mount option is not set to enable automatic upgrade from attr1. */ STATIC void -xfs_sbversion_add_attr2 (xfs_mount_t *mp,xfs_trans_t *tp) +xfs_sbversion_add_attr2 ( +struct xfs_mount *mp, +struct xfs_trans *tp) { -if ((mp->m_flags &XFS_MOUNT_ATTR2 ) && - !(xfs_has_attr2 (mp))) { -spin_lock (&mp->m_sb_lock); -if (!xfs_has_attr2 (mp)) { -xfs_add_attr2 (mp); -spin_unlock (&mp->m_sb_lock); -xfs_log_sb (tp); - }else -spin_unlock (&mp->m_sb_lock); - } +if (xfs_has_noattr2 (mp)) +return ; +if (mp->m_sb.sb_features2 &XFS_SB_VERSION2_ATTR2BIT ) +return ; +if (!xfs_has_attr2 (mp)) +return ; + +spin_lock (&mp->m_sb_lock); +xfs_add_attr2 (mp); +spin_unlock (&mp->m_sb_lock); +xfs_log_sb (tp); }/* @@ -810,8 +816,7 @@ xfs_attr_sf_removename(* Fix up the start offset of the attribute fork */ totsize -= size; -if (totsize ==sizeof (xfs_attr_sf_hdr_t) && - (mp->m_flags &XFS_MOUNT_ATTR2 ) && +if (totsize ==sizeof (xfs_attr_sf_hdr_t) &&xfs_has_attr2 (mp) && (dp->i_df.if_format !=XFS_DINODE_FMT_BTREE ) && !(args->op_flags &XFS_DA_OP_ADDNAME )) {xfs_attr_fork_remove (dp, args->trans);@@ -821,7 +826,7 @@ xfs_attr_sf_removename(ASSERT (dp->i_forkoff);ASSERT (totsize >sizeof (xfs_attr_sf_hdr_t) || (args->op_flags &XFS_DA_OP_ADDNAME ) || - !(mp->m_flags &XFS_MOUNT_ATTR2 ) || + !xfs_has_attr2 (mp) || dp->i_df.if_format ==XFS_DINODE_FMT_BTREE );xfs_trans_log_inode (args->trans, dp,XFS_ILOG_CORE |XFS_ILOG_ADATA );@@ -997,7 +1002,7 @@ xfs_attr_shortform_allfit( bytes +=xfs_attr_sf_entsize_byname (name_loc->namelen,be16_to_cpu (name_loc->valuelen)); } -if ((dp->i_mount->m_flags &XFS_MOUNT_ATTR2 ) && +if (xfs_has_attr2 (dp->i_mount) && (dp->i_df.if_format !=XFS_DINODE_FMT_BTREE ) && (bytes ==sizeof (struct xfs_attr_sf_hdr )))return -1 ;@@ -1122,7 +1127,7 @@ xfs_attr3_leaf_to_shortform( goto out;if (forkoff ==-1 ) { -ASSERT (dp->i_mount->m_flags &XFS_MOUNT_ATTR2 ); +ASSERT (xfs_has_attr2 (dp->i_mount));ASSERT (dp->i_df.if_format !=XFS_DINODE_FMT_BTREE );xfs_attr_fork_remove (dp, args->trans); goto out;fs/xfs/libxfs/xfs_bmap.c +2
-2@@ -1047,7 +1047,7 @@ xfs_bmap_set_attrforkoff( ip->i_forkoff =xfs_attr_shortform_bytesfit (ip, size);if (!ip->i_forkoff) ip->i_forkoff = default_size; -else if ((ip->i_mount->m_flags &XFS_MOUNT_ATTR2 ) && version) +else if (xfs_has_attr2 (ip->i_mount) && version) *version =2 ;break ;default :@@ -3422,7 +3422,7 @@ xfs_bmap_compute_alignments(int stripe_align =0 ;/* stripe alignment for allocation is determined by mount parameters */ -if (mp->m_swidth && (mp->m_flags &XFS_MOUNT_SWALLOC )) +if (mp->m_swidth &&xfs_has_swalloc (mp)) stripe_align = mp->m_swidth;else if (mp->m_dalign) stripe_align = mp->m_dalign;fs/xfs/libxfs/xfs_ialloc.c +4
-6@@ -712,7 +712,7 @@ xfs_ialloc_ag_alloc(*/ isaligned =0 ;if (igeo->ialloc_align) { -ASSERT (!(args.mp->m_flags &XFS_MOUNT_NOALIGN )); +ASSERT (!xfs_has_noalign (args.mp)); args.alignment = args.mp->m_dalign; isaligned =1 ; }else @@ -1953,8 +1953,7 @@ xfs_difree_inobt(* remove the chunk if the block size is large enough for multiple inode * chunks (that might not be free). */ -if (!(mp->m_flags &XFS_MOUNT_IKEEP ) && - rec.ir_free ==XFS_INOBT_ALL_FREE && +if (!xfs_has_ikeep (mp) && rec.ir_free ==XFS_INOBT_ALL_FREE && mp->m_sb.sb_inopblock <=XFS_INODES_PER_CHUNK ) {struct xfs_perag *pag = agbp->b_pag;@@ -2098,9 +2097,8 @@ xfs_difree_finobt(* enough for multiple chunks. Leave the finobt record to remain in sync * with the inobt. */ -if (rec.ir_free ==XFS_INOBT_ALL_FREE && - mp->m_sb.sb_inopblock <=XFS_INODES_PER_CHUNK && - !(mp->m_flags &XFS_MOUNT_IKEEP )) { +if (!xfs_has_ikeep (mp) && rec.ir_free ==XFS_INOBT_ALL_FREE && + mp->m_sb.sb_inopblock <=XFS_INODES_PER_CHUNK ) { error =xfs_btree_delete (cur, &i);if (error) goto error;fs/xfs/scrub/scrub.c +1
-1@@ -483,7 +483,7 @@ xfs_scrub_metadata(if (XFS_FORCED_SHUTDOWN (mp)) goto out; error = -ENOTRECOVERABLE ; -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) +if (xfs_has_norecovery (mp)) goto out; error =xchk_validate_inputs (mp, sm);fs/xfs/xfs_acl.c +1
-1@@ -232,7 +232,7 @@ xfs_acl_set_mode( inode->i_ctime =current_time (inode);xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp);return xfs_trans_commit (tp); }fs/xfs/xfs_bmap_util.c +1
-1@@ -1822,7 +1822,7 @@ xfs_swap_extents(* If this is a synchronous mount, make sure that the * transaction goes to disk before returning to the user. */ -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp); error =xfs_trans_commit (tp);fs/xfs/xfs_discard.c +1
-1@@ -169,7 +169,7 @@ xfs_ioc_trim(* We haven't recovered the log, so we cannot use our bnobt-guided * storage zapping commands. */ -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) +if (xfs_has_norecovery (mp))return -EROFS ;if (copy_from_user (&range, urange,sizeof (range)))fs/xfs/xfs_export.c +1
-1@@ -63,7 +63,7 @@ xfs_fs_encode_fh(* large enough filesystem may contain them, thus the slightly * confusing looking conditional below. */ -if (!(XFS_M (inode->i_sb)->m_flags &XFS_MOUNT_SMALL_INUMS ) || +if (!xfs_has_small_inums (XFS_M (inode->i_sb)) || (XFS_M (inode->i_sb)->m_flags &XFS_MOUNT_32BITINODES )) fileid_type |=XFS_FILEID_TYPE_64FLAG ;fs/xfs/xfs_file.c +1
-1@@ -1122,7 +1122,7 @@ static inline bool xfs_file_sync_writes(struct file *filp) {struct xfs_inode *ip =XFS_I (file_inode (filp)); -if (ip->i_mount->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (ip->i_mount))return true;if (filp->f_flags & (__O_SYNC |O_DSYNC ))return true;fs/xfs/xfs_filestream.h +1
-1@@ -21,7 +21,7 @@ static inline intxfs_inode_is_filestream ( struct xfs_inode *ip) { -return (ip->i_mount->m_flags &XFS_MOUNT_FILESTREAMS ) || +return xfs_has_filestreams (ip->i_mount) || (ip->i_diflags &XFS_DIFLAG_FILESTREAM ); }fs/xfs/xfs_icache.c +3
-4@@ -611,7 +611,7 @@ xfs_iget_cache_miss(/* * For version 5 superblocks, if we are initialising a new inode and we -* are not utilising the XFS_MOUNT_IKEEP inode cluster mode, we can +* are not utilising the XFS_FEAT_IKEEP inode cluster mode, we can * simply build the new inode core with a random generation number. * * For version 4 (and older) superblocks, log recovery is dependent on @@ -620,7 +620,7 @@ xfs_iget_cache_miss(* initializing new inodes. */ if (xfs_has_v3inodes (mp) && - (flags &XFS_IGET_CREATE ) && !(mp->m_flags &XFS_MOUNT_IKEEP )) { + (flags &XFS_IGET_CREATE ) && !xfs_has_ikeep (mp)) {VFS_I (ip)->i_generation =prandom_u32 (); }else {struct xfs_buf *bp;@@ -976,8 +976,7 @@ static inline boolxfs_want_reclaim_sick ( struct xfs_mount *mp) { -return (mp->m_flags &XFS_MOUNT_UNMOUNTING ) || - (mp->m_flags &XFS_MOUNT_NORECOVERY ) || +return (mp->m_flags &XFS_MOUNT_UNMOUNTING ) ||xfs_has_norecovery (mp) ||XFS_FORCED_SHUTDOWN (mp); }fs/xfs/xfs_inode.c +7
-8@@ -826,8 +826,7 @@ xfs_init_new_inode( inode->i_rdev = rdev; ip->i_projid = prid; -if (dir && !(dir->i_mode &S_ISGID ) && - (mp->m_flags &XFS_MOUNT_GRPID )) { +if (dir && !(dir->i_mode &S_ISGID ) &&xfs_has_grpid (mp)) {inode_fsuid_set (inode, mnt_userns); inode->i_gid = dir->i_gid; inode->i_mode = mode;@@ -1068,7 +1067,7 @@ xfs_create(* create transaction goes to disk before returning to * the user. */ -if (mp->m_flags & (XFS_MOUNT_WSYNC |XFS_MOUNT_DIRSYNC )) +if (xfs_has_wsync (mp) ||xfs_has_dirsync (mp))xfs_trans_set_sync (tp);/* @@ -1160,7 +1159,7 @@ xfs_create_tmpfile(if (error) goto out_trans_cancel; -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp);/* @@ -1294,7 +1293,7 @@ xfs_link(* link transaction goes to disk before returning to * the user. */ -if (mp->m_flags & (XFS_MOUNT_WSYNC |XFS_MOUNT_DIRSYNC )) +if (xfs_has_wsync (mp) ||xfs_has_dirsync (mp))xfs_trans_set_sync (tp);return xfs_trans_commit (tp);@@ -1679,7 +1678,7 @@ xfs_inode_needs_inactive(return false;/* If the log isn't running, push inodes straight to reclaim. */ -if (XFS_FORCED_SHUTDOWN (mp) || (mp->m_flags &XFS_MOUNT_NORECOVERY )) +if (XFS_FORCED_SHUTDOWN (mp) ||xfs_has_norecovery (mp))return false;/* Metadata inodes require explicit resource cleanup. */ @@ -2855,7 +2854,7 @@ xfs_remove(* remove transaction goes to disk before returning to * the user. */ -if (mp->m_flags & (XFS_MOUNT_WSYNC |XFS_MOUNT_DIRSYNC )) +if (xfs_has_wsync (mp) ||xfs_has_dirsync (mp))xfs_trans_set_sync (tp); error =xfs_trans_commit (tp);@@ -2932,7 +2931,7 @@ xfs_finish_rename(* If this is a synchronous mount, make sure that the rename transaction * goes to disk before returning to the user. */ -if (tp->t_mountp->m_flags & (XFS_MOUNT_WSYNC |XFS_MOUNT_DIRSYNC )) +if (xfs_has_wsync (tp->t_mountp) ||xfs_has_dirsync (tp->t_mountp))xfs_trans_set_sync (tp);return xfs_trans_commit (tp);fs/xfs/xfs_inode.h +1
-2@@ -400,8 +400,7 @@ enum layout_break_reason {* new subdirectory gets S_ISGID bit from parent. */ #define XFS_INHERIT_GID (pip) \ - (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \ - (VFS_I(pip)->i_mode & S_ISGID)) + (xfs_has_grpid((pip)->i_mount) || (VFS_I(pip)->i_mode & S_ISGID))int xfs_release (struct xfs_inode *ip);void xfs_inactive (struct xfs_inode *ip);fs/xfs/xfs_ioctl.c +2
-3@@ -1237,8 +1237,7 @@ xfs_ioctl_setattr_prepare_dax(if (S_ISDIR (inode->i_mode))return ; -if ((mp->m_flags &XFS_MOUNT_DAX_ALWAYS ) || - (mp->m_flags &XFS_MOUNT_DAX_NEVER )) +if (xfs_has_dax_always (mp) ||xfs_has_dax_never (mp))return ; if (((fa->fsx_xflags & FS_XFLAG_DAX) &&@@ -1274,7 +1273,7 @@ xfs_ioctl_setattr_get_trans(if (error) goto out_error; -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp);return tp;fs/xfs/xfs_iomap.c +2
-2@@ -132,7 +132,7 @@ xfs_eof_alignment(* If mounted with the "-o swalloc" option the alignment is * increased from the strip unit size to the stripe width. */ -if (mp->m_swidth && (mp->m_flags &XFS_MOUNT_SWALLOC )) +if (mp->m_swidth &&xfs_has_swalloc (mp)) align = mp->m_swidth;else if (mp->m_dalign) align = mp->m_dalign;@@ -994,7 +994,7 @@ xfs_buffered_write_iomap_begin(* Determine the initial size of the preallocation. * We clean up any extra preallocation when the file is closed. */ -if (mp->m_flags &XFS_MOUNT_ALLOCSIZE ) +if (xfs_has_allocsize (mp)) prealloc_blocks = mp->m_allocsize_blocks;else prealloc_blocks = xfs_iomap_prealloc_size(ip, allocfork,fs/xfs/xfs_iops.c +6
-6@@ -558,10 +558,10 @@ xfs_stat_blksize(* default buffered I/O size, return that, otherwise return the compat * default. */ -if (mp->m_flags &XFS_MOUNT_LARGEIO ) { +if (xfs_has_large_iosize (mp)) {if (mp->m_swidth)return XFS_FSB_TO_B (mp, mp->m_swidth); -if (mp->m_flags &XFS_MOUNT_ALLOCSIZE ) +if (xfs_has_allocsize (mp))return 1U << mp->m_allocsize_log; }@@ -808,7 +808,7 @@ xfs_setattr_nonsize(XFS_STATS_INC (mp, xs_ig_attrchg); -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp); error =xfs_trans_commit (tp);@@ -1037,7 +1037,7 @@ xfs_setattr_size(XFS_STATS_INC (mp, xs_ig_attrchg); -if (mp->m_flags &XFS_MOUNT_WSYNC ) +if (xfs_has_wsync (mp))xfs_trans_set_sync (tp); error =xfs_trans_commit (tp);@@ -1287,11 +1287,11 @@ xfs_inode_should_enable_dax( {if (!IS_ENABLED (CONFIG_FS_DAX ))return false; -if (ip->i_mount->m_flags &XFS_MOUNT_DAX_NEVER ) +if (xfs_has_dax_never (ip->i_mount))return false;if (!xfs_inode_supports_dax (ip))return false; -if (ip->i_mount->m_flags &XFS_MOUNT_DAX_ALWAYS ) +if (xfs_has_dax_always (ip->i_mount))return true;if (ip->i_diflags2 &XFS_DIFLAG2_DAX )return true;fs/xfs/xfs_log.c +7
-7@@ -361,7 +361,7 @@ xfs_log_writable(* mounts allow internal writes for log recovery and unmount purposes, * so don't restrict that case. */ -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) +if (xfs_has_norecovery (mp))return false;if (xfs_readonly_buftarg (mp->m_ddev_targp))return false;@@ -638,7 +638,7 @@ xfs_log_mount(int error =0 ;int min_logfsbs; -if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { +if (!xfs_has_norecovery (mp)) {xfs_notice (mp,"Mounting V%d Filesystem" ,XFS_SB_VERSION_NUM (&mp->m_sb)); }else {@@ -724,8 +724,8 @@ xfs_log_mount(* skip log recovery on a norecovery mount. pretend it all * just worked. */ -if (!(mp->m_flags &XFS_MOUNT_NORECOVERY )) { -int readonly = (mp->m_flags &XFS_MOUNT_RDONLY ); +if (!xfs_has_norecovery (mp)) { +bool readonly = (mp->m_flags &XFS_MOUNT_RDONLY );if (readonly) mp->m_flags &= ~XFS_MOUNT_RDONLY ;@@ -785,8 +785,8 @@ xfs_log_mount_finish(bool readonly = (mp->m_flags &XFS_MOUNT_RDONLY );int error =0 ; -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) { -ASSERT (mp->m_flags &XFS_MOUNT_RDONLY ); +if (xfs_has_norecovery (mp)) { +ASSERT (readonly);return 0 ; }else if (readonly) {/* Allow unlinked processing to proceed */ @@ -3937,7 +3937,7 @@ xfs_log_check_lsn(* resets the in-core LSN. We can't validate in this mode, but * modifications are not allowed anyways so just return true. */ -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) +if (xfs_has_norecovery (mp))return true;/* fs/xfs/xfs_log_cil.c +2
-2@@ -543,7 +543,7 @@ xlog_discard_busy_extents(struct blk_plug plug;int error =0 ; -ASSERT (mp->m_flags &XFS_MOUNT_DISCARD ); +ASSERT (xfs_has_discard (mp));blk_start_plug (&plug);list_for_each_entry (busyp, list, list) {@@ -605,7 +605,7 @@ xlog_cil_committed(xfs_extent_busy_sort (&ctx->busy_extents);xfs_extent_busy_clear (mp, &ctx->busy_extents, - (mp->m_flags &XFS_MOUNT_DISCARD ) && !abort); +xfs_has_discard (mp) && !abort);spin_lock (&ctx->cil->xc_push_lock);list_del (&ctx->committing);fs/xfs/xfs_mount.c +12
-12@@ -62,7 +62,7 @@ xfs_uuid_mount(/* Publish UUID in struct super_block */ uuid_copy (&mp->m_super->s_uuid, uuid); -if (mp->m_flags &XFS_MOUNT_NOUUID ) +if (xfs_has_nouuid (mp))return 0 ;if (uuid_is_null (uuid)) {@@ -104,7 +104,7 @@ xfs_uuid_unmount(uuid_t *uuid = &mp->m_sb.sb_uuid;int i; -if (mp->m_flags &XFS_MOUNT_NOUUID ) +if (xfs_has_nouuid (mp))return ;mutex_lock (&xfs_uuid_table_mutex);@@ -350,8 +350,7 @@ xfs_update_alignment( sbp->sb_unit = mp->m_dalign; sbp->sb_width = mp->m_swidth; mp->m_update_sb = true; - }else if ((mp->m_flags &XFS_MOUNT_NOALIGN ) !=XFS_MOUNT_NOALIGN && -xfs_has_dalign (mp)) { + }else if (!xfs_has_noalign (mp) &&xfs_has_dalign (mp)) { mp->m_dalign = sbp->sb_unit; mp->m_swidth = sbp->sb_width; }@@ -783,12 +782,15 @@ xfs_mountfs(/* * Now that we've recovered any pending superblock feature bit * additions, we can finish setting up the attr2 behaviour for the -* mount. If no attr2 mount options were specified, the we use the -* behaviour specified by the superblock feature bit. +* mount. The noattr2 option overrides the superblock flag, so only +* check the superblock feature flag if the mount option is not set. */ -if (!(mp->m_flags & (XFS_MOUNT_ATTR2 |XFS_MOUNT_NOATTR2 )) && -xfs_has_attr2 (mp)) - mp->m_flags |=XFS_MOUNT_ATTR2 ; +if (xfs_has_noattr2 (mp)) { + mp->m_features &= ~XFS_FEAT_ATTR2 ; + }else if (!xfs_has_attr2 (mp) && + (mp->m_sb.sb_features2 &XFS_SB_VERSION2_ATTR2BIT )) { + mp->m_features |=XFS_FEAT_ATTR2 ; + }/* * Get and sanity-check the root inode. @@ -890,10 +892,8 @@ xfs_mountfs(* We use the same quiesce mechanism as the rw->ro remount, as they are * semantically identical operations. */ -if ((mp->m_flags & (XFS_MOUNT_RDONLY |XFS_MOUNT_NORECOVERY )) == -XFS_MOUNT_RDONLY ) { +if ((mp->m_flags &XFS_MOUNT_RDONLY ) && !xfs_has_norecovery (mp))xfs_log_clean (mp); - }/* * Complete the quota initialisation, post-log-replay component. fs/xfs/xfs_mount.h +3
-23@@ -371,32 +371,12 @@ __XFS_HAS_FEAT(nouuid, NOUUID)must be synchronous except for space allocations */ #define XFS_MOUNT_UNMOUNTING (1ULL << 1)/* filesystem is unmounting */ -#define XFS_MOUNT_WAS_CLEAN (1ULL << 3) -#define XFS_MOUNT_FS_SHUTDOWN (1ULL << 4)/* atomic stop of all filesystem +#define XFS_MOUNT_WAS_CLEAN (1ULL << 2) +#define XFS_MOUNT_FS_SHUTDOWN (1ULL << 3)/* atomic stop of all filesystem operations, typically for disk errors in metadata */ -#define XFS_MOUNT_DISCARD (1ULL << 5)/* discard unused blocks */ -#define XFS_MOUNT_NOALIGN (1ULL << 7)/* turn off stripe alignment -allocations */ -#define XFS_MOUNT_ATTR2 (1ULL << 8)/* allow use of attr2 format */ -#define XFS_MOUNT_GRPID (1ULL << 9)/* group-ID assigned from directory */ -#define XFS_MOUNT_NORECOVERY (1ULL << 10)/* no recovery - dirty fs */ -#define XFS_MOUNT_ALLOCSIZE (1ULL << 12)/* specified allocation size */ -#define XFS_MOUNT_SMALL_INUMS (1ULL << 14)/* user wants 32bit inodes */ #define XFS_MOUNT_32BITINODES (1ULL << 15)/* inode32 allocator active */ -#define XFS_MOUNT_NOUUID (1ULL << 16)/* ignore uuid during mount */ -#define XFS_MOUNT_IKEEP (1ULL << 18)/* keep empty inode clusters*/ -#define XFS_MOUNT_SWALLOC (1ULL << 19)/* turn on stripe width -* allocation */ -#define XFS_MOUNT_RDONLY (1ULL << 20)/* read-only fs */ -#define XFS_MOUNT_DIRSYNC (1ULL << 21)/* synchronous directory ops */ -#define XFS_MOUNT_LARGEIO (1ULL << 22)/* report large preferred -* I/O size in stat() */ -#define XFS_MOUNT_FILESTREAMS (1ULL << 24)/* enable the filestreams -allocator */ -#define XFS_MOUNT_NOATTR2 (1ULL << 25)/* disable use of attr2 format */ -#define XFS_MOUNT_DAX_ALWAYS (1ULL << 26) -#define XFS_MOUNT_DAX_NEVER (1ULL << 27) +#define XFS_MOUNT_RDONLY (1ULL << 4)/* read-only fs */ /* * If set, inactivation worker threads will be scheduled to process queued fs/xfs/xfs_super.c +68
-73@@ -84,15 +84,15 @@ xfs_mount_set_dax_mode( {switch (mode) {case XFS_DAX_INODE : - mp->m_flags &= ~(XFS_MOUNT_DAX_ALWAYS |XFS_MOUNT_DAX_NEVER ); + mp->m_features &= ~(XFS_FEAT_DAX_ALWAYS |XFS_FEAT_DAX_NEVER );break ;case XFS_DAX_ALWAYS : - mp->m_flags |=XFS_MOUNT_DAX_ALWAYS ; - mp->m_flags &= ~XFS_MOUNT_DAX_NEVER ; + mp->m_features |=XFS_FEAT_DAX_ALWAYS ; + mp->m_features &= ~XFS_FEAT_DAX_NEVER ;break ;case XFS_DAX_NEVER : - mp->m_flags |=XFS_MOUNT_DAX_NEVER ; - mp->m_flags &= ~XFS_MOUNT_DAX_ALWAYS ; + mp->m_features |=XFS_FEAT_DAX_NEVER ; + mp->m_features &= ~XFS_FEAT_DAX_ALWAYS ;break ; } }@@ -176,33 +176,32 @@ xfs_fs_show_options( {static struct proc_xfs_info xfs_info_set[] = {/* the few simple ones we can get from the mount struct */ - {XFS_MOUNT_IKEEP ,",ikeep" }, - {XFS_MOUNT_WSYNC ,",wsync" }, - {XFS_MOUNT_NOALIGN ,",noalign" }, - {XFS_MOUNT_SWALLOC ,",swalloc" }, - {XFS_MOUNT_NOUUID ,",nouuid" }, - {XFS_MOUNT_NORECOVERY ,",norecovery" }, - {XFS_MOUNT_ATTR2 ,",attr2" }, - {XFS_MOUNT_FILESTREAMS ,",filestreams" }, - {XFS_MOUNT_GRPID ,",grpid" }, - {XFS_MOUNT_DISCARD ,",discard" }, - {XFS_MOUNT_LARGEIO ,",largeio" }, - {XFS_MOUNT_DAX_ALWAYS ,",dax=always" }, - {XFS_MOUNT_DAX_NEVER ,",dax=never" }, + {XFS_FEAT_IKEEP ,",ikeep" }, + {XFS_FEAT_WSYNC ,",wsync" }, + {XFS_FEAT_NOALIGN ,",noalign" }, + {XFS_FEAT_SWALLOC ,",swalloc" }, + {XFS_FEAT_NOUUID ,",nouuid" }, + {XFS_FEAT_NORECOVERY ,",norecovery" }, + {XFS_FEAT_ATTR2 ,",attr2" }, + {XFS_FEAT_FILESTREAMS ,",filestreams" }, + {XFS_FEAT_GRPID ,",grpid" }, + {XFS_FEAT_DISCARD ,",discard" }, + {XFS_FEAT_LARGE_IOSIZE ,",largeio" }, + {XFS_FEAT_DAX_ALWAYS ,",dax=always" }, + {XFS_FEAT_DAX_NEVER ,",dax=never" }, {0 ,NULL } };struct xfs_mount *mp =XFS_M (root->d_sb);struct proc_xfs_info *xfs_infop;for (xfs_infop = xfs_info_set; xfs_infop->flag; xfs_infop++) { -if (mp->m_flags & xfs_infop->flag) +if (mp->m_features & xfs_infop->flag)seq_puts (m, xfs_infop->str); } -seq_printf (m,",inode%d" , - (mp->m_flags &XFS_MOUNT_SMALL_INUMS ) ?32 :64 ); +seq_printf (m,",inode%d" ,xfs_has_small_inums (mp) ?32 :64 ); -if (mp->m_flags &XFS_MOUNT_ALLOCSIZE ) +if (xfs_has_allocsize (mp))seq_printf (m,",allocsize=%dk" , (1 << mp->m_allocsize_log) >>10 );@@ -247,10 +246,10 @@ xfs_fs_show_options(/* * Set parameters for inode allocation heuristics, taking into account * filesystem size and inode32/inode64 mount options; i.e. specifically -* whether or not XFS_MOUNT_SMALL_INUMS is set. +* whether or not XFS_FEAT_SMALL_INUMS is set. * * Inode allocation patterns are altered only if inode32 is requested -* (XFS_MOUNT_SMALL_INUMS), and the filesystem is sufficiently large. +* (XFS_FEAT_SMALL_INUMS), and the filesystem is sufficiently large. * If altered, XFS_MOUNT_32BITINODES is set as well. * * An agcount independent of that in the mount structure is provided @@ -296,7 +295,7 @@ xfs_set_inode_alloc(* sufficiently large, set XFS_MOUNT_32BITINODES if we must alter * the allocator to accommodate the request. */ -if ((mp->m_flags &XFS_MOUNT_SMALL_INUMS ) && ino >XFS_MAXINUMBER_32 ) +if (xfs_has_small_inums (mp) && ino >XFS_MAXINUMBER_32 ) mp->m_flags |=XFS_MOUNT_32BITINODES ;else mp->m_flags &= ~XFS_MOUNT_32BITINODES ;@@ -961,8 +960,7 @@ xfs_finish_flags(/* * V5 filesystems always use attr2 format for attributes. */ -if (xfs_has_crc (mp) && - (mp->m_flags &XFS_MOUNT_NOATTR2 )) { +if (xfs_has_crc (mp) &&xfs_has_noattr2 (mp)) {xfs_warn (mp,"Cannot mount a V5 filesystem as noattr2. " "attr2 is always enabled for V5 filesystems." );return -EINVAL ;@@ -1177,7 +1175,7 @@ xfs_fs_warn_deprecated(* already had the flag set */ if ((fc->purpose &FS_CONTEXT_FOR_RECONFIGURE ) && - !!(XFS_M (fc->root->d_sb)->m_flags & flag) == value) + !!(XFS_M (fc->root->d_sb)->m_features & flag) == value)return ;xfs_warn (fc->s_fs_info,"%s mount option is deprecated." , param->key); }@@ -1225,27 +1223,27 @@ xfs_fs_parse_param(if (suffix_kstrtoint (param->string,10 , &size))return -EINVAL ; parsing_mp->m_allocsize_log =ffs (size) -1 ; - parsing_mp->m_flags |=XFS_MOUNT_ALLOCSIZE ; + parsing_mp->m_features |=XFS_FEAT_ALLOCSIZE ;return 0 ;case Opt_grpid:case Opt_bsdgroups: - parsing_mp->m_flags |=XFS_MOUNT_GRPID ; + parsing_mp->m_features |=XFS_FEAT_GRPID ;return 0 ;case Opt_nogrpid:case Opt_sysvgroups: - parsing_mp->m_flags &= ~XFS_MOUNT_GRPID ; + parsing_mp->m_features &= ~XFS_FEAT_GRPID ;return 0 ;case Opt_wsync: - parsing_mp->m_flags |=XFS_MOUNT_WSYNC ; + parsing_mp->m_features |=XFS_FEAT_WSYNC ;return 0 ;case Opt_norecovery: - parsing_mp->m_flags |=XFS_MOUNT_NORECOVERY ; + parsing_mp->m_features |=XFS_FEAT_NORECOVERY ;return 0 ;case Opt_noalign: - parsing_mp->m_flags |=XFS_MOUNT_NOALIGN ; + parsing_mp->m_features |=XFS_FEAT_NOALIGN ;return 0 ;case Opt_swalloc: - parsing_mp->m_flags |=XFS_MOUNT_SWALLOC ; + parsing_mp->m_features |=XFS_FEAT_SWALLOC ;return 0 ;case Opt_sunit: parsing_mp->m_dalign = result.uint_32;@@ -1254,22 +1252,22 @@ xfs_fs_parse_param( parsing_mp->m_swidth = result.uint_32;return 0 ;case Opt_inode32: - parsing_mp->m_flags |=XFS_MOUNT_SMALL_INUMS ; + parsing_mp->m_features |=XFS_FEAT_SMALL_INUMS ;return 0 ;case Opt_inode64: - parsing_mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS ; + parsing_mp->m_features &= ~XFS_FEAT_SMALL_INUMS ;return 0 ;case Opt_nouuid: - parsing_mp->m_flags |=XFS_MOUNT_NOUUID ; + parsing_mp->m_features |=XFS_FEAT_NOUUID ;return 0 ;case Opt_largeio: - parsing_mp->m_flags |=XFS_MOUNT_LARGEIO ; + parsing_mp->m_features |=XFS_FEAT_LARGE_IOSIZE ;return 0 ;case Opt_nolargeio: - parsing_mp->m_flags &= ~XFS_MOUNT_LARGEIO ; + parsing_mp->m_features &= ~XFS_FEAT_LARGE_IOSIZE ;return 0 ;case Opt_filestreams: - parsing_mp->m_flags |=XFS_MOUNT_FILESTREAMS ; + parsing_mp->m_features |=XFS_FEAT_FILESTREAMS ;return 0 ;case Opt_noquota: parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT ;@@ -1302,10 +1300,10 @@ xfs_fs_parse_param( parsing_mp->m_qflags &= ~XFS_GQUOTA_ENFD ;return 0 ;case Opt_discard: - parsing_mp->m_flags |=XFS_MOUNT_DISCARD ; + parsing_mp->m_features |=XFS_FEAT_DISCARD ;return 0 ;case Opt_nodiscard: - parsing_mp->m_flags &= ~XFS_MOUNT_DISCARD ; + parsing_mp->m_features &= ~XFS_FEAT_DISCARD ;return 0 ;#ifdef CONFIG_FS_DAX case Opt_dax:@@ -1317,20 +1315,20 @@ xfs_fs_parse_param(#endif /* Following mount options will be removed in September 2025 */ case Opt_ikeep: -xfs_fs_warn_deprecated (fc, param,XFS_MOUNT_IKEEP , true); - parsing_mp->m_flags |=XFS_MOUNT_IKEEP ; +xfs_fs_warn_deprecated (fc, param,XFS_FEAT_IKEEP , true); + parsing_mp->m_features |=XFS_FEAT_IKEEP ;return 0 ;case Opt_noikeep: -xfs_fs_warn_deprecated (fc, param,XFS_MOUNT_IKEEP , false); - parsing_mp->m_flags &= ~XFS_MOUNT_IKEEP ; +xfs_fs_warn_deprecated (fc, param,XFS_FEAT_IKEEP , false); + parsing_mp->m_features &= ~XFS_FEAT_IKEEP ;return 0 ;case Opt_attr2: -xfs_fs_warn_deprecated (fc, param,XFS_MOUNT_ATTR2 , true); - parsing_mp->m_flags |=XFS_MOUNT_ATTR2 ; +xfs_fs_warn_deprecated (fc, param,XFS_FEAT_ATTR2 , true); + parsing_mp->m_features |=XFS_FEAT_ATTR2 ;return 0 ;case Opt_noattr2: -xfs_fs_warn_deprecated (fc, param,XFS_MOUNT_NOATTR2 , true); - parsing_mp->m_flags |=XFS_MOUNT_NOATTR2 ; +xfs_fs_warn_deprecated (fc, param,XFS_FEAT_NOATTR2 , true); + parsing_mp->m_features |=XFS_FEAT_NOATTR2 ;return 0 ;default :xfs_warn (parsing_mp,"unknown mount option [%s]." , param->key);@@ -1344,24 +1342,23 @@ static intxfs_fs_validate_params ( struct xfs_mount *mp) { -/* -* no recovery flag requires a read-only mount -*/ -if ((mp->m_flags &XFS_MOUNT_NORECOVERY ) && - !(mp->m_flags &XFS_MOUNT_RDONLY )) { +/* No recovery flag requires a read-only mount */ +if (xfs_has_norecovery (mp) && !(mp->m_flags &XFS_MOUNT_RDONLY )) {xfs_warn (mp,"no-recovery mounts must be read-only." );return -EINVAL ; } -if ((mp->m_flags & (XFS_MOUNT_ATTR2 |XFS_MOUNT_NOATTR2 )) == - (XFS_MOUNT_ATTR2 |XFS_MOUNT_NOATTR2 )) { +/* +* We have not read the superblock at this point, so only the attr2 +* mount option can set the attr2 feature by this stage. +*/ +if (xfs_has_attr2 (mp) &&xfs_has_noattr2 (mp)) {xfs_warn (mp,"attr2 and noattr2 cannot both be specified." );return -EINVAL ; } -if ((mp->m_flags &XFS_MOUNT_NOALIGN ) && - (mp->m_dalign || mp->m_swidth)) { +if (xfs_has_noalign (mp) && (mp->m_dalign || mp->m_swidth)) {xfs_warn (mp,"sunit and swidth options incompatible with the noalign option" );return -EINVAL ;@@ -1405,7 +1402,7 @@ xfs_fs_validate_params(return -EINVAL ; } -if ((mp->m_flags &XFS_MOUNT_ALLOCSIZE ) && +if (xfs_has_allocsize (mp) && (mp->m_allocsize_log >XFS_MAX_IO_LOG || mp->m_allocsize_log <XFS_MIN_IO_LOG )) { xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",@@ -1598,7 +1595,7 @@ xfs_fs_fill_super(if (XFS_SB_VERSION_NUM (&mp->m_sb) ==XFS_SB_VERSION_5 ) sb->s_flags |=SB_I_VERSION ; -if (mp->m_flags &XFS_MOUNT_DAX_ALWAYS ) { +if (xfs_has_dax_always (mp)) {bool rtdev_is_dax = false, datadev_is_dax; xfs_warn(mp,@@ -1622,13 +1619,13 @@ xfs_fs_fill_super( } } -if (mp->m_flags &XFS_MOUNT_DISCARD ) { +if (xfs_has_discard (mp)) {struct request_queue *q =bdev_get_queue (sb->s_bdev);if (!blk_queue_discard (q)) {xfs_warn (mp,"mounting with \"discard\" option, but " "the device does not support discard" ); - mp->m_flags &= ~XFS_MOUNT_DISCARD ; + mp->m_features &= ~XFS_FEAT_DISCARD ; } }@@ -1710,7 +1707,7 @@ xfs_remount_rw(struct xfs_sb *sbp = &mp->m_sb;int error; -if (mp->m_flags &XFS_MOUNT_NORECOVERY ) { +if (xfs_has_norecovery (mp)) {xfs_warn (mp,"ro->rw transition prohibited on norecovery mount" );return -EINVAL ;@@ -1851,16 +1848,14 @@ xfs_fs_reconfigure(sync_filesystem (mp->m_super);/* inode32 -> inode64 */ -if ((mp->m_flags &XFS_MOUNT_SMALL_INUMS ) && - !(new_mp->m_flags &XFS_MOUNT_SMALL_INUMS )) { - mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS ; +if (xfs_has_small_inums (mp) && !xfs_has_small_inums (new_mp)) { + mp->m_features &= ~XFS_FEAT_SMALL_INUMS ; mp->m_maxagi =xfs_set_inode_alloc (mp, sbp->sb_agcount); }/* inode64 -> inode32 */ -if (!(mp->m_flags &XFS_MOUNT_SMALL_INUMS ) && - (new_mp->m_flags &XFS_MOUNT_SMALL_INUMS )) { - mp->m_flags |=XFS_MOUNT_SMALL_INUMS ; +if (!xfs_has_small_inums (mp) &&xfs_has_small_inums (new_mp)) { + mp->m_features |=XFS_FEAT_SMALL_INUMS ; mp->m_maxagi =xfs_set_inode_alloc (mp, sbp->sb_agcount); }@@ -1941,9 +1936,9 @@ static int xfs_init_fs_context(if (fc->sb_flags &SB_RDONLY ) mp->m_flags |=XFS_MOUNT_RDONLY ;if (fc->sb_flags &SB_DIRSYNC ) - mp->m_flags |=XFS_MOUNT_DIRSYNC ; + mp->m_features |=XFS_FEAT_DIRSYNC ;if (fc->sb_flags &SB_SYNCHRONOUS ) - mp->m_flags |=XFS_MOUNT_WSYNC ; + mp->m_features |=XFS_FEAT_WSYNC ; fc->s_fs_info = mp; fc->ops = &xfs_context_ops;fs/xfs/xfs_symlink.c +1
-2@@ -321,9 +321,8 @@ xfs_symlink(* symlink transaction goes to disk before returning to * the user. */ -if (mp->m_flags & (XFS_MOUNT_WSYNC |XFS_MOUNT_DIRSYNC )) { +if (xfs_has_wsync (mp) ||xfs_has_dirsync (mp))xfs_trans_set_sync (tp); - } error =xfs_trans_commit (tp);if (error)Signature · 1 line
2.31.1
PATCH v3 8/16 xfs: convert remaining mount flags to state flags
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The remaining mount flags kept in m_flags are actually runtime state flags. These change dynamically, so they really should be updated atomically so we don't potentially lose an update due to racing modifications.
Convert these remaining flags to be stored in m_opstate and use atomic bitops to set and clear the flags. This also adds a couple of simple wrappers for common state checks - read only and shutdown.
--- fs/xfs/libxfs/xfs_alloc.c | 2 +- fs/xfs/libxfs/xfs_sb.c | 2 +- fs/xfs/scrub/common.c | 2 +- fs/xfs/scrub/scrub.c | 2 +- fs/xfs/xfs_buf.c | 2 +- fs/xfs/xfs_export.c | 4 ++-- fs/xfs/xfs_filestream.c | 2 +- fs/xfs/xfs_fsops.c | 7 +------ fs/xfs/xfs_icache.c | 2 +- fs/xfs/xfs_inode.c | 6 +++--- fs/xfs/xfs_ioctl.c | 6 +++--- fs/xfs/xfs_iops.c | 2 +- fs/xfs/xfs_log.c | 31 ++++++++++++++++------------- fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_mount.c | 15 +++++++------- fs/xfs/xfs_mount.h | 42 +++++++++++++++++++++------------------ fs/xfs/xfs_super.c | 32 ++++++++++++++--------------- fs/xfs/xfs_trace.h | 4 ++-- 18 files changed, 82 insertions(+), 83 deletions(-)
fs/xfs/libxfs/xfs_alloc.c +1 -1
@@ -3166,7 +3166,7 @@ xfs_alloc_vextent(* the first a.g. fails. */ if ((args->datatype &XFS_ALLOC_INITIAL_USER_DATA ) && - (mp->m_flags &XFS_MOUNT_32BITINODES )) { +xfs_is_inode32 (mp)) { args->fsbno =XFS_AGB_TO_FSB (mp, ((mp->m_agfrotor / rotorstep) % mp->m_sb.sb_agcount),0 );
fs/xfs/libxfs/xfs_sb.c +1 -1
@@ -122,7 +122,7 @@ xfs_validate_sb_read("Superblock has unknown read-only compatible features (0x%x) enabled." , (sbp->sb_features_ro_compat & XFS_SB_FEAT_RO_COMPAT_UNKNOWN)); -if (!(mp->m_flags &XFS_MOUNT_RDONLY )) { +if (!xfs_is_readonly (mp)) {xfs_warn (mp,"Attempted to mount read-only compatible filesystem read-write." ); xfs_warn(mp,
fs/xfs/scrub/common.c +1 -1
@@ -886,7 +886,7 @@ xchk_start_reaping(* Readonly filesystems do not perform inactivation or speculative * preallocation, so there's no need to restart the workers. */ -if (!(sc->mp->m_flags &XFS_MOUNT_RDONLY )) { +if (!xfs_is_readonly (sc->mp)) {xfs_inodegc_start (sc->mp);xfs_blockgc_start (sc->mp); }
fs/xfs/scrub/scrub.c +1 -1
@@ -419,7 +419,7 @@ xchk_validate_inputs( goto out; error = -EROFS ; -if (mp->m_flags &XFS_MOUNT_RDONLY ) +if (xfs_is_readonly (mp)) goto out; }
fs/xfs/xfs_buf.c +1 -1
@@ -1144,7 +1144,7 @@ xfs_buf_ioerror_permanent(return true;/* At unmount we may treat errors differently */ -if ((mp->m_flags &XFS_MOUNT_UNMOUNTING ) && mp->m_fail_unmount) +if (xfs_is_unmounting (mp) && mp->m_fail_unmount)return true;return false;
fs/xfs/xfs_export.c +2 -2
@@ -44,6 +44,7 @@ xfs_fs_encode_fh(int *max_len, struct inode *parent) { + struct xfs_mount *mp = XFS_M(inode->i_sb);struct fid *fid = (struct fid *)fh;struct xfs_fid64 *fid64 = (struct xfs_fid64 *)fh;int fileid_type;
@@ -63,8 +64,7 @@ xfs_fs_encode_fh(* large enough filesystem may contain them, thus the slightly * confusing looking conditional below. */ -if (!xfs_has_small_inums (XFS_M (inode->i_sb)) || - (XFS_M (inode->i_sb)->m_flags &XFS_MOUNT_32BITINODES )) +if (!xfs_has_small_inums (mp) ||xfs_is_inode32 (mp)) fileid_type |=XFS_FILEID_TYPE_64FLAG ;/*
fs/xfs/xfs_filestream.c +1 -1
@@ -295,7 +295,7 @@ xfs_filestream_lookup_ag(* Set the starting AG using the rotor for inode32, otherwise * use the directory inode's AG. */ -if (mp->m_flags &XFS_MOUNT_32BITINODES ) { +if (xfs_is_inode32 (mp)) {xfs_agnumber_t rotorstep = xfs_rotorstep; startag = (mp->m_agfrotor / rotorstep) % mp->m_sb.sb_agcount; mp->m_agfrotor = (mp->m_agfrotor + 1) %
fs/xfs/xfs_fsops.c +1 -6
@@ -527,15 +527,10 @@ xfs_do_force_shutdown(int tag;const char *why; -spin_lock (&mp->m_sb_lock); -if (XFS_FORCED_SHUTDOWN (mp)) { -spin_unlock (&mp->m_sb_lock); +if (test_and_set_bit (XFS_OPSTATE_SHUTDOWN , &mp->m_opstate))return ; - } - mp->m_flags |=XFS_MOUNT_FS_SHUTDOWN ;if (mp->m_sb_bp) mp->m_sb_bp->b_flags |=XBF_DONE ; -spin_unlock (&mp->m_sb_lock);if (flags &SHUTDOWN_FORCE_UMOUNT )xfs_alert (mp,"User initiated shutdown received." );
fs/xfs/xfs_icache.c +1 -1
@@ -976,7 +976,7 @@ static inline boolxfs_want_reclaim_sick ( struct xfs_mount *mp) { -return (mp->m_flags &XFS_MOUNT_UNMOUNTING ) ||xfs_has_norecovery (mp) || +return xfs_is_unmounting (mp) ||xfs_has_norecovery (mp) ||XFS_FORCED_SHUTDOWN (mp); }
fs/xfs/xfs_inode.c +3 -3
@@ -1434,7 +1434,7 @@ xfs_release(return 0 ;/* If this is a read-only mount, don't do this (would generate I/O) */ -if (mp->m_flags &XFS_MOUNT_RDONLY ) +if (xfs_is_readonly (mp))return 0 ;if (!XFS_FORCED_SHUTDOWN (mp)) {
@@ -1674,7 +1674,7 @@ xfs_inode_needs_inactive(return false;/* If this is a read-only mount, don't do this (would generate I/O) */ -if (mp->m_flags &XFS_MOUNT_RDONLY ) +if (xfs_is_readonly (mp))return false;/* If the log isn't running, push inodes straight to reclaim. */
@@ -1735,7 +1735,7 @@ xfs_inactive(ASSERT (!xfs_iflags_test (ip,XFS_IRECOVERY ));/* If this is a read-only mount, don't do this (would generate I/O) */ -if (mp->m_flags &XFS_MOUNT_RDONLY ) +if (xfs_is_readonly (mp)) goto out;/* Metadata inodes require explicit resource cleanup. */
fs/xfs/xfs_ioctl.c +3 -3
@@ -1262,7 +1262,7 @@ xfs_ioctl_setattr_get_trans(struct xfs_trans *tp;int error = -EROFS ; -if (mp->m_flags &XFS_MOUNT_RDONLY ) +if (xfs_is_readonly (mp)) goto out_error; error = -EIO ;if (XFS_FORCED_SHUTDOWN (mp))
@@ -2080,7 +2080,7 @@ xfs_file_ioctl(if (!capable (CAP_SYS_ADMIN ))return -EPERM ; -if (mp->m_flags &XFS_MOUNT_RDONLY ) +if (xfs_is_readonly (mp))return -EROFS ;if (copy_from_user (&inout, arg,sizeof (inout)))
@@ -2197,7 +2197,7 @@ xfs_file_ioctl(if (!capable (CAP_SYS_ADMIN ))return -EPERM ; -if (mp->m_flags &XFS_MOUNT_RDONLY ) +if (xfs_is_readonly (mp))return -EROFS ;if (copy_from_user (&eofb, arg,sizeof (eofb)))
fs/xfs/xfs_iops.c +1 -1
@@ -673,7 +673,7 @@ xfs_vn_change_ok( {struct xfs_mount *mp =XFS_I (d_inode (dentry))->i_mount; -if (mp->m_flags &XFS_MOUNT_RDONLY ) +if (xfs_is_readonly (mp))return -EROFS ;if (XFS_FORCED_SHUTDOWN (mp))
fs/xfs/xfs_log.c +17 -14
@@ -645,7 +645,7 @@ xfs_log_mount(xfs_notice (mp,"Mounting V%d filesystem in no-recovery mode. Filesystem will be inconsistent." ,XFS_SB_VERSION_NUM (&mp->m_sb)); -ASSERT (mp->m_flags &XFS_MOUNT_RDONLY ); +ASSERT (xfs_is_readonly (mp)); } log =xlog_alloc_log (mp, log_target, blk_offset, num_bblks);
@@ -725,15 +725,15 @@ xfs_log_mount(* just worked. */ if (!xfs_has_norecovery (mp)) { -bool readonly = (mp->m_flags &XFS_MOUNT_RDONLY ); - -if (readonly) - mp->m_flags &= ~XFS_MOUNT_RDONLY ; - +/* +* log recovery ignores readonly state and so we need to clear +* mount-based read only state so it can write to disk. +*/ +bool readonly =test_and_clear_bit (XFS_OPSTATE_READONLY , + &mp->m_opstate); error =xlog_recover (log); -if (readonly) - mp->m_flags |=XFS_MOUNT_RDONLY ; +set_bit (XFS_OPSTATE_READONLY , &mp->m_opstate);if (error) {xfs_warn (mp,"log mount/recovery failed: error %d" , error);
@@ -782,17 +782,20 @@ xfs_log_mount_finish( struct xfs_mount *mp) {struct xlog *log = mp->m_log; -bool readonly = (mp->m_flags &XFS_MOUNT_RDONLY ); +bool readonly;int error =0 ;if (xfs_has_norecovery (mp)) { -ASSERT (readonly); +ASSERT (xfs_is_readonly (mp));return 0 ; - }else if (readonly) { -/* Allow unlinked processing to proceed */ - mp->m_flags &= ~XFS_MOUNT_RDONLY ; } +/* +* log recovery ignores readonly state and so we need to clear +* mount-based read only state so it can write to disk. +*/ + readonly =test_and_clear_bit (XFS_OPSTATE_READONLY , &mp->m_opstate); +/* * During the second phase of log recovery, we need iget and * iput to behave like they do for an active filesystem.
@@ -844,7 +847,7 @@ xfs_log_mount_finish(clear_bit (XLOG_RECOVERY_NEEDED , &log->l_opstate);if (readonly) - mp->m_flags |=XFS_MOUNT_RDONLY ; +set_bit (XFS_OPSTATE_READONLY , &mp->m_opstate);/* Make sure the log is dead if we're returning failure. */ ASSERT (!error ||xlog_is_shutdown (log));
fs/xfs/xfs_log_recover.c +1 -1
@@ -1347,7 +1347,7 @@ xlog_find_tail(* headers if we have a filesystem using non-persistent counters. */ if (clean) - log->l_mp->m_flags |=XFS_MOUNT_WAS_CLEAN ; +set_bit (XFS_OPSTATE_CLEAN , &log->l_mp->m_opstate);/* * Make sure that there are no blocks in front of the head
fs/xfs/xfs_mount.c +7 -8
@@ -488,7 +488,7 @@ xfs_check_summary_counts(* counters. If any of them are obviously incorrect, we can recompute * them from the AGF headers in the next step. */ -if (XFS_LAST_UNMOUNT_WAS_CLEAN (mp) && +if (xfs_is_clean (mp) && (mp->m_sb.sb_fdblocks > mp->m_sb.sb_dblocks || !xfs_verify_icount (mp, mp->m_sb.sb_icount) || mp->m_sb.sb_ifree > mp->m_sb.sb_icount))
@@ -505,8 +505,7 @@ xfs_check_summary_counts(* superblock to be correct and we don't need to do anything here. * Otherwise, recalculate the summary counters. */ -if ((!xfs_has_lazysbcount (mp) || -XFS_LAST_UNMOUNT_WAS_CLEAN (mp)) && +if ((!xfs_has_lazysbcount (mp) ||xfs_is_clean (mp)) && !xfs_fs_has_sickness (mp,XFS_SICK_FS_COUNTERS ))return 0 ;
@@ -547,7 +546,7 @@ xfs_unmount_flush_inodes(xfs_extent_busy_wait_all (mp);flush_workqueue (xfs_discard_wq); - mp->m_flags |=XFS_MOUNT_UNMOUNTING ; +set_bit (XFS_OPSTATE_UNMOUNTING , &mp->m_opstate);xfs_ail_push_all_sync (mp->m_ail);xfs_inodegc_stop (mp);
@@ -835,7 +834,7 @@ xfs_mountfs(* the next remount into writeable mode. Otherwise we would never * perform the update e.g. for the root filesystem. */ -if (mp->m_update_sb && !(mp->m_flags &XFS_MOUNT_RDONLY )) { +if (mp->m_update_sb && !xfs_is_readonly (mp)) { error =xfs_sync_sb (mp, false);if (error) {xfs_warn (mp,"failed to write sb changes" );
@@ -892,7 +891,7 @@ xfs_mountfs(* We use the same quiesce mechanism as the rw->ro remount, as they are * semantically identical operations. */ -if ((mp->m_flags &XFS_MOUNT_RDONLY ) && !xfs_has_norecovery (mp)) +if (xfs_is_readonly (mp) && !xfs_has_norecovery (mp))xfs_log_clean (mp);/*
@@ -916,7 +915,7 @@ xfs_mountfs(* This may drive us straight to ENOSPC on mount, but that implies * we were already there on the last unmount. Warn if this occurs. */ -if (!(mp->m_flags &XFS_MOUNT_RDONLY )) { +if (!xfs_is_readonly (mp)) { resblks =xfs_default_resblks (mp); error =xfs_reserve_blocks (mp, &resblks,NULL );if (error)
@@ -1077,7 +1076,7 @@ xfs_fs_writable( {ASSERT (level >SB_UNFROZEN );if ((mp->m_super->s_writers.frozen >= level) || -XFS_FORCED_SHUTDOWN (mp) || (mp->m_flags &XFS_MOUNT_RDONLY )) +XFS_FORCED_SHUTDOWN (mp) ||xfs_is_readonly (mp))return false;return true;
fs/xfs/xfs_mount.h +23 -19
88 lines not on this page · raw message
fs/xfs/xfs_super.c +15 -17
@@ -250,7 +250,7 @@ xfs_fs_show_options(* * Inode allocation patterns are altered only if inode32 is requested * (XFS_FEAT_SMALL_INUMS), and the filesystem is sufficiently large. -* If altered, XFS_MOUNT_32BITINODES is set as well. +* If altered, XFS_OPSTATE_INODE32 is set as well. * * An agcount independent of that in the mount structure is provided * because in the growfs case, mp->m_sb.sb_agcount is not yet updated
@@ -292,13 +292,13 @@ xfs_set_inode_alloc(/* * If user asked for no more than 32-bit inodes, and the fs is -* sufficiently large, set XFS_MOUNT_32BITINODES if we must alter +* sufficiently large, set XFS_OPSTATE_INODE32 if we must alter * the allocator to accommodate the request. */ if (xfs_has_small_inums (mp) && ino >XFS_MAXINUMBER_32 ) - mp->m_flags |=XFS_MOUNT_32BITINODES ; +set_bit (XFS_OPSTATE_INODE32 , &mp->m_opstate);else - mp->m_flags &= ~XFS_MOUNT_32BITINODES ; +clear_bit (XFS_OPSTATE_INODE32 , &mp->m_opstate);for (index =0 ; index < agcount; index++) {struct xfs_perag *pag;
@@ -307,7 +307,7 @@ xfs_set_inode_alloc( pag =xfs_perag_get (mp, index); -if (mp->m_flags &XFS_MOUNT_32BITINODES ) { +if (xfs_is_inode32 (mp)) {if (ino >XFS_MAXINUMBER_32 ) { pag->pagi_inodeok =0 ; pag->pagf_metadata =0 ;
@@ -327,7 +327,7 @@ xfs_set_inode_alloc(xfs_perag_put (pag); } -return (mp->m_flags &XFS_MOUNT_32BITINODES ) ? maxagi : agcount; +return xfs_is_inode32 (mp) ? maxagi : agcount; }STATIC int
@@ -896,7 +896,7 @@ xfs_fs_freeze(* here, so we can restart safely without racing with a stop in * xfs_fs_sync_fs(). */ -if (ret && !(mp->m_flags &XFS_MOUNT_RDONLY )) { +if (ret && !xfs_is_readonly (mp)) {xfs_blockgc_start (mp);xfs_inodegc_start (mp); }
@@ -919,7 +919,7 @@ xfs_fs_unfreeze(* worker because there are no speculative preallocations on a readonly * filesystem. */ -if (!(mp->m_flags &XFS_MOUNT_RDONLY )) { +if (!xfs_is_readonly (mp)) {xfs_blockgc_start (mp);xfs_inodegc_start (mp); }
@@ -935,8 +935,6 @@ STATIC intxfs_finish_flags ( struct xfs_mount *mp) { -int ronly = (mp->m_flags &XFS_MOUNT_RDONLY ); -/* Fail a mount where the logbuf is smaller than the log stripe */ if (xfs_has_logv2 (mp)) { if (mp->m_logbsize <= 0 &&
@@ -969,7 +967,7 @@ xfs_finish_flags(/* * prohibit r/w mounts of read-only filesystems */ -if ((mp->m_sb.sb_flags &XFS_SBF_READONLY ) && !ronly) { +if ((mp->m_sb.sb_flags &XFS_SBF_READONLY ) && !xfs_is_readonly (mp)) {xfs_warn (mp,"cannot mount a read-only filesystem as read-write" );return -EROFS ;
@@ -1343,7 +1341,7 @@ xfs_fs_validate_params( struct xfs_mount *mp) {/* No recovery flag requires a read-only mount */ -if (xfs_has_norecovery (mp) && !(mp->m_flags &XFS_MOUNT_RDONLY )) { +if (xfs_has_norecovery (mp) && !xfs_is_readonly (mp)) {xfs_warn (mp,"no-recovery mounts must be read-only." );return -EINVAL ; }
@@ -1722,7 +1720,7 @@ xfs_remount_rw(return -EINVAL ; } - mp->m_flags &= ~XFS_MOUNT_RDONLY ; +clear_bit (XFS_OPSTATE_READONLY , &mp->m_opstate);/* * If this is the first remount to writeable state we might have some
@@ -1810,7 +1808,7 @@ xfs_remount_ro(xfs_save_resvblks (mp);xfs_log_clean (mp); - mp->m_flags |=XFS_MOUNT_RDONLY ; +set_bit (XFS_OPSTATE_READONLY , &mp->m_opstate);return 0 ; }
@@ -1860,14 +1858,14 @@ xfs_fs_reconfigure( }/* ro -> rw */ -if ((mp->m_flags &XFS_MOUNT_RDONLY ) && !(flags &SB_RDONLY )) { +if (xfs_is_readonly (mp) && !(flags &SB_RDONLY )) { error =xfs_remount_rw (mp);if (error)return error; }/* rw -> ro */ -if (!(mp->m_flags &XFS_MOUNT_RDONLY ) && (flags &SB_RDONLY )) { +if (!xfs_is_readonly (mp) && (flags &SB_RDONLY )) { error =xfs_remount_ro (mp);if (error)return error;
@@ -1934,7 +1932,7 @@ static int xfs_init_fs_context(* Copy binary VFS mount flags we are interested in. */ if (fc->sb_flags &SB_RDONLY ) - mp->m_flags |=XFS_MOUNT_RDONLY ; +set_bit (XFS_OPSTATE_READONLY , &mp->m_opstate);if (fc->sb_flags &SB_DIRSYNC ) mp->m_features |=XFS_FEAT_DIRSYNC ;if (fc->sb_flags &SB_SYNCHRONOUS )
fs/xfs/xfs_trace.h +2 -2
@@ -186,13 +186,13 @@ DECLARE_EVENT_CLASS(xfs_fs_class, TP_fast_assign( if (mp) { __entry->dev = mp->m_super->s_dev; - __entry->mflags = mp->m_flags; + __entry->mflags = mp->m_features; __entry->opstate = mp->m_opstate; __entry->sbflags = mp->m_super->s_flags; } __entry->caller_ip = caller_ip; ), - TP_printk("dev %d:%d m_flags 0x%llx opstate (%s) s_flags 0x%lx caller %pS", + TP_printk("dev %d:%d m_features 0x%llx opstate (%s) s_flags 0x%lx caller %pS", MAJOR(__entry->dev), MINOR(__entry->dev), __entry->mflags, __print_flags(__entry->opstate, "|", XFS_OPSTATE_STRINGS),
Signature · 1 line
2.31.1
PATCH v3 9/16 xfs: replace XFS_FORCED_SHUTDOWN with xfs_is_shutdown
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Remove the shouty macro and instead use the inline function that matches other state/feature check wrapper naming. This conversion was done with sed.
--- fs/xfs/libxfs/xfs_alloc.c | 2 +- fs/xfs/libxfs/xfs_attr.c | 4 ++-- fs/xfs/libxfs/xfs_bmap.c | 16 ++++++++-------- fs/xfs/libxfs/xfs_btree.c | 2 +- fs/xfs/libxfs/xfs_ialloc.c | 6 +++--- fs/xfs/scrub/scrub.c | 2 +- fs/xfs/xfs_aops.c | 8 ++++---- fs/xfs/xfs_attr_list.c | 2 +- fs/xfs/xfs_bmap_util.c | 4 ++-- fs/xfs/xfs_buf.c | 8 ++++---- fs/xfs/xfs_buf_item.c | 2 +- fs/xfs/xfs_dir2_readdir.c | 2 +- fs/xfs/xfs_file.c | 14 +++++++------- fs/xfs/xfs_health.c | 2 +- fs/xfs/xfs_icache.c | 8 ++++---- fs/xfs/xfs_inode.c | 24 ++++++++++++------------ fs/xfs/xfs_ioctl.c | 10 +++++----- fs/xfs/xfs_ioctl32.c | 2 +- fs/xfs/xfs_iomap.c | 12 ++++++------ fs/xfs/xfs_iops.c | 4 ++-- fs/xfs/xfs_mount.c | 6 +++--- fs/xfs/xfs_mount.h | 2 +- fs/xfs/xfs_pnfs.c | 2 +- fs/xfs/xfs_qm.c | 4 ++-- fs/xfs/xfs_super.c | 2 +- fs/xfs/xfs_symlink.c | 8 ++++---- fs/xfs/xfs_trans.c | 8 ++++---- fs/xfs/xfs_trans_ail.c | 8 ++++---- fs/xfs/xfs_trans_buf.c | 6 +++--- 29 files changed, 90 insertions(+), 90 deletions(-)
fs/xfs/libxfs/xfs_alloc.c +1 -1
@@ -3079,7 +3079,7 @@ xfs_alloc_read_agf(atomic64_add (allocbt_blks, &mp->m_allocbt_blks); }#ifdef DEBUG - else if (!XFS_FORCED_SHUTDOWN(mp)) { + else if (!xfs_is_shutdown(mp)) {ASSERT (pag->pagf_freeblks ==be32_to_cpu (agf->agf_freeblks));ASSERT (pag->pagf_btreeblks ==be32_to_cpu (agf->agf_btreeblks));ASSERT (pag->pagf_flcount ==be32_to_cpu (agf->agf_flcount));
fs/xfs/libxfs/xfs_attr.c +2 -2
@@ -146,7 +146,7 @@ xfs_attr_get(XFS_STATS_INC (args->dp->i_mount, xs_attr_get); -if (XFS_FORCED_SHUTDOWN (args->dp->i_mount)) +if (xfs_is_shutdown (args->dp->i_mount))return -EIO ; args->geo = args->dp->i_mount->m_attr_geo;
@@ -710,7 +710,7 @@ xfs_attr_set(int rmt_blks =0 ;unsigned int total; -if (XFS_FORCED_SHUTDOWN (dp->i_mount)) +if (xfs_is_shutdown (dp->i_mount))return -EIO ; error =xfs_qm_dqattach (dp);
fs/xfs/libxfs/xfs_bmap.c +8 -8
@@ -3938,7 +3938,7 @@ xfs_bmapi_read( XFS_TEST_ERROR(false, mp, XFS_ERRTAG_BMAPIFORMAT))return -EFSCORRUPTED ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;XFS_STATS_INC (mp, xs_blk_mapr);
@@ -4420,7 +4420,7 @@ xfs_bmapi_write(return -EFSCORRUPTED ; } -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;XFS_STATS_INC (mp, xs_blk_mapw);
@@ -4703,7 +4703,7 @@ xfs_bmapi_remap(return -EFSCORRUPTED ; } -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ; error =xfs_iread_extents (tp, ip, whichfork);
@@ -5361,7 +5361,7 @@ __xfs_bunmapi( ifp =XFS_IFORK_PTR (ip, whichfork);if (XFS_IS_CORRUPT (mp, !xfs_ifork_has_extents (ifp)))return -EFSCORRUPTED ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;ASSERT (xfs_isilocked (ip,XFS_ILOCK_EXCL ));
@@ -5852,7 +5852,7 @@ xfs_bmap_collapse_extents(return -EFSCORRUPTED ; } -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;ASSERT (xfs_isilocked (ip,XFS_IOLOCK_EXCL |XFS_ILOCK_EXCL ));
@@ -5930,7 +5930,7 @@ xfs_bmap_can_insert_extents(ASSERT (xfs_isilocked (ip,XFS_IOLOCK_EXCL )); -if (XFS_FORCED_SHUTDOWN (ip->i_mount)) +if (xfs_is_shutdown (ip->i_mount))return -EIO ;xfs_ilock (ip,XFS_ILOCK_EXCL );
@@ -5967,7 +5967,7 @@ xfs_bmap_insert_extents(return -EFSCORRUPTED ; } -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;ASSERT (xfs_isilocked (ip,XFS_IOLOCK_EXCL |XFS_ILOCK_EXCL ));
@@ -6070,7 +6070,7 @@ xfs_bmap_split_extent(return -EFSCORRUPTED ; } -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;/* Read in all the extents */
fs/xfs/libxfs/xfs_btree.c +1 -1
@@ -374,7 +374,7 @@ xfs_btree_del_cursor( }ASSERT (cur->bc_btnum !=XFS_BTNUM_BMAP || cur->bc_ino.allocated ==0 || -XFS_FORCED_SHUTDOWN (cur->bc_mp)); +xfs_is_shutdown (cur->bc_mp));if (unlikely (cur->bc_flags &XFS_BTREE_STAGING ))kmem_free (cur->bc_ops);if (!(cur->bc_flags &XFS_BTREE_LONG_PTRS ) && cur->bc_ag.pag)
fs/xfs/libxfs/xfs_ialloc.c +3 -3
@@ -241,7 +241,7 @@ xfs_check_agi_freecount( } }while (i ==1 ); -if (!XFS_FORCED_SHUTDOWN (cur->bc_mp)) +if (!xfs_is_shutdown (cur->bc_mp))ASSERT (freecount == cur->bc_ag.pag->pagi_freecount); }return 0 ;
@@ -1784,7 +1784,7 @@ xfs_dialloc(break ; } -if (XFS_FORCED_SHUTDOWN (mp)) { +if (xfs_is_shutdown (mp)) { error = -EFSCORRUPTED ;break ; }
@@ -2624,7 +2624,7 @@ xfs_ialloc_read_agi(* we are in the middle of a forced shutdown. */ ASSERT (pag->pagi_freecount ==be32_to_cpu (agi->agi_freecount) || -XFS_FORCED_SHUTDOWN (mp)); +xfs_is_shutdown (mp));return 0 ; }
fs/xfs/scrub/scrub.c +1 -1
@@ -480,7 +480,7 @@ xfs_scrub_metadata(/* Forbidden if we are shut down or mounted norecovery. */ error = -ESHUTDOWN ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp)) goto out; error = -ENOTRECOVERABLE ;if (xfs_has_norecovery (mp))
fs/xfs/xfs_aops.c +4 -4
@@ -97,7 +97,7 @@ xfs_end_ioend(/* * Just clean up the in-memory structures if the fs has been shut down. */ -if (XFS_FORCED_SHUTDOWN (ip->i_mount)) { +if (xfs_is_shutdown (ip->i_mount)) { error = -EIO ; goto done; }
@@ -260,7 +260,7 @@ xfs_map_blocks(int retries =0 ;int error =0 ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;/*
@@ -440,7 +440,7 @@ xfs_discard_page(xfs_fileoff_t pageoff_fsb =XFS_B_TO_FSBT (mp, pageoff);int error; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp)) goto out_invalidate; xfs_alert_ratelimited(mp,
@@ -449,7 +449,7 @@ xfs_discard_page( error =xfs_bmap_punch_delalloc_range (ip, start_fsb,i_blocks_per_page (inode, page) - pageoff_fsb); -if (error && !XFS_FORCED_SHUTDOWN (mp)) +if (error && !xfs_is_shutdown (mp))xfs_alert (mp,"page discard unable to remove delalloc mapping." ); out_invalidate:iomap_invalidatepage (page, pageoff,PAGE_SIZE - pageoff);
fs/xfs/xfs_attr_list.c +1 -1
@@ -529,7 +529,7 @@ xfs_attr_list(XFS_STATS_INC (dp->i_mount, xs_attr_list); -if (XFS_FORCED_SHUTDOWN (dp->i_mount)) +if (xfs_is_shutdown (dp->i_mount))return -EIO ; lock_mode =xfs_ilock_attr_map_shared (dp);
fs/xfs/xfs_bmap_util.c +2 -2
@@ -731,7 +731,7 @@ xfs_free_eofblocks( error =xfs_trans_alloc (mp, &M_RES (mp)->tr_itruncate,0 ,0 ,0 , &tp);if (error) { -ASSERT (XFS_FORCED_SHUTDOWN (mp)); +ASSERT (xfs_is_shutdown (mp));return error; }
@@ -789,7 +789,7 @@ xfs_alloc_file_space(trace_xfs_alloc_file_space (ip); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ; error =xfs_qm_dqattach (ip);
fs/xfs/xfs_buf.c +4 -4
@@ -813,7 +813,7 @@ xfs_buf_read_map(* buffer. */ if (error) { -if (!XFS_FORCED_SHUTDOWN (target->bt_mount)) +if (!xfs_is_shutdown (target->bt_mount))xfs_buf_ioerror_alert (bp, fa); bp->b_flags &= ~XBF_DONE ;
@@ -1178,7 +1178,7 @@ xfs_buf_ioend_handle_error(* If we've already decided to shutdown the filesystem because of I/O * errors, there's no point in giving this a retry. */ -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp)) goto out_stale;xfs_buf_ioerror_alert_ratelimited (bp);
@@ -1591,7 +1591,7 @@ __xfs_buf_submit(ASSERT (!(bp->b_flags & _XBF_DELWRI_Q));/* on shutdown we stale and complete the buffer immediately */ -if (XFS_FORCED_SHUTDOWN (bp->b_mount)) { +if (xfs_is_shutdown (bp->b_mount)) {xfs_buf_ioend_fail (bp);return -EIO ; }
@@ -1808,7 +1808,7 @@ xfs_buftarg_drain(* down the fs. */ if (write_fail) { -ASSERT (XFS_FORCED_SHUTDOWN (btp->bt_mount)); +ASSERT (xfs_is_shutdown (btp->bt_mount));xfs_alert (btp->bt_mount,"Please run xfs_repair to determine the extent of the problem." ); }
fs/xfs/xfs_buf_item.c +1 -1
@@ -616,7 +616,7 @@ xfs_buf_item_put(* that case, the bli is freed on buffer writeback completion. */ aborted =test_bit (XFS_LI_ABORTED , &lip->li_flags) || -XFS_FORCED_SHUTDOWN (lip->li_mountp); +xfs_is_shutdown (lip->li_mountp); dirty = bip->bli_flags &XFS_BLI_DIRTY ;if (dirty && !aborted)return false;
fs/xfs/xfs_dir2_readdir.c +1 -1
@@ -512,7 +512,7 @@ xfs_readdir(trace_xfs_readdir (dp); -if (XFS_FORCED_SHUTDOWN (dp->i_mount)) +if (xfs_is_shutdown (dp->i_mount))return -EIO ;ASSERT (S_ISDIR (VFS_I (dp)->i_mode));
fs/xfs/xfs_file.c +7 -7
@@ -185,7 +185,7 @@ xfs_file_fsync(if (error)return error; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;xfs_iflags_clear (ip,XFS_ITRUNCATED );
@@ -318,7 +318,7 @@ xfs_file_read_iter(XFS_STATS_INC (mp, xs_read_calls); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;if (IS_DAX (inode))
@@ -462,7 +462,7 @@ xfs_dio_write_end_io(trace_xfs_end_io_direct_write (ip, offset, size); -if (XFS_FORCED_SHUTDOWN (ip->i_mount)) +if (xfs_is_shutdown (ip->i_mount))return -EIO ;if (error)
@@ -814,7 +814,7 @@ xfs_file_write_iter(if (ocount ==0 )return 0 ; -if (XFS_FORCED_SHUTDOWN (ip->i_mount)) +if (xfs_is_shutdown (ip->i_mount))return -EIO ;if (IS_DAX (inode))
@@ -1156,7 +1156,7 @@ xfs_file_remap_range(if (!xfs_has_reflink (mp))return -EOPNOTSUPP ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;/* Prepare and then clone file data. */
@@ -1205,7 +1205,7 @@ xfs_file_open( {if (!(file->f_flags &O_LARGEFILE ) &&i_size_read (inode) >MAX_NON_LFS )return -EFBIG ; -if (XFS_FORCED_SHUTDOWN (XFS_M (inode->i_sb))) +if (xfs_is_shutdown (XFS_M (inode->i_sb)))return -EIO ; file->f_mode |=FMODE_NOWAIT |FMODE_BUF_RASYNC ;return 0 ;
@@ -1277,7 +1277,7 @@ xfs_file_llseek( {struct inode *inode = file->f_mapping->host; -if (XFS_FORCED_SHUTDOWN (XFS_I (inode)->i_mount)) +if (xfs_is_shutdown (XFS_I (inode)->i_mount))return -EIO ;switch (whence) {
fs/xfs/xfs_health.c +1 -1
@@ -30,7 +30,7 @@ xfs_health_unmount(unsigned int checked =0 ;bool warn = false; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return ;/* Measure AG corruption levels. */
fs/xfs/xfs_icache.c +4 -4
@@ -899,7 +899,7 @@ xfs_reclaim_inode(if (xfs_iflags_test_and_set (ip,XFS_IFLUSHING )) goto out_iunlock; -if (XFS_FORCED_SHUTDOWN (ip->i_mount)) { +if (xfs_is_shutdown (ip->i_mount)) {xfs_iunpin_wait (ip);xfs_iflush_abort (ip); goto reclaim;
@@ -977,7 +977,7 @@ xfs_want_reclaim_sick( struct xfs_mount *mp) {return xfs_is_unmounting (mp) ||xfs_has_norecovery (mp) || -XFS_FORCED_SHUTDOWN (mp); +xfs_is_shutdown (mp); }void
@@ -1423,7 +1423,7 @@ xfs_blockgc_igrab(spin_unlock (&ip->i_flags_lock);/* nothing to sync during shutdown */ -if (XFS_FORCED_SHUTDOWN (ip->i_mount)) +if (xfs_is_shutdown (ip->i_mount))return false;/* If we can't grab the inode, it must on it's way to reclaim. */
@@ -1842,7 +1842,7 @@ xfs_inodegc_set_reclaimable(struct xfs_mount *mp = ip->i_mount;struct xfs_perag *pag; -if (!XFS_FORCED_SHUTDOWN (mp) && ip->i_delayed_blks) { +if (!xfs_is_shutdown (mp) && ip->i_delayed_blks) {xfs_check_delalloc (ip,XFS_DATA_FORK );xfs_check_delalloc (ip,XFS_COW_FORK );ASSERT (0 );
fs/xfs/xfs_inode.c +12 -12
@@ -663,7 +663,7 @@ xfs_lookup(trace_xfs_lookup (dp, name); -if (XFS_FORCED_SHUTDOWN (dp->i_mount)) +if (xfs_is_shutdown (dp->i_mount))return -EIO ; error =xfs_dir_lookup (NULL , dp, name, &inum, ci_name);
@@ -975,7 +975,7 @@ xfs_create(trace_xfs_create (dp, name); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ; prid =xfs_get_initial_prid (dp);
@@ -1129,7 +1129,7 @@ xfs_create_tmpfile(uint resblks;xfs_ino_t ino; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ; prid =xfs_get_initial_prid (dp);
@@ -1219,7 +1219,7 @@ xfs_link(ASSERT (!S_ISDIR (VFS_I (sip)->i_mode)); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ; error =xfs_qm_dqattach (sip);
@@ -1437,7 +1437,7 @@ xfs_release(if (xfs_is_readonly (mp))return 0 ; -if (!XFS_FORCED_SHUTDOWN (mp)) { +if (!xfs_is_shutdown (mp)) {int truncated;/*
@@ -1520,7 +1520,7 @@ xfs_inactive_truncate( error =xfs_trans_alloc (mp, &M_RES (mp)->tr_itruncate,0 ,0 ,0 , &tp);if (error) { -ASSERT (XFS_FORCED_SHUTDOWN (mp)); +ASSERT (xfs_is_shutdown (mp));return error; }xfs_ilock (ip,XFS_ILOCK_EXCL );
@@ -1591,7 +1591,7 @@ xfs_inactive_ifree("Failed to remove inode(s) from unlinked list. " "Please free space, unmount and run xfs_repair."); }else { -ASSERT (XFS_FORCED_SHUTDOWN (mp)); +ASSERT (xfs_is_shutdown (mp)); }return error; }
@@ -1627,7 +1627,7 @@ xfs_inactive_ifree(* might do that, we need to make sure. Otherwise the * inode might be lost for a long time or forever. */ -if (!XFS_FORCED_SHUTDOWN (mp)) { +if (!xfs_is_shutdown (mp)) {xfs_notice (mp,"%s: xfs_ifree returned error %d" , __func__, error);xfs_force_shutdown (mp,SHUTDOWN_META_IO_ERROR );
@@ -1678,7 +1678,7 @@ xfs_inode_needs_inactive(return false;/* If the log isn't running, push inodes straight to reclaim. */ -if (XFS_FORCED_SHUTDOWN (mp) ||xfs_has_norecovery (mp)) +if (xfs_is_shutdown (mp) ||xfs_has_norecovery (mp))return false;/* Metadata inodes require explicit resource cleanup. */
@@ -2010,7 +2010,7 @@ xfs_iunlink_destroy(rhashtable_free_and_destroy (&pag->pagi_unlinked_hash, xfs_iunlink_free_item, &freed_anything); -ASSERT (freed_anything == false ||XFS_FORCED_SHUTDOWN (pag->pag_mount)); +ASSERT (freed_anything == false ||xfs_is_shutdown (pag->pag_mount)); }/*
@@ -2755,7 +2755,7 @@ xfs_remove(trace_xfs_remove (dp, name); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ; error =xfs_qm_dqattach (dp);
@@ -3655,7 +3655,7 @@ xfs_iflush_cluster(* AIL, leaving a dirty/unpinned inode attached to the buffer * that otherwise looks like it should be flushed. */ -if (XFS_FORCED_SHUTDOWN (mp)) { +if (xfs_is_shutdown (mp)) {xfs_iunpin_wait (ip);xfs_iflush_abort (ip);xfs_iunlock (ip,XFS_ILOCK_SHARED );
fs/xfs/xfs_ioctl.c +5 -5
@@ -756,7 +756,7 @@ xfs_ioc_fsbulkstat(if (!capable (CAP_SYS_ADMIN ))return -EPERM ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;if (copy_from_user (&bulkreq, arg,sizeof (struct xfs_fsop_bulkreq )))
@@ -927,7 +927,7 @@ xfs_ioc_bulkstat(if (!capable (CAP_SYS_ADMIN ))return -EPERM ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;if (copy_from_user (&hdr, &arg->hdr,sizeof (hdr)))
@@ -977,7 +977,7 @@ xfs_ioc_inumbers(if (!capable (CAP_SYS_ADMIN ))return -EPERM ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;if (copy_from_user (&hdr, &arg->hdr,sizeof (hdr)))
@@ -1265,7 +1265,7 @@ xfs_ioctl_setattr_get_trans(if (xfs_is_readonly (mp)) goto out_error; error = -EIO ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp)) goto out_error; error = xfs_trans_alloc_ichange(ip, NULL, NULL, pdqp,
@@ -1791,7 +1791,7 @@ xfs_ioc_swapext( goto out_put_tmp_file; } -if (XFS_FORCED_SHUTDOWN (ip->i_mount)) { +if (xfs_is_shutdown (ip->i_mount)) { error = -EIO ; goto out_put_tmp_file; }
fs/xfs/xfs_ioctl32.c +1 -1
@@ -254,7 +254,7 @@ xfs_compat_ioc_fsbulkstat(if (!capable (CAP_SYS_ADMIN ))return -EPERM ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;if (get_user (addr, &p32->lastip))
fs/xfs/xfs_iomap.c +6 -6
@@ -734,7 +734,7 @@ xfs_direct_write_iomap_begin(ASSERT (flags & (IOMAP_WRITE |IOMAP_ZERO )); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;/*
@@ -874,7 +874,7 @@ xfs_buffered_write_iomap_begin(int allocfork =XFS_DATA_FORK ;int error =0 ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;/* we can't use delayed allocations when using extent size hints */
@@ -1127,7 +1127,7 @@ xfs_buffered_write_iomap_end( error =xfs_bmap_punch_delalloc_range (ip, start_fsb, end_fsb - start_fsb); -if (error && !XFS_FORCED_SHUTDOWN (mp)) { +if (error && !xfs_is_shutdown (mp)) {xfs_alert (mp,"%s: unable to clean up ino %lld" , __func__, ip->i_ino);return error;
@@ -1162,7 +1162,7 @@ xfs_read_iomap_begin(ASSERT (!(flags & (IOMAP_WRITE |IOMAP_ZERO ))); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ; error =xfs_ilock_for_iomap (ip, flags, &lockmode);
@@ -1203,7 +1203,7 @@ xfs_seek_iomap_begin(int error =0 ;unsigned lockmode; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ; lockmode =xfs_ilock_data_map_shared (ip);
@@ -1285,7 +1285,7 @@ xfs_xattr_iomap_begin(int nimaps =1 , error =0 ;unsigned lockmode; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ; lockmode =xfs_ilock_attr_map_shared (ip);
fs/xfs/xfs_iops.c +2 -2
@@ -582,7 +582,7 @@ xfs_vn_getattr(trace_xfs_getattr (ip); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ; stat->size =XFS_ISIZE (ip);
@@ -676,7 +676,7 @@ xfs_vn_change_ok(if (xfs_is_readonly (mp))return -EROFS ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;return setattr_prepare (mnt_userns, dentry, iattr);
fs/xfs/xfs_mount.c +3 -3
@@ -1076,7 +1076,7 @@ xfs_fs_writable( {ASSERT (level >SB_UNFROZEN );if ((mp->m_super->s_writers.frozen >= level) || -XFS_FORCED_SHUTDOWN (mp) ||xfs_is_readonly (mp)) +xfs_is_shutdown (mp) ||xfs_is_readonly (mp))return false;return true;
@@ -1268,7 +1268,7 @@ xfs_add_incompat_log_feature(xfs_buf_lock (mp->m_sb_bp);xfs_buf_hold (mp->m_sb_bp); -if (XFS_FORCED_SHUTDOWN (mp)) { +if (xfs_is_shutdown (mp)) { error = -EIO ; goto rele; }
@@ -1323,7 +1323,7 @@ xfs_clear_incompat_log_features(if (!xfs_sb_version_hascrc (&mp->m_sb) || !xfs_sb_has_incompat_log_feature (&mp->m_sb,XFS_SB_FEAT_INCOMPAT_LOG_ALL ) || -XFS_FORCED_SHUTDOWN (mp)) +xfs_is_shutdown (mp))return false;/*
fs/xfs/xfs_mount.h +1 -1
@@ -425,7 +425,7 @@ __XFS_IS_OPSTATE(blockgc_enabled, BLOCKGC_ENABLED)#define XFS_MAX_IO_LOG 30/* 1G */ #define XFS_MIN_IO_LOG PAGE_SHIFT -#define XFS_FORCED_SHUTDOWN (mp) xfs_is_shutdown(mp) +#define xfs_is_shutdown (mp) xfs_is_shutdown(mp)void xfs_do_force_shutdown (struct xfs_mount *mp,int flags,char *fname,int lnnum);#define xfs_force_shutdown (m,f) \
fs/xfs/xfs_pnfs.c +1 -1
@@ -92,7 +92,7 @@ xfs_fs_map_blocks(uint lock_flags;int error =0 ; -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;/*
fs/xfs/xfs_qm.c +2 -2
@@ -157,7 +157,7 @@ xfs_qm_dqpurge( }ASSERT (atomic_read (&dqp->q_pincount) ==0 ); -ASSERT (XFS_FORCED_SHUTDOWN (mp) || +ASSERT (xfs_is_shutdown (mp) || !test_bit (XFS_LI_IN_AIL , &dqp->q_logitem.qli_item.li_flags));xfs_dqfunlock (dqp);
@@ -823,7 +823,7 @@ xfs_qm_qino_alloc( error =xfs_trans_commit (tp);if (error) { -ASSERT (XFS_FORCED_SHUTDOWN (mp)); +ASSERT (xfs_is_shutdown (mp));xfs_alert (mp,"%s failed (error %d)!" , __func__, error); }if (need_alloc)
fs/xfs/xfs_super.c +1 -1
@@ -1033,7 +1033,7 @@ xfs_destroy_percpu_counters(percpu_counter_destroy (&mp->m_icount);percpu_counter_destroy (&mp->m_ifree);percpu_counter_destroy (&mp->m_fdblocks); -ASSERT (XFS_FORCED_SHUTDOWN (mp) || +ASSERT (xfs_is_shutdown (mp) ||percpu_counter_sum (&mp->m_delalloc_blks) ==0 );percpu_counter_destroy (&mp->m_delalloc_blks); }
fs/xfs/xfs_symlink.c +4 -4
@@ -107,7 +107,7 @@ xfs_readlink(ASSERT (ip->i_df.if_format !=XFS_DINODE_FMT_LOCAL ); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;xfs_ilock (ip,XFS_ILOCK_SHARED );
@@ -168,7 +168,7 @@ xfs_symlink(trace_xfs_symlink (dp, link_name); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;/*
@@ -444,7 +444,7 @@ xfs_inactive_symlink_rmt(xfs_trans_log_inode (tp, ip,XFS_ILOG_CORE ); error =xfs_trans_commit (tp);if (error) { -ASSERT (XFS_FORCED_SHUTDOWN (mp)); +ASSERT (xfs_is_shutdown (mp)); goto error_unlock; }
@@ -477,7 +477,7 @@ xfs_inactive_symlink(trace_xfs_inactive_symlink (ip); -if (XFS_FORCED_SHUTDOWN (mp)) +if (xfs_is_shutdown (mp))return -EIO ;xfs_ilock (ip,XFS_ILOCK_EXCL );
fs/xfs/xfs_trans.c +4 -4
@@ -775,7 +775,7 @@ xfs_trans_committed_bulk(* object into the AIL as we are in a shutdown situation. */ if (aborted) { -ASSERT (XFS_FORCED_SHUTDOWN (ailp->ail_mount)); +ASSERT (xfs_is_shutdown (ailp->ail_mount));if (lip->li_ops->iop_unpin) lip->li_ops->iop_unpin (lip,1 );continue ;
@@ -864,7 +864,7 @@ __xfs_trans_commit(if (!(tp->t_flags &XFS_TRANS_DIRTY )) goto out_unreserve; -if (XFS_FORCED_SHUTDOWN (mp)) { +if (xfs_is_shutdown (mp)) { error = -EIO ; goto out_unreserve; }
@@ -950,12 +950,12 @@ xfs_trans_cancel(* filesystem. This happens in paths where we detect * corruption and decide to give up. */ -if (dirty && !XFS_FORCED_SHUTDOWN (mp)) { +if (dirty && !xfs_is_shutdown (mp)) {XFS_ERROR_REPORT ("xfs_trans_cancel" ,XFS_ERRLEVEL_LOW , mp);xfs_force_shutdown (mp,SHUTDOWN_CORRUPT_INCORE ); }#ifdef DEBUG -if (!dirty && !XFS_FORCED_SHUTDOWN (mp)) { +if (!dirty && !xfs_is_shutdown (mp)) {struct xfs_log_item *lip;list_for_each_entry (lip, &tp->t_items, li_trans)
fs/xfs/xfs_trans_ail.c +4 -4
@@ -615,7 +615,7 @@ xfsaild(* opportunity to release such buffers from the queue. */ ASSERT (list_empty (&ailp->ail_buf_list) || -XFS_FORCED_SHUTDOWN (ailp->ail_mount)); +xfs_is_shutdown (ailp->ail_mount));xfs_buf_delwri_cancel (&ailp->ail_buf_list);break ; }
@@ -678,7 +678,7 @@ xfs_ail_push(struct xfs_log_item *lip; lip =xfs_ail_min (ailp); -if (!lip ||XFS_FORCED_SHUTDOWN (ailp->ail_mount) || +if (!lip ||xfs_is_shutdown (ailp->ail_mount) ||XFS_LSN_CMP (threshold_lsn, ailp->ail_target) <=0 )return ;
@@ -743,7 +743,7 @@ xfs_ail_update_finish(return ; } -if (!XFS_FORCED_SHUTDOWN (mp)) +if (!xfs_is_shutdown (mp))xlog_assign_tail_lsn_locked (mp);if (list_empty (&ailp->ail_head))
@@ -863,7 +863,7 @@ xfs_trans_ail_delete(spin_lock (&ailp->ail_lock);if (!test_bit (XFS_LI_IN_AIL , &lip->li_flags)) {spin_unlock (&ailp->ail_lock); -if (shutdown_type && !XFS_FORCED_SHUTDOWN (mp)) { +if (shutdown_type && !xfs_is_shutdown (mp)) {xfs_alert_tag (mp,XFS_PTAG_AILDELETE ,"%s: attempting to delete a log item that is not in the AIL" , __func__);
fs/xfs/xfs_trans_buf.c +3 -3
@@ -138,7 +138,7 @@ xfs_trans_get_buf_map( bp =xfs_trans_buf_item_match (tp, target, map, nmaps);if (bp !=NULL ) {ASSERT (xfs_buf_islocked (bp)); -if (XFS_FORCED_SHUTDOWN (tp->t_mountp)) { +if (xfs_is_shutdown (tp->t_mountp)) {xfs_buf_stale (bp); bp->b_flags |=XBF_DONE ; }
@@ -244,7 +244,7 @@ xfs_trans_read_buf_map(* We never locked this buf ourselves, so we shouldn't * brelse it either. Just get out. */ -if (XFS_FORCED_SHUTDOWN (mp)) { +if (xfs_is_shutdown (mp)) {trace_xfs_trans_read_buf_shut (bp, _RET_IP_);return -EIO ; }
@@ -300,7 +300,7 @@ xfs_trans_read_buf_map(return error; } -if (XFS_FORCED_SHUTDOWN (mp)) { +if (xfs_is_shutdown (mp)) {xfs_buf_relse (bp);trace_xfs_trans_read_buf_shut (bp, _RET_IP_);return -EIO ;
Signature · 1 line
2.31.1
PATCH v3 10/16 xfs: convert xfs_fs_geometry to use mount feature checks
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Reporting filesystem features to userspace is currently superblock based. Now we have a general mount-based feature infrastructure, switch to using the xfs_mount rather than the superblock directly.
This reduces the size of the function by over 300 bytes.
$ size -t fs/xfs/built-in.a text data bss dec hex filename before 1127855 311352 484 1439691 15f7cb (TOTALS) after 1127535 311352 484 1439371 15f68b (TOTALS)
--- fs/xfs/libxfs/xfs_sb.c | 46 ++++++++++++++++++++++-------------------- fs/xfs/libxfs/xfs_sb.h | 2 +- fs/xfs/xfs_ioctl.c | 2 +- fs/xfs/xfs_ioctl32.c | 2 +- 4 files changed, 27 insertions(+), 25 deletions(-)
fs/xfs/libxfs/xfs_sb.c +24 -22
@@ -1016,10 +1016,12 @@ xfs_sync_sb_buf(void xfs_fs_geometry ( -struct xfs_sb *sbp, +struct xfs_mount *mp,struct xfs_fsop_geom *geo,int struct_version) { +struct xfs_sb *sbp = &mp->m_sb; +memset (geo,0 ,sizeof (struct xfs_fsop_geom )); geo->blocksize = sbp->sb_blocksize;
@@ -1050,51 +1052,51 @@ xfs_fs_geometry( geo->flags =XFS_FSOP_GEOM_FLAGS_NLINK |XFS_FSOP_GEOM_FLAGS_DIRV2 |XFS_FSOP_GEOM_FLAGS_EXTFLG ; -if (xfs_sb_version_hasattr (sbp)) +if (xfs_has_attr (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_ATTR ; -if (xfs_sb_version_hasquota (sbp)) +if (xfs_has_quota (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_QUOTA ; -if (xfs_sb_version_hasalign (sbp)) +if (xfs_has_align (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_IALIGN ; -if (xfs_sb_version_hasdalign (sbp)) +if (xfs_has_dalign (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_DALIGN ; -if (xfs_sb_version_hassector (sbp)) - geo->flags |=XFS_FSOP_GEOM_FLAGS_SECTOR ; -if (xfs_sb_version_hasasciici (sbp)) +if (xfs_has_asciici (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_DIRV2CI ; -if (xfs_sb_version_haslazysbcount (sbp)) +if (xfs_has_lazysbcount (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_LAZYSB ; -if (xfs_sb_version_hasattr2 (sbp)) +if (xfs_has_attr2 (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_ATTR2 ; -if (xfs_sb_version_hasprojid32 (sbp)) +if (xfs_has_projid32 (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_PROJID32 ; -if (xfs_sb_version_hascrc (sbp)) +if (xfs_has_crc (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_V5SB ; -if (xfs_sb_version_hasftype (sbp)) +if (xfs_has_ftype (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_FTYPE ; -if (xfs_sb_version_hasfinobt (sbp)) +if (xfs_has_finobt (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_FINOBT ; -if (xfs_sb_version_hassparseinodes (sbp)) +if (xfs_has_sparseinodes (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_SPINODES ; -if (xfs_sb_version_hasrmapbt (sbp)) +if (xfs_has_rmapbt (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_RMAPBT ; -if (xfs_sb_version_hasreflink (sbp)) +if (xfs_has_reflink (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_REFLINK ; -if (xfs_sb_version_hasbigtime (sbp)) +if (xfs_has_bigtime (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_BIGTIME ; -if (xfs_sb_version_hasinobtcounts (sbp)) +if (xfs_has_inobtcounts (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_INOBTCNT ; -if (xfs_sb_version_hassector (sbp)) +if (xfs_has_sector (mp)) { + geo->flags |=XFS_FSOP_GEOM_FLAGS_SECTOR ; geo->logsectsize = sbp->sb_logsectsize; -else + }else { geo->logsectsize =BBSIZE ; + } geo->rtsectsize = sbp->sb_blocksize; geo->dirblocksize =xfs_dir2_dirblock_bytes (sbp);if (struct_version <4 )return ; -if (xfs_sb_version_haslogv2 (sbp)) +if (xfs_has_logv2 (mp)) geo->flags |=XFS_FSOP_GEOM_FLAGS_LOGV2 ; geo->logsunit = sbp->sb_logsunit;
fs/xfs/libxfs/xfs_sb.h +1 -1
@@ -25,7 +25,7 @@ extern uint64_t xfs_sb_version_to_features(struct xfs_sb *sbp);extern int xfs_update_secondary_sbs (struct xfs_mount *mp);#define XFS_FS_GEOM_MAX_STRUCT_VER (4) -extern void xfs_fs_geometry (struct xfs_sb *sbp,struct xfs_fsop_geom *geo, +extern void xfs_fs_geometry (struct xfs_mount *mp,struct xfs_fsop_geom *geo,int struct_version); extern int xfs_sb_read_secondary(struct xfs_mount *mp, struct xfs_trans *tp, xfs_agnumber_t agno,
fs/xfs/xfs_ioctl.c +1 -1
@@ -1010,7 +1010,7 @@ xfs_ioc_fsgeometry(struct xfs_fsop_geom fsgeo;size_t len; -xfs_fs_geometry (&mp->m_sb, &fsgeo, struct_version); +xfs_fs_geometry (mp, &fsgeo, struct_version);if (struct_version <=3 ) len =sizeof (struct xfs_fsop_geom_v1 );
fs/xfs/xfs_ioctl32.c +1 -1
@@ -50,7 +50,7 @@ xfs_compat_ioc_fsgeometry_v1( {struct xfs_fsop_geom fsgeo; -xfs_fs_geometry (&mp->m_sb, &fsgeo,3 ); +xfs_fs_geometry (mp, &fsgeo,3 );/* The 32-bit variant simply has some padding at the end */ if (copy_to_user (arg32, &fsgeo,sizeof (struct compat_xfs_fsop_geom_v1 )))return -EFAULT ;
Signature · 1 line
2.31.1
PATCH v3 11/16 xfs: open code sb verifier feature checks
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The superblock verifiers are one of the last places that use the sb version functions to do feature checks. This are all quite simple uses, and there aren't many of them so open code them all.
Also, move the good version number check into xfs_sb.c instead of it being an inline function in xfs_format.h
--- fs/xfs/libxfs/xfs_format.h | 29 ---------- fs/xfs/libxfs/xfs_sb.c | 116 +++++++++++++++++++++++++------------ fs/xfs/libxfs/xfs_sb.h | 1 + 3 files changed, 81 insertions(+), 65 deletions(-)
fs/xfs/libxfs/xfs_format.h +0 -29
@@ -265,7 +265,6 @@ typedef struct xfs_dsb {/* must be padded to 64 bit alignment */ } xfs_dsb_t; -/* * Misc. Flags - warning - these will be cleared by xfs_repair unless * a feature bit is set when the flag is used.
@@ -280,34 +279,6 @@ typedef struct xfs_dsb {#define XFS_SB_VERSION_NUM (sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) -/* -* The first XFS version we support is a v4 superblock with V2 directories. -*/ -static inline bool xfs_sb_good_v4_features (struct xfs_sb *sbp) -{ -if (!(sbp->sb_versionnum &XFS_SB_VERSION_DIRV2BIT )) -return false; -if (!(sbp->sb_versionnum &XFS_SB_VERSION_EXTFLGBIT )) -return false; - -/* check for unknown features in the fs */ -if ((sbp->sb_versionnum & ~XFS_SB_VERSION_OKBITS ) || - ((sbp->sb_versionnum &XFS_SB_VERSION_MOREBITSBIT ) && - (sbp->sb_features2 & ~XFS_SB_VERSION2_OKBITS ))) -return false; - -return true; -} - -static inline bool xfs_sb_good_version (struct xfs_sb *sbp) -{ -if (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ) -return true; -if (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_4 ) -return xfs_sb_good_v4_features (sbp); -return false; -} -static inline bool xfs_sb_version_hasrealtime (struct xfs_sb *sbp) {return sbp->sb_rblocks >0 ;
fs/xfs/libxfs/xfs_sb.c +80 -36
205 lines not on this page · raw message
fs/xfs/libxfs/xfs_sb.h +1 -0
@@ -20,6 +20,7 @@ extern void xfs_sb_mount_common(struct xfs_mount *mp, struct xfs_sb *sbp);extern void xfs_sb_from_disk (struct xfs_sb *to,struct xfs_dsb *from);extern void xfs_sb_to_disk (struct xfs_dsb *to,struct xfs_sb *from);extern void xfs_sb_quota_from_disk (struct xfs_sb *sbp); +extern bool xfs_sb_good_version (struct xfs_sb *sbp);extern uint64_t xfs_sb_version_to_features (struct xfs_sb *sbp);extern int xfs_update_secondary_sbs (struct xfs_mount *mp);
Signature · 1 line
2.31.1
PATCH v3 12/16 xfs: convert scrub to use mount-based feature checks
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The scrub feature checks are the last place that the superblock feature checks are used. Convert them to mount based feature checks.
--- fs/xfs/scrub/scrub.c | 12 ++++++------ fs/xfs/scrub/scrub.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
fs/xfs/scrub/scrub.c +6 -6
@@ -239,21 +239,21 @@ static const struct xchk_meta_ops meta_scrub_ops[] = { .type = ST_PERAG, .setup = xchk_setup_ag_iallocbt, .scrub = xchk_finobt, - .has = xfs_sb_version_hasfinobt, + .has = xfs_has_finobt, .repair = xrep_notsupported, }, [XFS_SCRUB_TYPE_RMAPBT] = { /* rmapbt */ .type = ST_PERAG, .setup = xchk_setup_ag_rmapbt, .scrub = xchk_rmapbt, - .has = xfs_sb_version_hasrmapbt, + .has = xfs_has_rmapbt, .repair = xrep_notsupported, }, [XFS_SCRUB_TYPE_REFCNTBT] = { /* refcountbt */ .type = ST_PERAG, .setup = xchk_setup_ag_refcountbt, .scrub = xchk_refcountbt, - .has = xfs_sb_version_hasreflink, + .has = xfs_has_reflink, .repair = xrep_notsupported, }, [XFS_SCRUB_TYPE_INODE] = { /* inode record */
@@ -308,14 +308,14 @@ static const struct xchk_meta_ops meta_scrub_ops[] = { .type = ST_FS, .setup = xchk_setup_rt, .scrub = xchk_rtbitmap, - .has = xfs_sb_version_hasrealtime, + .has = xfs_has_realtime, .repair = xrep_notsupported, }, [XFS_SCRUB_TYPE_RTSUM] = { /* realtime summary */ .type = ST_FS, .setup = xchk_setup_rt, .scrub = xchk_rtsummary, - .has = xfs_sb_version_hasrealtime, + .has = xfs_has_realtime, .repair = xrep_notsupported, }, [XFS_SCRUB_TYPE_UQUOTA] = { /* user quota */
@@ -383,7 +383,7 @@ xchk_validate_inputs(if (ops->setup ==NULL || ops->scrub ==NULL ) goto out;/* Does this fs even support this type of metadata? */ -if (ops->has && !ops->has (&mp->m_sb)) +if (ops->has && !ops->has (mp)) goto out; error = -EINVAL ;
fs/xfs/scrub/scrub.h +1 -1
@@ -27,7 +27,7 @@ struct xchk_meta_ops {int (*repair)(struct xfs_scrub *);/* Decide if we even have this piece of metadata. */ -bool (*has)(struct xfs_sb *); +bool (*has)(struct xfs_mount *);/* type describing required/allowed inputs */ enum xchk_type type;
Signature · 1 line
2.31.1
PATCH v3 13/16 xfs: convert xfs_sb_version_has checks to use mount features
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
This is a conversion of the remaining xfs_sb_version_has..(sbp) checks to use xfs_has_..(mp) feature checks.
This was largely done with a vim replacement macro that did:
:0,$s/xfs_sb_version_has\(.*\)&\(.*\)->m_sb/xfs_has_\1\2/g<CR>
A couple of other variants were also used, and the rest touched up by hand.
$ size -t fs/xfs/built-in.a text data bss dec hex filename before 1127533 311352 484 1439369 15f689 (TOTALS) after 1125360 311352 484 1437196 15ee0c (TOTALS)
--- fs/xfs/libxfs/xfs_ag.c | 4 ++-- fs/xfs/libxfs/xfs_alloc.c | 12 ++++++------ fs/xfs/libxfs/xfs_alloc.h | 2 +- fs/xfs/libxfs/xfs_alloc_btree.c | 2 +- fs/xfs/libxfs/xfs_bmap_btree.c | 2 +- fs/xfs/libxfs/xfs_btree.c | 6 +++--- fs/xfs/libxfs/xfs_da_btree.c | 6 +++--- fs/xfs/libxfs/xfs_dir2.c | 6 +++--- fs/xfs/libxfs/xfs_dir2_block.c | 4 ++-- fs/xfs/libxfs/xfs_dir2_data.c | 10 +++++----- fs/xfs/libxfs/xfs_dir2_leaf.c | 4 ++-- fs/xfs/libxfs/xfs_dir2_node.c | 4 ++-- fs/xfs/libxfs/xfs_dir2_priv.h | 2 +- fs/xfs/libxfs/xfs_dir2_sf.c | 10 +++++----- fs/xfs/libxfs/xfs_dquot_buf.c | 2 +- fs/xfs/libxfs/xfs_ialloc.c | 30 +++++++++++++++--------------- fs/xfs/libxfs/xfs_ialloc_btree.c | 10 +++++----- fs/xfs/libxfs/xfs_inode_buf.c | 10 +++++----- fs/xfs/libxfs/xfs_log_format.h | 2 +- fs/xfs/libxfs/xfs_refcount.c | 8 ++++---- fs/xfs/libxfs/xfs_sb.c | 2 +- fs/xfs/libxfs/xfs_trans_inode.c | 2 +- fs/xfs/libxfs/xfs_trans_resv.c | 6 +++--- fs/xfs/libxfs/xfs_trans_space.h | 6 ++---- fs/xfs/scrub/agheader.c | 6 +++--- fs/xfs/scrub/agheader_repair.c | 5 ++--- fs/xfs/scrub/bmap.c | 3 +-- fs/xfs/scrub/common.c | 6 +++--- fs/xfs/scrub/fscounters.c | 2 +- fs/xfs/scrub/inode.c | 3 +-- fs/xfs/scrub/quota.c | 2 +- fs/xfs/xfs_mount.c | 2 +- fs/xfs/xfs_reflink.h | 3 +-- fs/xfs/xfs_super.c | 2 +- 34 files changed, 90 insertions(+), 96 deletions(-)
fs/xfs/libxfs/xfs_ag.c +2 -2
@@ -607,9 +607,9 @@ xfs_agiblock_init( }for (bucket =0 ; bucket <XFS_AGI_UNLINKED_BUCKETS ; bucket++) agi->agi_unlinked[bucket] =cpu_to_be32 (NULLAGINO ); -if (xfs_sb_version_hasinobtcounts (&mp->m_sb)) { +if (xfs_has_inobtcounts (mp)) { agi->agi_iblocks =cpu_to_be32 (1 ); -if (xfs_sb_version_hasfinobt (&mp->m_sb)) +if (xfs_has_finobt (mp)) agi->agi_fblocks =cpu_to_be32 (1 ); } }
fs/xfs/libxfs/xfs_alloc.c +6 -6
@@ -2264,7 +2264,7 @@ xfs_alloc_min_freelist( min_free += min_t(unsigned int, levels[XFS_BTNUM_CNTi] + 1, mp->m_ag_maxlevels);/* space needed reverse mapping used space btree */ -if (xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (xfs_has_rmapbt (mp)) min_free += min_t(unsigned int, levels[XFS_BTNUM_RMAPi] + 1, mp->m_rmap_maxlevels);
@@ -2912,7 +2912,7 @@ xfs_agf_verify( be32_to_cpu(agf->agf_levels[XFS_BTNUM_RMAP]) > mp->m_rmap_maxlevels))return __this_address; -if (xfs_sb_version_hasrmapbt (&mp->m_sb) && +if (xfs_has_rmapbt (mp) &&be32_to_cpu (agf->agf_rmap_blocks) >be32_to_cpu (agf->agf_length))return __this_address;
@@ -2925,16 +2925,16 @@ xfs_agf_verify(if (bp->b_pag &&be32_to_cpu (agf->agf_seqno) != bp->b_pag->pag_agno)return __this_address; -if (xfs_sb_version_haslazysbcount (&mp->m_sb) && +if (xfs_has_lazysbcount (mp) &&be32_to_cpu (agf->agf_btreeblks) >be32_to_cpu (agf->agf_length))return __this_address; -if (xfs_sb_version_hasreflink (&mp->m_sb) && +if (xfs_has_reflink (mp) &&be32_to_cpu (agf->agf_refcount_blocks) >be32_to_cpu (agf->agf_length))return __this_address; -if (xfs_sb_version_hasreflink (&mp->m_sb) && +if (xfs_has_reflink (mp) && (be32_to_cpu (agf->agf_refcount_level) <1 ||be32_to_cpu (agf->agf_refcount_level) > mp->m_refc_maxlevels))return __this_address;
@@ -3073,7 +3073,7 @@ xfs_alloc_read_agf(* counter only tracks non-root blocks. */ allocbt_blks = pag->pagf_btreeblks; -if (xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (xfs_has_rmapbt (mp)) allocbt_blks -=be32_to_cpu (agf->agf_rmap_blocks) -1 ;if (allocbt_blks >0 )atomic64_add (allocbt_blks, &mp->m_allocbt_blks);
fs/xfs/libxfs/xfs_alloc.h +1 -1
@@ -243,7 +243,7 @@ static inline __be32 *xfs_buf_to_agfl_bno ( struct xfs_buf *bp) { -if (xfs_sb_version_hascrc (&bp->b_mount->m_sb)) +if (xfs_has_crc (bp->b_mount))return bp->b_addr +sizeof (struct xfs_agfl );return bp->b_addr; }
fs/xfs/libxfs/xfs_alloc_btree.c +1 -1
@@ -295,7 +295,7 @@ xfs_allocbt_verify(if (!xfs_verify_magic (bp, block->bb_magic))return __this_address; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) { fa =xfs_btree_sblock_v5hdr_verify (bp);if (fa)return fa;
fs/xfs/libxfs/xfs_bmap_btree.c +1 -1
@@ -428,7 +428,7 @@ xfs_bmbt_verify(if (!xfs_verify_magic (bp, block->bb_magic))return __this_address; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {/* * XXX: need a better way of verifying the owner here. Right now * just make sure there has been one set.
fs/xfs/libxfs/xfs_btree.c +3 -3
@@ -273,7 +273,7 @@ xfs_btree_lblock_calc_crc(struct xfs_btree_block *block =XFS_BUF_TO_BLOCK (bp);struct xfs_buf_log_item *bip = bp->b_log_item; -if (!xfs_sb_version_hascrc (&bp->b_mount->m_sb)) +if (!xfs_has_crc (bp->b_mount))return ;if (bip) block->bb_u.l.bb_lsn =cpu_to_be64 (bip->bli_item.li_lsn);
@@ -311,7 +311,7 @@ xfs_btree_sblock_calc_crc(struct xfs_btree_block *block =XFS_BUF_TO_BLOCK (bp);struct xfs_buf_log_item *bip = bp->b_log_item; -if (!xfs_sb_version_hascrc (&bp->b_mount->m_sb)) +if (!xfs_has_crc (bp->b_mount))return ;if (bip) block->bb_u.s.bb_lsn =cpu_to_be64 (bip->bli_item.li_lsn);
@@ -1749,7 +1749,7 @@ xfs_btree_lookup_get_block(return error;/* Check the inode owner since the verifiers don't. */ -if (xfs_sb_version_hascrc (&cur->bc_mp->m_sb) && +if (xfs_has_crc (cur->bc_mp) && !(cur->bc_ino.flags &XFS_BTCUR_BMBT_INVALID_OWNER ) && (cur->bc_flags &XFS_BTREE_LONG_PTRS ) && be64_to_cpu((*blkp)->bb_u.l.bb_owner) !=
fs/xfs/libxfs/xfs_da_btree.c +3 -3
@@ -129,7 +129,7 @@ xfs_da3_node_hdr_from_disk(struct xfs_da3_icnode_hdr *to, struct xfs_da_intnode *from) { -if (xfs_sb_version_hascrc (&mp->m_sb)) { + if (xfs_has_crc(mp)) { struct xfs_da3_intnode *from3 = (struct xfs_da3_intnode *)from; to->forw =be32_to_cpu (from3->hdr.info.hdr.forw);
@@ -156,7 +156,7 @@ xfs_da3_node_hdr_to_disk(struct xfs_da_intnode *to, struct xfs_da3_icnode_hdr *from) { -if (xfs_sb_version_hascrc (&mp->m_sb)) { + if (xfs_has_crc(mp)) { struct xfs_da3_intnode *to3 = (struct xfs_da3_intnode *)to;ASSERT (from->magic ==XFS_DA3_NODE_MAGIC );
@@ -191,7 +191,7 @@ xfs_da3_blkinfo_verify(if (!xfs_verify_magic16 (bp, hdr->magic))return __this_address; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {if (!uuid_equal (&hdr3->uuid, &mp->m_sb.sb_meta_uuid))return __this_address;if (be64_to_cpu (hdr3->blkno) != bp->b_bn)
fs/xfs/libxfs/xfs_dir2.c +3 -3
@@ -115,7 +115,7 @@ xfs_da_mount( dageo->fsblog = mp->m_sb.sb_blocklog; dageo->blksize =xfs_dir2_dirblock_bytes (&mp->m_sb); dageo->fsbcount =1 << mp->m_sb.sb_dirblklog; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) { dageo->node_hdr_size =sizeof (struct xfs_da3_node_hdr ); dageo->leaf_hdr_size =sizeof (struct xfs_dir3_leaf_hdr ); dageo->free_hdr_size =sizeof (struct xfs_dir3_free_hdr );
@@ -730,7 +730,7 @@ xfs_dir2_hashname(struct xfs_mount *mp, struct xfs_name *name) { - if (unlikely(xfs_sb_version_hasasciici(&mp->m_sb))) + if (unlikely(xfs_has_asciici(mp))) return xfs_ascii_ci_hashname(name); return xfs_da_hashname(name->name, name->len); }
@@ -741,7 +741,7 @@ xfs_dir2_compname( const unsigned char *name, int len) { - if (unlikely(xfs_sb_version_hasasciici(&args->dp->i_mount->m_sb))) + if (unlikely(xfs_has_asciici(args->dp->i_mount))) return xfs_ascii_ci_compname(args, name, len);return xfs_da_compname (args, name, len); }
fs/xfs/libxfs/xfs_dir2_block.c +2 -2
@@ -53,7 +53,7 @@ xfs_dir3_block_verify(if (!xfs_verify_magic (bp, hdr3->magic))return __this_address; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {if (!uuid_equal (&hdr3->uuid, &mp->m_sb.sb_meta_uuid))return __this_address;if (be64_to_cpu (hdr3->blkno) != bp->b_bn)
@@ -121,7 +121,7 @@ xfs_dir3_block_header_check( {struct xfs_mount *mp = dp->i_mount; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {struct xfs_dir3_blk_hdr *hdr3 = bp->b_addr;if (be64_to_cpu (hdr3->owner) != dp->i_ino)
fs/xfs/libxfs/xfs_dir2_data.c +5 -5
@@ -29,7 +29,7 @@ xfs_dir2_data_bestfree_p( struct xfs_mount *mp, struct xfs_dir2_data_hdr *hdr) { -if (xfs_sb_version_hascrc (&mp->m_sb)) + if (xfs_has_crc(mp)) return ((struct xfs_dir3_data_hdr *)hdr)->best_free; return hdr->bestfree; }
@@ -51,7 +51,7 @@ xfs_dir2_data_get_ftype(struct xfs_mount *mp, struct xfs_dir2_data_entry *dep) { -if (xfs_sb_version_hasftype (&mp->m_sb)) { + if (xfs_has_ftype(mp)) { uint8_t ftype = dep->name[dep->namelen];if (likely (ftype <XFS_DIR3_FT_MAX ))
@@ -70,7 +70,7 @@ xfs_dir2_data_put_ftype(ASSERT (ftype <XFS_DIR3_FT_MAX );ASSERT (dep->namelen !=0 ); -if (xfs_sb_version_hasftype (&mp->m_sb)) +if (xfs_has_ftype (mp)) dep->name[dep->namelen] = ftype; }
@@ -297,7 +297,7 @@ xfs_dir3_data_verify(if (!xfs_verify_magic (bp, hdr3->magic))return __this_address; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {if (!uuid_equal (&hdr3->uuid, &mp->m_sb.sb_meta_uuid))return __this_address;if (be64_to_cpu (hdr3->blkno) != bp->b_bn)
@@ -401,7 +401,7 @@ xfs_dir3_data_header_check( {struct xfs_mount *mp = dp->i_mount; -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) {struct xfs_dir3_data_hdr *hdr3 = bp->b_addr;if (be64_to_cpu (hdr3->hdr.owner) != dp->i_ino)
fs/xfs/libxfs/xfs_dir2_leaf.c +2 -2
@@ -37,7 +37,7 @@ xfs_dir2_leaf_hdr_from_disk(struct xfs_dir3_icleaf_hdr *to, struct xfs_dir2_leaf *from) { -if (xfs_sb_version_hascrc (&mp->m_sb)) { + if (xfs_has_crc(mp)) { struct xfs_dir3_leaf *from3 = (struct xfs_dir3_leaf *)from; to->forw =be32_to_cpu (from3->hdr.info.hdr.forw);
@@ -68,7 +68,7 @@ xfs_dir2_leaf_hdr_to_disk(struct xfs_dir2_leaf *to, struct xfs_dir3_icleaf_hdr *from) { -if (xfs_sb_version_hascrc (&mp->m_sb)) { + if (xfs_has_crc(mp)) { struct xfs_dir3_leaf *to3 = (struct xfs_dir3_leaf *)to; ASSERT(from->magic == XFS_DIR3_LEAF1_MAGIC ||
fs/xfs/libxfs/xfs_dir2_node.c +2 -2
@@ -247,7 +247,7 @@ xfs_dir2_free_hdr_from_disk(struct xfs_dir3_icfree_hdr *to, struct xfs_dir2_free *from) { -if (xfs_sb_version_hascrc (&mp->m_sb)) { + if (xfs_has_crc(mp)) { struct xfs_dir3_free *from3 = (struct xfs_dir3_free *)from; to->magic =be32_to_cpu (from3->hdr.hdr.magic);
@@ -274,7 +274,7 @@ xfs_dir2_free_hdr_to_disk(struct xfs_dir2_free *to, struct xfs_dir3_icfree_hdr *from) { -if (xfs_sb_version_hascrc (&mp->m_sb)) { + if (xfs_has_crc(mp)) { struct xfs_dir3_free *to3 = (struct xfs_dir3_free *)to;ASSERT (from->magic ==XFS_DIR3_FREE_MAGIC );
fs/xfs/libxfs/xfs_dir2_priv.h +1 -1
@@ -196,7 +196,7 @@ xfs_dir2_data_entsize( len = offsetof(struct xfs_dir2_data_entry, name[0]) + namelen +sizeof (xfs_dir2_data_off_t)/* tag */ ; -if (xfs_sb_version_hasftype (&mp->m_sb)) +if (xfs_has_ftype (mp)) len +=sizeof (uint8_t );return round_up (len,XFS_DIR2_DATA_ALIGN ); }
fs/xfs/libxfs/xfs_dir2_sf.c +5 -5
@@ -48,7 +48,7 @@ xfs_dir2_sf_entsize( count +=sizeof (struct xfs_dir2_sf_entry );/* namelen + offset */ count += hdr->i8count ?XFS_INO64_SIZE :XFS_INO32_SIZE ;/* ino # */ -if (xfs_sb_version_hasftype (&mp->m_sb)) +if (xfs_has_ftype (mp)) count +=sizeof (uint8_t );return count; }
@@ -76,7 +76,7 @@ xfs_dir2_sf_get_ino( {uint8_t *from = sfep->name + sfep->namelen; -if (xfs_sb_version_hasftype (&mp->m_sb)) +if (xfs_has_ftype (mp)) from++;if (!hdr->i8count)
@@ -95,7 +95,7 @@ xfs_dir2_sf_put_ino(ASSERT (ino <=XFS_MAXINUMBER ); -if (xfs_sb_version_hasftype (&mp->m_sb)) +if (xfs_has_ftype (mp)) to++;if (hdr->i8count)
@@ -135,7 +135,7 @@ xfs_dir2_sf_get_ftype(struct xfs_mount *mp, struct xfs_dir2_sf_entry *sfep) { -if (xfs_sb_version_hasftype (&mp->m_sb)) { + if (xfs_has_ftype(mp)) { uint8_t ftype = sfep->name[sfep->namelen];if (ftype <XFS_DIR3_FT_MAX )
@@ -153,7 +153,7 @@ xfs_dir2_sf_put_ftype( {ASSERT (ftype <XFS_DIR3_FT_MAX ); -if (xfs_sb_version_hasftype (&mp->m_sb)) +if (xfs_has_ftype (mp)) sfep->name[sfep->namelen] = ftype; }
fs/xfs/libxfs/xfs_dquot_buf.c +1 -1
@@ -70,7 +70,7 @@ xfs_dquot_verify(return __this_address;if ((ddq->d_type &XFS_DQTYPE_BIGTIME ) && - !xfs_sb_version_hasbigtime (&mp->m_sb)) + !xfs_has_bigtime (mp))return __this_address;if ((ddq->d_type &XFS_DQTYPE_BIGTIME ) && !ddq->d_id)
fs/xfs/libxfs/xfs_ialloc.c +15 -15
@@ -302,7 +302,7 @@ xfs_ialloc_inode_init(* That means for v3 inode we log the entire buffer rather than just the * inode cores. */ -if (xfs_sb_version_has_v3inode (&mp->m_sb)) { +if (xfs_has_v3inodes (mp)) { version =3 ; ino =XFS_AGINO_TO_INO (mp, agno,XFS_AGB_TO_AGINO (mp, agbno));
@@ -635,7 +635,7 @@ xfs_ialloc_ag_alloc(#ifdef DEBUG /* randomly do sparse inode allocations */ -if (xfs_sb_version_hassparseinodes (&tp->t_mountp->m_sb) && +if (xfs_has_sparseinodes (tp->t_mountp) && igeo->ialloc_min_blks < igeo->ialloc_blks) do_sparse =prandom_u32 () &1 ;#endif
@@ -754,7 +754,7 @@ xfs_ialloc_ag_alloc(* Finally, try a sparse allocation if the filesystem supports it and * the sparse allocation length is smaller than a full chunk. */ -if (xfs_sb_version_hassparseinodes (&args.mp->m_sb) && +if (xfs_has_sparseinodes (args.mp) && igeo->ialloc_min_blks < igeo->ialloc_blks && args.fsbno ==NULLFSBLOCK ) { sparse_alloc:
@@ -856,7 +856,7 @@ xfs_ialloc_ag_alloc(* from the previous call. Set merge false to replace any * existing record with this one. */ -if (xfs_sb_version_hasfinobt (&args.mp->m_sb)) { +if (xfs_has_finobt (args.mp)) { error =xfs_inobt_insert_sprec (args.mp, tp, agbp, pag,XFS_BTNUM_FINO , &rec, false);if (error)
@@ -869,7 +869,7 @@ xfs_ialloc_ag_alloc(if (error)return error; -if (xfs_sb_version_hasfinobt (&args.mp->m_sb)) { +if (xfs_has_finobt (args.mp)) { error =xfs_inobt_insert (args.mp, tp, agbp, pag, newino, newlen,XFS_BTNUM_FINO );if (error)
@@ -1448,7 +1448,7 @@ xfs_dialloc_ag(int offset;int i; -if (!xfs_sb_version_hasfinobt (&mp->m_sb)) +if (!xfs_has_finobt (mp))return xfs_dialloc_ag_inobt (tp, agbp, pag, parent, inop);/*
@@ -2187,7 +2187,7 @@ xfs_difree(/* * Fix up the free inode btree. */ -if (xfs_sb_version_hasfinobt (&mp->m_sb)) { +if (xfs_has_finobt (mp)) { error =xfs_difree_finobt (mp, tp, agbp, pag, agino, &rec);if (error) goto error0;
@@ -2771,7 +2771,7 @@ xfs_ialloc_setup_geometry(uint inodes; igeo->new_diflags2 =0 ; -if (xfs_sb_version_hasbigtime (&mp->m_sb)) +if (xfs_has_bigtime (mp)) igeo->new_diflags2 |=XFS_DIFLAG2_BIGTIME ;/* Compute inode btree geometry. */
@@ -2826,7 +2826,7 @@ xfs_ialloc_setup_geometry(* cannot change the behavior. */ igeo->inode_cluster_size_raw =XFS_INODE_BIG_CLUSTER_SIZE ; -if (xfs_sb_version_has_v3inode (&mp->m_sb)) { +if (xfs_has_v3inodes (mp)) {int new_size = igeo->inode_cluster_size_raw; new_size *= mp->m_sb.sb_inodesize /XFS_DINODE_MIN_SIZE ;
@@ -2844,7 +2844,7 @@ xfs_ialloc_setup_geometry( igeo->inodes_per_cluster =XFS_FSB_TO_INO (mp, igeo->blocks_per_cluster);/* Calculate inode cluster alignment. */ -if (xfs_sb_version_hasalign (&mp->m_sb) && +if (xfs_has_align (mp) && mp->m_sb.sb_inoalignmt >= igeo->blocks_per_cluster) igeo->cluster_align = mp->m_sb.sb_inoalignmt;else
@@ -2892,15 +2892,15 @@ xfs_ialloc_calc_rootino( first_bno +=xfs_alloc_min_freelist (mp,NULL );/* ...the free inode btree root... */ -if (xfs_sb_version_hasfinobt (&mp->m_sb)) +if (xfs_has_finobt (mp)) first_bno++;/* ...the reverse mapping btree root... */ -if (xfs_sb_version_hasrmapbt (&mp->m_sb)) +if (xfs_has_rmapbt (mp)) first_bno++;/* ...the reference count btree... */ -if (xfs_sb_version_hasreflink (&mp->m_sb)) +if (xfs_has_reflink (mp)) first_bno++;/*
@@ -2918,9 +2918,9 @@ xfs_ialloc_calc_rootino(* Now round first_bno up to whatever allocation alignment is given * by the filesystem or was passed in. */ -if (xfs_sb_version_hasdalign (&mp->m_sb) && igeo->ialloc_align >0 ) +if (xfs_has_dalign (mp) && igeo->ialloc_align >0 ) first_bno =roundup (first_bno, sunit); -else if (xfs_sb_version_hasalign (&mp->m_sb) && +else if (xfs_has_align (mp) && mp->m_sb.sb_inoalignmt >1 ) first_bno =roundup (first_bno, mp->m_sb.sb_inoalignmt);
fs/xfs/libxfs/xfs_ialloc_btree.c +5 -5
@@ -76,7 +76,7 @@ xfs_inobt_mod_blockcount(struct xfs_buf *agbp = cur->bc_ag.agbp;struct xfs_agi *agi = agbp->b_addr; -if (!xfs_sb_version_hasinobtcounts (&cur->bc_mp->m_sb)) +if (!xfs_has_inobtcounts (cur->bc_mp))return ;if (cur->bc_btnum ==XFS_BTNUM_FINO )
@@ -292,7 +292,7 @@ xfs_inobt_verify(* but beware of the landmine (i.e. need to check pag->pagi_init) if we * ever do. */ -if (xfs_sb_version_hascrc (&mp->m_sb)) { +if (xfs_has_crc (mp)) { fa =xfs_btree_sblock_v5hdr_verify (bp);if (fa)return fa;
@@ -511,7 +511,7 @@ xfs_inobt_commit_staged_btree( fields =XFS_AGI_ROOT |XFS_AGI_LEVEL ; agi->agi_root =cpu_to_be32 (afake->af_root); agi->agi_level =cpu_to_be32 (afake->af_levels); -if (xfs_sb_version_hasinobtcounts (&cur->bc_mp->m_sb)) { +if (xfs_has_inobtcounts (cur->bc_mp)) { agi->agi_iblocks =cpu_to_be32 (afake->af_blocks); fields |=XFS_AGI_IBLOCKS ; }
@@ -521,7 +521,7 @@ xfs_inobt_commit_staged_btree( fields =XFS_AGI_FREE_ROOT |XFS_AGI_FREE_LEVEL ; agi->agi_free_root =cpu_to_be32 (afake->af_root); agi->agi_free_level =cpu_to_be32 (afake->af_levels); -if (xfs_sb_version_hasinobtcounts (&cur->bc_mp->m_sb)) { +if (xfs_has_inobtcounts (cur->bc_mp)) { agi->agi_fblocks =cpu_to_be32 (afake->af_blocks); fields |=XFS_AGI_IBLOCKS ; }
@@ -740,7 +740,7 @@ xfs_finobt_calc_reserves(if (!xfs_has_finobt (mp))return 0 ; -if (xfs_sb_version_hasinobtcounts (&mp->m_sb)) +if (xfs_has_inobtcounts (mp)) error =xfs_finobt_read_blocks (mp, tp, pag, &tree_len);else error = xfs_inobt_count_blocks(mp, tp, pag, XFS_BTNUM_FINO,
fs/xfs/libxfs/xfs_inode_buf.c +5 -5
@@ -192,7 +192,7 @@ xfs_inode_from_disk(* inode. If the inode is unused, mode is zero and we shouldn't mess * with the uninitialized part of it. */ -if (!xfs_sb_version_has_v3inode (&ip->i_mount->m_sb)) +if (!xfs_has_v3inodes (ip->i_mount)) ip->i_flushiter =be16_to_cpu (from->di_flushiter); inode->i_generation =be32_to_cpu (from->di_gen); inode->i_mode =be16_to_cpu (from->di_mode);
@@ -235,7 +235,7 @@ xfs_inode_from_disk(if (from->di_dmevmask || from->di_dmstate)xfs_iflags_set (ip,XFS_IPRESERVE_DM_FIELDS ); -if (xfs_sb_version_has_v3inode (&ip->i_mount->m_sb)) { +if (xfs_has_v3inodes (ip->i_mount)) {inode_set_iversion_queried (inode,be64_to_cpu (from->di_changecount)); ip->i_crtime =xfs_inode_from_disk_ts (from, from->di_crtime);
@@ -313,7 +313,7 @@ xfs_inode_to_disk( to->di_aformat =xfs_ifork_format (ip->i_afp); to->di_flags =cpu_to_be16 (ip->i_diflags); -if (xfs_sb_version_has_v3inode (&ip->i_mount->m_sb)) { +if (xfs_has_v3inodes (ip->i_mount)) { to->di_version =3 ; to->di_changecount =cpu_to_be64 (inode_peek_iversion (inode)); to->di_crtime =xfs_inode_to_disk_ts (ip, ip->i_crtime);
@@ -413,7 +413,7 @@ xfs_dinode_verify(/* Verify v3 integrity information first */ if (dip->di_version >=3 ) { -if (!xfs_sb_version_has_v3inode (&mp->m_sb)) +if (!xfs_has_v3inodes (mp))return __this_address;if (!xfs_verify_cksum ((char *)dip, mp->m_sb.sb_inodesize,XFS_DINODE_CRC_OFF ))
@@ -534,7 +534,7 @@ xfs_dinode_verify(/* bigtime iflag can only happen on bigtime filesystems */ if (xfs_dinode_has_bigtime (dip) && - !xfs_sb_version_hasbigtime (&mp->m_sb)) + !xfs_has_bigtime (mp))return __this_address;return NULL ;
fs/xfs/libxfs/xfs_log_format.h +1 -1
@@ -434,7 +434,7 @@ struct xfs_log_dinode { };#define xfs_log_dinode_size (mp) \ - (xfs_sb_version_has_v3inode(&(mp)->m_sb) ? \ + (xfs_has_v3inodes((mp)) ? \ sizeof(struct xfs_log_dinode) : \ offsetof(struct xfs_log_dinode, di_next_unlinked))
fs/xfs/libxfs/xfs_refcount.c +4 -4
@@ -1253,7 +1253,7 @@ xfs_refcount_increase_extent( struct xfs_trans *tp, struct xfs_bmbt_irec *PREV) { -if (!xfs_sb_version_hasreflink (&tp->t_mountp->m_sb)) +if (!xfs_has_reflink (tp->t_mountp))return ; __xfs_refcount_add(tp, XFS_REFCOUNT_INCREASE, PREV->br_startblock,
@@ -1268,7 +1268,7 @@ xfs_refcount_decrease_extent( struct xfs_trans *tp, struct xfs_bmbt_irec *PREV) { -if (!xfs_sb_version_hasreflink (&tp->t_mountp->m_sb)) +if (!xfs_has_reflink (tp->t_mountp))return ; __xfs_refcount_add(tp, XFS_REFCOUNT_DECREASE, PREV->br_startblock,
@@ -1617,7 +1617,7 @@ xfs_refcount_alloc_cow_extent( {struct xfs_mount *mp = tp->t_mountp; -if (!xfs_sb_version_hasreflink (&mp->m_sb)) +if (!xfs_has_reflink (mp))return ;__xfs_refcount_add (tp,XFS_REFCOUNT_ALLOC_COW , fsb, len);
@@ -1636,7 +1636,7 @@ xfs_refcount_free_cow_extent( {struct xfs_mount *mp = tp->t_mountp; -if (!xfs_sb_version_hasreflink (&mp->m_sb)) +if (!xfs_has_reflink (mp))return ;/* Remove rmap entry */
fs/xfs/libxfs/xfs_sb.c +1 -1
@@ -911,7 +911,7 @@ xfs_log_sb(* unclean shutdown, this will be corrected by log recovery rebuilding * the counters from the AGF block counts. */ -if (xfs_sb_version_haslazysbcount (&mp->m_sb)) { +if (xfs_has_lazysbcount (mp)) { mp->m_sb.sb_icount =percpu_counter_sum (&mp->m_icount); mp->m_sb.sb_ifree =percpu_counter_sum (&mp->m_ifree); mp->m_sb.sb_fdblocks =percpu_counter_sum (&mp->m_fdblocks);
fs/xfs/libxfs/xfs_trans_inode.c +1 -1
@@ -136,7 +136,7 @@ xfs_trans_log_inode(* to upgrade this inode to bigtime format, do so now. */ if ((flags & (XFS_ILOG_CORE |XFS_ILOG_TIMESTAMP )) && -xfs_sb_version_hasbigtime (&ip->i_mount->m_sb) && +xfs_has_bigtime (ip->i_mount) && !xfs_inode_has_bigtime (ip)) { ip->i_diflags2 |=XFS_DIFLAG2_BIGTIME ; flags |=XFS_ILOG_CORE ;
fs/xfs/libxfs/xfs_trans_resv.c +3 -3
@@ -187,7 +187,7 @@ xfs_calc_inode_chunk_res( XFS_FSB_TO_B(mp, 1));if (alloc) {/* icreate tx uses ordered buffers */ -if (xfs_sb_version_has_v3inode (&mp->m_sb)) +if (xfs_has_v3inodes (mp))return res; size =XFS_FSB_TO_B (mp,1 ); }
@@ -268,7 +268,7 @@ xfs_calc_write_reservation(xfs_calc_buf_res (3 , mp->m_sb.sb_sectsize) +xfs_calc_buf_res (xfs_allocfree_log_count (mp,2 ), blksz); -if (xfs_sb_version_hasrealtime (&mp->m_sb)) { +if (xfs_has_realtime (mp)) { t2 =xfs_calc_inode_res (mp,1 ) +xfs_calc_buf_res (XFS_BM_MAXLEVELS (mp,XFS_DATA_FORK ), blksz) +
@@ -317,7 +317,7 @@ xfs_calc_itruncate_reservation( t2 =xfs_calc_buf_res (9 , mp->m_sb.sb_sectsize) +xfs_calc_buf_res (xfs_allocfree_log_count (mp,4 ), blksz); -if (xfs_sb_version_hasrealtime (&mp->m_sb)) { +if (xfs_has_realtime (mp)) { t3 =xfs_calc_buf_res (5 , mp->m_sb.sb_sectsize) +xfs_calc_buf_res (xfs_rtalloc_log_count (mp,2 ), blksz) +xfs_calc_buf_res (xfs_allocfree_log_count (mp,2 ), blksz);
fs/xfs/libxfs/xfs_trans_space.h +2 -4
@@ -57,8 +57,7 @@ XFS_DAREMOVE_SPACE_RES(mp, XFS_DATA_FORK)#define XFS_IALLOC_SPACE_RES (mp) \ (M_IGEO(mp)->ialloc_blks + \ - ((xfs_sb_version_hasfinobt(&mp->m_sb) ? 2 : 1) * \ - M_IGEO(mp)->inobt_maxlevels)) + ((xfs_has_finobt(mp) ? 2 : 1) * M_IGEO(mp)->inobt_maxlevels))/* * Space reservation values for various transactions.
@@ -94,8 +93,7 @@#define XFS_SYMLINK_SPACE_RES (mp,nl,b) \ (XFS_IALLOC_SPACE_RES(mp) + XFS_DIRENTER_SPACE_RES(mp,nl) + (b))#define XFS_IFREE_SPACE_RES (mp) \ - (xfs_sb_version_hasfinobt(&mp->m_sb) ? \ - M_IGEO(mp)->inobt_maxlevels : 0) + (xfs_has_finobt(mp) ? M_IGEO(mp)->inobt_maxlevels : 0)#endif /* __XFS_TRANS_SPACE_H__ */
fs/xfs/scrub/agheader.c +3 -3
@@ -430,7 +430,7 @@ xchk_agf_xref_btreeblks(int error;/* agf_btreeblks didn't exist before lazysbcount */ -if (!xfs_sb_version_haslazysbcount (&sc->mp->m_sb)) +if (!xfs_has_lazysbcount (sc->mp))return ;/* Check agf_rmap_blocks; set up for agf_btreeblks check */
@@ -598,7 +598,7 @@ xchk_agf(xchk_block_set_corrupt (sc, sc->sa.agf_bp);if (pag->pagf_flcount !=be32_to_cpu (agf->agf_flcount))xchk_block_set_corrupt (sc, sc->sa.agf_bp); -if (xfs_sb_version_haslazysbcount (&sc->mp->m_sb) && +if (xfs_has_lazysbcount (sc->mp) && pag->pagf_btreeblks !=be32_to_cpu (agf->agf_btreeblks))xchk_block_set_corrupt (sc, sc->sa.agf_bp);
@@ -797,7 +797,7 @@ xchk_agi_xref_fiblocks(xfs_agblock_t blocks;int error =0 ; -if (!xfs_sb_version_hasinobtcounts (&sc->mp->m_sb)) +if (!xfs_has_inobtcounts (sc->mp))return ;if (sc->sa.ino_cur) {
fs/xfs/scrub/agheader_repair.c +2 -3
@@ -809,7 +809,7 @@ xrep_agi_calc_from_btrees( error =xfs_ialloc_count_inodes (cur, &count, &freecount);if (error) goto err; -if (xfs_sb_version_hasinobtcounts (&mp->m_sb)) { +if (xfs_has_inobtcounts (mp)) {xfs_agblock_t blocks; error =xfs_btree_count_blocks (cur, &blocks);
@@ -822,8 +822,7 @@ xrep_agi_calc_from_btrees( agi->agi_count =cpu_to_be32 (count); agi->agi_freecount =cpu_to_be32 (freecount); -if (xfs_sb_version_hasfinobt (&mp->m_sb) && -xfs_sb_version_hasinobtcounts (&mp->m_sb)) { +if (xfs_has_finobt (mp) &&xfs_has_inobtcounts (mp)) {xfs_agblock_t blocks; cur = xfs_inobt_init_cursor(mp, sc->tp, agi_bp,
fs/xfs/scrub/bmap.c +1 -2
@@ -659,8 +659,7 @@ xchk_bmap( }break ;case XFS_ATTR_FORK : -if (!xfs_sb_version_hasattr (&mp->m_sb) && - !xfs_sb_version_hasattr2 (&mp->m_sb)) +if (!xfs_has_attr (mp) && !xfs_has_attr2 (mp))xchk_ino_set_corrupt (sc, sc->ip->i_ino);break ;default :
fs/xfs/scrub/common.c +3 -3
@@ -487,21 +487,21 @@ xchk_ag_btcur_init( }/* Set up a finobt cursor for cross-referencing. */ -if (sa->agi_bp &&xfs_sb_version_hasfinobt (&mp->m_sb) && +if (sa->agi_bp &&xfs_has_finobt (mp) &&xchk_ag_btree_healthy_enough (sc, sa->pag,XFS_BTNUM_FINO )) { sa->fino_cur =xfs_inobt_init_cursor (mp, sc->tp, sa->agi_bp, sa->pag,XFS_BTNUM_FINO ); }/* Set up a rmapbt cursor for cross-referencing. */ -if (sa->agf_bp &&xfs_sb_version_hasrmapbt (&mp->m_sb) && +if (sa->agf_bp &&xfs_has_rmapbt (mp) &&xchk_ag_btree_healthy_enough (sc, sa->pag,XFS_BTNUM_RMAP )) { sa->rmap_cur =xfs_rmapbt_init_cursor (mp, sc->tp, sa->agf_bp, sa->pag); }/* Set up a refcountbt cursor for cross-referencing. */ -if (sa->agf_bp &&xfs_sb_version_hasreflink (&mp->m_sb) && +if (sa->agf_bp &&xfs_has_reflink (mp) &&xchk_ag_btree_healthy_enough (sc, sa->pag,XFS_BTNUM_REFC )) { sa->refc_cur =xfs_refcountbt_init_cursor (mp, sc->tp, sa->agf_bp, sa->pag);
fs/xfs/scrub/fscounters.c +1 -1
@@ -207,7 +207,7 @@ xchk_fscount_aggregate_agcounts(/* Add up the free/freelist/bnobt/cntbt blocks */ fsc->fdblocks += pag->pagf_freeblks; fsc->fdblocks += pag->pagf_flcount; -if (xfs_sb_version_haslazysbcount (&sc->mp->m_sb)) { +if (xfs_has_lazysbcount (sc->mp)) { fsc->fdblocks += pag->pagf_btreeblks; }else { error =xchk_fscount_btreeblks (sc, fsc, agno);
fs/xfs/scrub/inode.c +1 -2
@@ -199,8 +199,7 @@ xchk_inode_flags2( goto bad;/* no bigtime iflag without the bigtime feature */ -if (xfs_dinode_has_bigtime (dip) && - !xfs_sb_version_hasbigtime (&mp->m_sb)) +if (xfs_dinode_has_bigtime (dip) && !xfs_has_bigtime (mp)) goto bad;return ;
fs/xfs/scrub/quota.c +1 -1
@@ -127,7 +127,7 @@ xchk_quota_item(* a reflink filesystem we're allowed to exceed physical space * if there are no quota limits. */ -if (xfs_sb_version_hasreflink (&mp->m_sb)) { +if (xfs_has_reflink (mp)) {if (mp->m_sb.sb_dblocks < dq->q_blk.count)xchk_fblock_set_warning (sc,XFS_DATA_FORK , offset);
fs/xfs/xfs_mount.c +1 -1
@@ -1320,7 +1320,7 @@ xfs_clear_incompat_log_features( {bool ret = false; -if (!xfs_sb_version_hascrc (&mp->m_sb) || +if (!xfs_has_crc (mp) || !xfs_sb_has_incompat_log_feature (&mp->m_sb,XFS_SB_FEAT_INCOMPAT_LOG_ALL ) ||xfs_is_shutdown (mp))
fs/xfs/xfs_reflink.h +1 -2
@@ -8,8 +8,7 @@static inline bool xfs_is_always_cow_inode (struct xfs_inode *ip) { -return ip->i_mount->m_always_cow && -xfs_sb_version_hasreflink (&ip->i_mount->m_sb); +return ip->i_mount->m_always_cow &&xfs_has_reflink (ip->i_mount); }static inline bool xfs_is_cow_inode (struct xfs_inode *ip)
fs/xfs/xfs_super.c +1 -1
@@ -1505,7 +1505,7 @@ xfs_fs_fill_super( }/* Filesystem claims it needs repair, so refuse the mount. */ -if (xfs_sb_version_needsrepair (&mp->m_sb)) { +if (xfs_has_needsrepair (mp)) {xfs_warn (mp,"Filesystem needs repair. Please run xfs_repair." ); error = -EFSCORRUPTED ; goto out_free_sb;
Signature · 1 line
2.31.1
PATCH v3 14/16 xfs: remove unused xfs_sb_version_has wrappers
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
The vast majority of these wrappers are now unused. Remove them leaving just the small subset of wrappers that are used to either add feature bits or make the mount features field setup code simpler.
--- fs/xfs/libxfs/xfs_format.h | 155 +------------------------------------ 1 file changed, 3 insertions(+), 152 deletions(-)
fs/xfs/libxfs/xfs_format.h +3 -152
@@ -279,11 +279,6 @@ typedef struct xfs_dsb {#define XFS_SB_VERSION_NUM (sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) -static inline bool xfs_sb_version_hasrealtime (struct xfs_sb *sbp) -{ -return sbp->sb_rblocks >0 ; -} -/* * Detect a mismatched features2 field. Older kernels read/wrote * this into the wrong slot, so to be safe we keep them in sync.
@@ -293,9 +288,10 @@ static inline bool xfs_sb_has_mismatched_features2(struct xfs_sb *sbp)return sbp->sb_bad_features2 != sbp->sb_features2; } -static inline bool xfs_sb_version_hasattr (struct xfs_sb *sbp) +static inline bool xfs_sb_version_hasmorebits (struct xfs_sb *sbp) { -return (sbp->sb_versionnum &XFS_SB_VERSION_ATTRBIT ); +return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 || + (sbp->sb_versionnum &XFS_SB_VERSION_MOREBITSBIT ); }static inline void xfs_sb_version_addattr (struct xfs_sb *sbp)
@@ -303,79 +299,17 @@ static inline void xfs_sb_version_addattr(struct xfs_sb *sbp) sbp->sb_versionnum |=XFS_SB_VERSION_ATTRBIT ; } -static inline bool xfs_sb_version_hasquota (struct xfs_sb *sbp) -{ -return (sbp->sb_versionnum &XFS_SB_VERSION_QUOTABIT ); -} -static inline void xfs_sb_version_addquota (struct xfs_sb *sbp) { sbp->sb_versionnum |=XFS_SB_VERSION_QUOTABIT ; } -static inline bool xfs_sb_version_hasalign (struct xfs_sb *sbp) -{ -return (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 || - (sbp->sb_versionnum &XFS_SB_VERSION_ALIGNBIT )); -} - -static inline bool xfs_sb_version_hasdalign (struct xfs_sb *sbp) -{ -return (sbp->sb_versionnum &XFS_SB_VERSION_DALIGNBIT ); -} - -static inline bool xfs_sb_version_haslogv2 (struct xfs_sb *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 || - (sbp->sb_versionnum &XFS_SB_VERSION_LOGV2BIT ); -} - -static inline bool xfs_sb_version_hassector (struct xfs_sb *sbp) -{ -return (sbp->sb_versionnum &XFS_SB_VERSION_SECTORBIT ); -} - -static inline bool xfs_sb_version_hasasciici (struct xfs_sb *sbp) -{ -return (sbp->sb_versionnum &XFS_SB_VERSION_BORGBIT ); -} - -static inline bool xfs_sb_version_hasmorebits (struct xfs_sb *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 || - (sbp->sb_versionnum &XFS_SB_VERSION_MOREBITSBIT ); -} - -/* -* sb_features2 bit version macros. -*/ -static inline bool xfs_sb_version_haslazysbcount (struct xfs_sb *sbp) -{ -return (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ) || - (xfs_sb_version_hasmorebits (sbp) && - (sbp->sb_features2 &XFS_SB_VERSION2_LAZYSBCOUNTBIT )); -} - -static inline bool xfs_sb_version_hasattr2 (struct xfs_sb *sbp) -{ -return (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ) || - (xfs_sb_version_hasmorebits (sbp) && - (sbp->sb_features2 &XFS_SB_VERSION2_ATTR2BIT )); -} -static inline void xfs_sb_version_addattr2 (struct xfs_sb *sbp) { sbp->sb_versionnum |=XFS_SB_VERSION_MOREBITSBIT ; sbp->sb_features2 |=XFS_SB_VERSION2_ATTR2BIT ; } -static inline bool xfs_sb_version_hasprojid32 (struct xfs_sb *sbp) -{ -return (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ) || - (xfs_sb_version_hasmorebits (sbp) && - (sbp->sb_features2 &XFS_SB_VERSION2_PROJID32BIT )); -} -static inline void xfs_sb_version_addprojid32 (struct xfs_sb *sbp) { sbp->sb_versionnum |=XFS_SB_VERSION_MOREBITSBIT ;
@@ -474,13 +408,6 @@ xfs_sb_add_incompat_log_features( sbp->sb_features_log_incompat |= features; } -/* -* V5 superblock specific feature checks -*/ -static inline bool xfs_sb_version_hascrc (struct xfs_sb *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; -}/* * v5 file systems support V3 inodes only, earlier file systems support
@@ -499,82 +426,6 @@ static inline bool xfs_dinode_good_version(struct xfs_sb *sbp,return version ==1 || version ==2 ; } -static inline bool xfs_sb_version_haspquotino (struct xfs_sb *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; -} - -static inline int xfs_sb_version_hasftype (struct xfs_sb *sbp) -{ -return (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 && -xfs_sb_has_incompat_feature (sbp,XFS_SB_FEAT_INCOMPAT_FTYPE )) || - (xfs_sb_version_hasmorebits (sbp) && - (sbp->sb_features2 &XFS_SB_VERSION2_FTYPE )); -} - -static inline bool xfs_sb_version_hasfinobt (xfs_sb_t *sbp) -{ -return (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ) && - (sbp->sb_features_ro_compat &XFS_SB_FEAT_RO_COMPAT_FINOBT ); -} - -static inline bool xfs_sb_version_hassparseinodes (struct xfs_sb *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 && -xfs_sb_has_incompat_feature (sbp,XFS_SB_FEAT_INCOMPAT_SPINODES ); -} - -/* -* XFS_SB_FEAT_INCOMPAT_META_UUID indicates that the metadata UUID -* is stored separately from the user-visible UUID; this allows the -* user-visible UUID to be changed on V5 filesystems which have a -* filesystem UUID stamped into every piece of metadata. -*/ -static inline bool xfs_sb_version_hasmetauuid (struct xfs_sb *sbp) -{ -return (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ) && - (sbp->sb_features_incompat &XFS_SB_FEAT_INCOMPAT_META_UUID ); -} - -static inline bool xfs_sb_version_hasrmapbt (struct xfs_sb *sbp) -{ -return (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ) && - (sbp->sb_features_ro_compat &XFS_SB_FEAT_RO_COMPAT_RMAPBT ); -} - -static inline bool xfs_sb_version_hasreflink (struct xfs_sb *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 && - (sbp->sb_features_ro_compat &XFS_SB_FEAT_RO_COMPAT_REFLINK ); -} - -static inline bool xfs_sb_version_hasbigtime (struct xfs_sb *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 && - (sbp->sb_features_incompat &XFS_SB_FEAT_INCOMPAT_BIGTIME ); -} - -/* -* Inode btree block counter. We record the number of inobt and finobt blocks -* in the AGI header so that we can skip the finobt walk at mount time when -* setting up per-AG reservations. -*/ -static inline bool xfs_sb_version_hasinobtcounts (struct xfs_sb *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 && - (sbp->sb_features_ro_compat &XFS_SB_FEAT_RO_COMPAT_INOBTCNT ); -} - -static inline bool xfs_sb_version_needsrepair (struct xfs_sb *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 && - (sbp->sb_features_incompat &XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR ); -} - -/* -* end of superblock version macros -*/ -static inline bool xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) {
Signature · 1 line
2.31.1
PATCH v3 15/16 xfs: introduce xfs_sb_is_v5 helper
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
Rather than open coding XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 checks everywhere, add a simple wrapper to encapsulate this and make the code easier to read.
This allows us to remove the xfs_sb_version_has_v3inode() wrapper which is only used in xfs_format.h now and is just a version number check.
There are a couple of places where we should be checking the mount feature bits rather than the superblock version (e.g. remount), so those are converted to use xfs_has_crc(mp) instead.
--- fs/xfs/libxfs/xfs_format.h | 16 +++++++------- fs/xfs/libxfs/xfs_sb.c | 45 +++++++++++++++++++------------------- fs/xfs/scrub/agheader.c | 2 +- fs/xfs/xfs_log_recover.c | 2 +- fs/xfs/xfs_super.c | 11 +++++----- 5 files changed, 38 insertions(+), 38 deletions(-)
fs/xfs/libxfs/xfs_format.h +8 -8
@@ -279,6 +279,11 @@ typedef struct xfs_dsb {#define XFS_SB_VERSION_NUM (sbp) ((sbp)->sb_versionnum & XFS_SB_VERSION_NUMBITS) +static inline bool xfs_sb_is_v5 (struct xfs_sb *sbp) +{ +return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; +} +/* * Detect a mismatched features2 field. Older kernels read/wrote * this into the wrong slot, so to be safe we keep them in sync.
@@ -290,7 +295,7 @@ static inline bool xfs_sb_has_mismatched_features2(struct xfs_sb *sbp)static inline bool xfs_sb_version_hasmorebits (struct xfs_sb *sbp) { -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 || +return xfs_sb_is_v5 (sbp) || (sbp->sb_versionnum &XFS_SB_VERSION_MOREBITSBIT ); }
@@ -413,15 +418,10 @@ xfs_sb_add_incompat_log_features(* v5 file systems support V3 inodes only, earlier file systems support * v2 and v1 inodes. */ -static inline bool xfs_sb_version_has_v3inode (struct xfs_sb *sbp) -{ -return XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 ; -} -static inline bool xfs_dinode_good_version (struct xfs_sb *sbp,uint8_t version) { -if (xfs_sb_version_has_v3inode (sbp)) +if (xfs_sb_is_v5 (sbp))return version ==3 ;return version ==1 || version ==2 ; }
@@ -893,7 +893,7 @@ enum xfs_dinode_fmt {* Inode size for given fs. */ #define XFS_DINODE_SIZE (sbp) \ - (xfs_sb_version_has_v3inode(sbp) ? \ + (xfs_sb_is_v5(sbp) ? \ sizeof(struct xfs_dinode) : \ offsetof(struct xfs_dinode, di_crc))#define XFS_LITINO (mp) \
fs/xfs/libxfs/xfs_sb.c +23 -22
105 lines not on this page · raw message
fs/xfs/scrub/agheader.c +1 -1
@@ -258,7 +258,7 @@ xchk_superblock(xchk_block_set_corrupt (sc, bp); }else { v2_ok =XFS_SB_VERSION2_OKBITS ; -if (XFS_SB_VERSION_NUM (&mp->m_sb) >=XFS_SB_VERSION_5 ) +if (xfs_sb_is_v5 (&mp->m_sb)) v2_ok |=XFS_SB_VERSION2_CRCBIT ;if (!!(sb->sb_features2 &cpu_to_be32 (~v2_ok)))
fs/xfs/xfs_log_recover.c +1 -1
@@ -3413,7 +3413,7 @@ xlog_recover(* (e.g. unsupported transactions, then simply reject the * attempt at recovery before touching anything. */ -if (XFS_SB_VERSION_NUM (&log->l_mp->m_sb) ==XFS_SB_VERSION_5 && +if (xfs_sb_is_v5 (&log->l_mp->m_sb) &&xfs_sb_has_incompat_log_feature (&log->l_mp->m_sb,XFS_SB_FEAT_INCOMPAT_LOG_UNKNOWN )) { xfs_warn(log->l_mp,
fs/xfs/xfs_super.c +5 -6
@@ -1590,7 +1590,7 @@ xfs_fs_fill_super(set_posix_acl_flag (sb);/* version 5 superblocks support inode version counters. */ -if (XFS_SB_VERSION_NUM (&mp->m_sb) ==XFS_SB_VERSION_5 ) +if (xfs_has_crc (mp)) sb->s_flags |=SB_I_VERSION ;if (xfs_has_dax_always (mp)) {
@@ -1711,7 +1711,7 @@ xfs_remount_rw(return -EINVAL ; } -if (XFS_SB_VERSION_NUM (sbp) ==XFS_SB_VERSION_5 && +if (xfs_sb_is_v5 (sbp) &&xfs_sb_has_ro_compat_feature (sbp,XFS_SB_FEAT_RO_COMPAT_UNKNOWN )) { xfs_warn(mp, "ro->rw transition prohibited on unknown (0x%x) ro-compat filesystem",
@@ -1831,12 +1831,11 @@ xfs_fs_reconfigure( {struct xfs_mount *mp =XFS_M (fc->root->d_sb);struct xfs_mount *new_mp = fc->s_fs_info; -xfs_sb_t *sbp = &mp->m_sb;int flags = fc->sb_flags;int error;/* version 5 superblocks always support version counters. */ -if (XFS_SB_VERSION_NUM (&mp->m_sb) ==XFS_SB_VERSION_5 ) +if (xfs_has_crc (mp)) fc->sb_flags |=SB_I_VERSION ; error =xfs_fs_validate_params (new_mp);
@@ -1848,13 +1847,13 @@ xfs_fs_reconfigure(/* inode32 -> inode64 */ if (xfs_has_small_inums (mp) && !xfs_has_small_inums (new_mp)) { mp->m_features &= ~XFS_FEAT_SMALL_INUMS ; - mp->m_maxagi =xfs_set_inode_alloc (mp, sbp->sb_agcount); + mp->m_maxagi =xfs_set_inode_alloc (mp, mp->m_sb.sb_agcount); }/* inode64 -> inode32 */ if (!xfs_has_small_inums (mp) &&xfs_has_small_inums (new_mp)) { mp->m_features |=XFS_FEAT_SMALL_INUMS ; - mp->m_maxagi =xfs_set_inode_alloc (mp, sbp->sb_agcount); + mp->m_maxagi =xfs_set_inode_alloc (mp, mp->m_sb.sb_agcount); }/* ro -> rw */
Signature · 1 line
2.31.1
PATCH v3 16/16 xfs: kill xfs_sb_version_has_v3inode()
In reply to Dave ChinnerFrom: Dave Chinner <[email protected]>
All callers to xfs_dinode_good_version() and XFS_DINODE_SIZE() in both the kernel and userspace have a xfs_mount structure available which means they can use mount features checks instead looking directly are the superblock.
Convert these functions to take a mount and use a xfs_has_v3inodes() check and move it out of the libxfs/xfs_format.h file as it really doesn't have anything to do with the definition of the on-disk format.
--- fs/xfs/libxfs/xfs_format.h | 18 +++--------------- fs/xfs/libxfs/xfs_ialloc.c | 3 +-- fs/xfs/libxfs/xfs_inode_buf.c | 2 +- fs/xfs/libxfs/xfs_inode_buf.h | 11 ++++++++++- 4 files changed, 15 insertions(+), 19 deletions(-)
fs/xfs/libxfs/xfs_format.h +3 -15
@@ -414,18 +414,6 @@ xfs_sb_add_incompat_log_features( } -/* -* v5 file systems support V3 inodes only, earlier file systems support -* v2 and v1 inodes. -*/ -static inline bool xfs_dinode_good_version (struct xfs_sb *sbp, -uint8_t version) -{ -if (xfs_sb_is_v5 (sbp)) -return version ==3 ; -return version ==1 || version ==2 ; -} -static inline bool xfs_is_quota_inode (struct xfs_sb *sbp,xfs_ino_t ino) {
@@ -892,12 +880,12 @@ enum xfs_dinode_fmt {/* * Inode size for given fs. */ -#define XFS_DINODE_SIZE (sbp) \ - (xfs_sb_is_v5(sbp) ? \ +#define XFS_DINODE_SIZE (mp) \ + (xfs_has_v3inodes(mp) ? \ sizeof(struct xfs_dinode) : \ offsetof(struct xfs_dinode, di_crc))#define XFS_LITINO (mp) \ - ((mp)->m_sb.sb_inodesize - XFS_DINODE_SIZE(&(mp)->m_sb)) + ((mp)->m_sb.sb_inodesize - XFS_DINODE_SIZE(mp))/* * Inode data & attribute fork sizes, per inode.
fs/xfs/libxfs/xfs_ialloc.c +1 -2
@@ -337,7 +337,6 @@ xfs_ialloc_inode_init(xfs_buf_zero (fbuf,0 ,BBTOB (fbuf->b_length));for (i =0 ; i <M_IGEO (mp)->inodes_per_cluster; i++) {int ioffset = i << mp->m_sb.sb_inodelog; -uint isize =XFS_DINODE_SIZE (&mp->m_sb); free =xfs_make_iptr (mp, fbuf, i); free->di_magic =cpu_to_be16 (XFS_DINODE_MAGIC );
@@ -354,7 +353,7 @@ xfs_ialloc_inode_init( }else if (tp) {/* just log the inode core */ xfs_trans_log_buf (tp, fbuf, ioffset, - ioffset + isize -1 ); + ioffset +XFS_DINODE_SIZE (mp) -1 ); } }
fs/xfs/libxfs/xfs_inode_buf.c +1 -1
@@ -58,7 +58,7 @@ xfs_inode_buf_verify( dip =xfs_buf_offset (bp, (i << mp->m_sb.sb_inodelog)); unlinked_ino =be32_to_cpu (dip->di_next_unlinked); di_ok =xfs_verify_magic16 (bp, dip->di_magic) && -xfs_dinode_good_version (&mp->m_sb, dip->di_version) && +xfs_dinode_good_version (mp, dip->di_version) &&xfs_verify_agino_or_null (mp, agno, unlinked_ino);if (unlikely (XFS_TEST_ERROR (!di_ok, mp,XFS_ERRTAG_ITOBP_INOTOBP ))) {
fs/xfs/libxfs/xfs_inode_buf.h +10 -1
@@ -21,7 +21,7 @@ struct xfs_imap {int xfs_imap_to_bp (struct xfs_mount *mp,struct xfs_trans *tp,struct xfs_imap *imap,struct xfs_buf **bpp); -void xfs_dinode_calc_crc (struct xfs_mount *,struct xfs_dinode *); +void xfs_dinode_calc_crc (struct xfs_mount *mp,struct xfs_dinode *dip);void xfs_inode_to_disk (struct xfs_inode *ip,struct xfs_dinode *to,xfs_lsn_t lsn);int xfs_inode_from_disk (struct xfs_inode *ip,struct xfs_dinode *from);
@@ -42,4 +42,13 @@ static inline uint64_t xfs_inode_encode_bigtime(struct timespec64 tv)struct timespec64 xfs_inode_from_disk_ts (struct xfs_dinode *dip,const xfs_timestamp_t ts); +static inline bool +xfs_dinode_good_version (struct xfs_mount *mp,uint8_t version) +{ +if (xfs_has_v3inodes (mp)) +return version ==3 ; +return version ==1 || version ==2 ; +} + +#endif /* __XFS_INODE_BUF_H__ */
Signature · 1 line
2.31.1