Commit f759784c authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: use an XFS_OPSTATE_ flag for detecting if logged xattrs are available



Per reviewer request, use an OPSTATE flag (+ helpers) to decide if
logged xattrs are enabled, instead of querying the xfs_sb.

Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 8ef1d96a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -469,7 +469,7 @@ xfs_attri_validate(
	unsigned int			op = attrp->alfi_op_flags &
					     XFS_ATTRI_OP_FLAGS_TYPE_MASK;

	if (!xfs_sb_version_haslogxattrs(&mp->m_sb))
	if (!xfs_is_using_logged_xattrs(mp))
		return false;

	if (attrp->__pad != 0)
+16 −0
Original line number Diff line number Diff line
@@ -231,6 +231,13 @@ xfs_readsb(
	mp->m_features |= xfs_sb_version_to_features(sbp);
	xfs_reinit_percpu_counters(mp);

	/*
	 * If logged xattrs are enabled after log recovery finishes, then set
	 * the opstate so that log recovery will work properly.
	 */
	if (xfs_sb_version_haslogxattrs(&mp->m_sb))
		xfs_set_using_logged_xattrs(mp);

	/* no need to be quiet anymore, so reset the buf ops */
	bp->b_ops = &xfs_sb_buf_ops;

@@ -829,6 +836,15 @@ xfs_mountfs(
		goto out_inodegc_shrinker;
	}

	/*
	 * If logged xattrs are still enabled after log recovery finishes, then
	 * they'll be available until unmount.  Otherwise, turn them off.
	 */
	if (xfs_sb_version_haslogxattrs(&mp->m_sb))
		xfs_set_using_logged_xattrs(mp);
	else
		xfs_clear_using_logged_xattrs(mp);

	/* Enable background inode inactivation workers. */
	xfs_inodegc_start(mp);
	xfs_blockgc_start(mp);
+5 −1
Original line number Diff line number Diff line
@@ -444,6 +444,8 @@ __XFS_HAS_FEAT(nouuid, NOUUID)
#define XFS_OPSTATE_QUOTACHECK_RUNNING	10
/* Do we want to clear log incompat flags? */
#define XFS_OPSTATE_UNSET_LOG_INCOMPAT	11
/* Filesystem can use logged extended attributes */
#define XFS_OPSTATE_USE_LARP		12

#define __XFS_IS_OPSTATE(name, NAME) \
static inline bool xfs_is_ ## name (struct xfs_mount *mp) \
@@ -472,6 +474,7 @@ __XFS_IS_OPSTATE(quotacheck_running, QUOTACHECK_RUNNING)
# define xfs_is_quotacheck_running(mp)	(false)
#endif
__XFS_IS_OPSTATE(done_with_log_incompat, UNSET_LOG_INCOMPAT)
__XFS_IS_OPSTATE(using_logged_xattrs, USE_LARP)

static inline bool
xfs_should_warn(struct xfs_mount *mp, long nr)
@@ -491,7 +494,8 @@ xfs_should_warn(struct xfs_mount *mp, long nr)
	{ (1UL << XFS_OPSTATE_WARNED_SHRINK),		"wshrink" }, \
	{ (1UL << XFS_OPSTATE_WARNED_LARP),		"wlarp" }, \
	{ (1UL << XFS_OPSTATE_QUOTACHECK_RUNNING),	"quotacheck" }, \
	{ (1UL << XFS_OPSTATE_UNSET_LOG_INCOMPAT),	"unset_log_incompat" }
	{ (1UL << XFS_OPSTATE_UNSET_LOG_INCOMPAT),	"unset_log_incompat" }, \
	{ (1UL << XFS_OPSTATE_USE_LARP),		"logged_xattrs" }

/*
 * Max and min values for mount-option defined I/O
+2 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ xfs_attr_grab_log_assist(
	int			error = 0;

	/* xattr update log intent items are already enabled */
	if (xfs_sb_version_haslogxattrs(&mp->m_sb))
	if (xfs_is_using_logged_xattrs(mp))
		return 0;

	/*
@@ -48,6 +48,7 @@ xfs_attr_grab_log_assist(
			XFS_SB_FEAT_INCOMPAT_LOG_XATTRS);
	if (error)
		return error;
	xfs_set_using_logged_xattrs(mp);

	xfs_warn_mount(mp, XFS_OPSTATE_WARNED_LARP,
 "EXPERIMENTAL logged extended attributes feature in use. Use at your own risk!");