Commit 7146bda7 authored by Dave Chinner's avatar Dave Chinner
Browse files

Merge branch 'guilt/xfs-5.19-larp-cleanups' into xfs-5.19-for-next



This series contains a two key cleanups for the new LARP code.  Most
of it is refactoring and tweaking the code that creates kernel log
messages about enabling and disabling features -- we should be
warning about LARP being turned on once per mount, instead of once
per insmod cycle; we shouldn't be spamming the logs so aggressively
about turning *off* log incompat features.

The second part of the series refactors the LARP code responsible
for getting (and releasing) permission to use xattr log items.  The
implementation code doesn't belong in xfs_log.c, and calls to
logging functions don't belong in libxfs -- they really should be
done by the VFS implementation functions before they start calling
into libraries.

Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parents 621dc801 efc2efeb
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
#include "xfs_trans_space.h"
#include "xfs_trace.h"
#include "xfs_attr_item.h"
#include "xfs_log.h"
#include "xfs_xattr.h"

struct kmem_cache		*xfs_attr_intent_cache;

@@ -982,7 +982,6 @@ xfs_attr_set(
	int			error, local;
	int			rmt_blks = 0;
	unsigned int		total;
	bool			use_logging = xfs_has_larp(mp);

	if (xfs_is_shutdown(dp->i_mount))
		return -EIO;
@@ -1027,12 +1026,6 @@ xfs_attr_set(
		rmt_blks = xfs_attr3_rmt_blocks(mp, XFS_XATTR_SIZE_MAX);
	}

	if (use_logging) {
		error = xfs_attr_use_log_assist(mp);
		if (error)
			return error;
	}

	/*
	 * Root fork attributes can use reserved data blocks for this
	 * operation if necessary
@@ -1040,7 +1033,7 @@ xfs_attr_set(
	xfs_init_attr_trans(args, &tres, &total);
	error = xfs_trans_alloc_inode(dp, &tres, total, 0, rsvd, &args->trans);
	if (error)
		goto drop_incompat;
		return error;

	if (args->value || xfs_inode_hasattr(dp)) {
		error = xfs_iext_count_may_overflow(dp, XFS_ATTR_FORK,
@@ -1100,9 +1093,6 @@ xfs_attr_set(
	error = xfs_trans_commit(args->trans);
out_unlock:
	xfs_iunlock(dp, XFS_ILOCK_EXCL);
drop_incompat:
	if (use_logging)
		xlog_drop_incompat_feat(mp->m_log);
	return error;

out_trans_cancel:
+2 −15
Original line number Diff line number Diff line
@@ -340,20 +340,6 @@ static const struct xchk_meta_ops meta_scrub_ops[] = {
	},
};

/* This isn't a stable feature, warn once per day. */
static inline void
xchk_experimental_warning(
	struct xfs_mount	*mp)
{
	static struct ratelimit_state scrub_warning = RATELIMIT_STATE_INIT(
			"xchk_warning", 86400 * HZ, 1);
	ratelimit_set_flags(&scrub_warning, RATELIMIT_MSG_ON_RELEASE);

	if (__ratelimit(&scrub_warning))
		xfs_alert(mp,
"EXPERIMENTAL online scrub feature in use. Use at your own risk!");
}

static int
xchk_validate_inputs(
	struct xfs_mount		*mp,
@@ -478,7 +464,8 @@ xfs_scrub_metadata(
	if (error)
		goto out;

	xchk_experimental_warning(mp);
	xfs_warn_mount(mp, XFS_OPSTATE_WARNED_SCRUB,
 "EXPERIMENTAL online scrub feature in use. Use at your own risk!");

	sc = kmem_zalloc(sizeof(struct xfs_scrub), KM_NOFS | KM_MAYFAIL);
	if (!sc) {
+2 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include "xfs_error.h"
#include "xfs_acl.h"
#include "xfs_trans.h"
#include "xfs_xattr.h"

#include <linux/posix_acl_xattr.h>

@@ -202,7 +203,7 @@ __xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
		xfs_acl_to_disk(args.value, acl);
	}

	error = xfs_attr_set(&args);
	error = xfs_attr_change(&args);
	kmem_free(args.value);

	/*
+1 −6
Original line number Diff line number Diff line
@@ -149,12 +149,7 @@ xfs_growfs_data_private(
		error = xfs_resizefs_init_new_ags(tp, &id, oagcount, nagcount,
						  delta, &lastag_extended);
	} else {
		static struct ratelimit_state shrink_warning = \
			RATELIMIT_STATE_INIT("shrink_warning", 86400 * HZ, 1);
		ratelimit_set_flags(&shrink_warning, RATELIMIT_MSG_ON_RELEASE);

		if (__ratelimit(&shrink_warning))
			xfs_alert(mp,
		xfs_warn_mount(mp, XFS_OPSTATE_WARNED_SHRINK,
	"EXPERIMENTAL online shrink feature in use. Use at your own risk!");

		error = xfs_ag_shrink_space(mp, &tp, nagcount - 1, -delta);
+2 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "xfs_health.h"
#include "xfs_reflink.h"
#include "xfs_ioctl.h"
#include "xfs_xattr.h"

#include <linux/mount.h>
#include <linux/namei.h>
@@ -524,7 +525,7 @@ xfs_attrmulti_attr_set(
		args.valuelen = len;
	}

	error = xfs_attr_set(&args);
	error = xfs_attr_change(&args);
	if (!error && (flags & XFS_IOC_ATTR_ROOT))
		xfs_forget_acl(inode, name);
	kfree(args.value);
Loading