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

xfs: remove xfs_da_args.attr_flags



This field only ever contains XATTR_{CREATE,REPLACE}, and it only goes
as deep as xfs_attr_set.  Remove the field from the structure and
replace it with an enum specifying exactly what kind of change we want
to make to the xattr structure.  Upsert is the name that we'll give to
the flags==0 operation, because we're either updating an existing value
or inserting it, and the caller doesn't care.

Note: The "UPSERTR" name created here is to make userspace porting
easier.  It will be removed in the next patch.

Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 779a4b60
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -922,7 +922,8 @@ xfs_attr_defer_add(
 */
int
xfs_attr_set(
	struct xfs_da_args	*args)
	struct xfs_da_args	*args,
	enum xfs_attr_update	op)
{
	struct xfs_inode	*dp = args->dp;
	struct xfs_mount	*mp = dp->i_mount;
@@ -1008,7 +1009,7 @@ xfs_attr_set(
		}

		/* Pure create fails if the attr already exists */
		if (args->attr_flags & XATTR_CREATE)
		if (op == XFS_ATTRUPDATE_CREATE)
			goto out_trans_cancel;
		xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_REPLACE);
		break;
@@ -1018,7 +1019,7 @@ xfs_attr_set(
			goto out_trans_cancel;

		/* Pure replace fails if no existing attr to replace. */
		if (args->attr_flags & XATTR_REPLACE)
		if (op == XFS_ATTRUPDATE_REPLACE)
			goto out_trans_cancel;
		xfs_attr_defer_add(args, XFS_ATTRI_OP_FLAGS_SET);
		break;
+8 −1
Original line number Diff line number Diff line
@@ -544,7 +544,14 @@ int xfs_inode_hasattr(struct xfs_inode *ip);
bool xfs_attr_is_leaf(struct xfs_inode *ip);
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);

enum xfs_attr_update {
	XFS_ATTRUPDATE_UPSERTR,	/* set/remove value, replace any existing attr */
	XFS_ATTRUPDATE_CREATE,	/* set value, fail if attr already exists */
	XFS_ATTRUPDATE_REPLACE,	/* set value, fail if attr does not exist */
};

int xfs_attr_set(struct xfs_da_args *args, enum xfs_attr_update op);
int xfs_attr_set_iter(struct xfs_attr_intent *attr);
int xfs_attr_remove_iter(struct xfs_attr_intent *attr);
bool xfs_attr_namecheck(const void *name, size_t length);
+0 −1
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ typedef struct xfs_da_args {
	void		*value;		/* set of bytes (maybe contain NULLs) */
	int		valuelen;	/* length of value */
	unsigned int	attr_filter;	/* XFS_ATTR_{ROOT,SECURE,INCOMPLETE} */
	unsigned int	attr_flags;	/* XATTR_{CREATE,REPLACE} */
	xfs_dahash_t	hashval;	/* hash value of name */
	xfs_ino_t	inumber;	/* input/output inode number */
	struct xfs_inode *dp;		/* directory inode to manipulate */
+1 −2
Original line number Diff line number Diff line
@@ -557,7 +557,6 @@ xrep_xattr_insert_rec(
	struct xfs_da_args		args = {
		.dp			= rx->sc->tempip,
		.attr_filter		= key->flags,
		.attr_flags		= XATTR_CREATE,
		.namelen		= key->namelen,
		.valuelen		= key->valuelen,
		.owner			= rx->sc->ip->i_ino,
@@ -605,7 +604,7 @@ xrep_xattr_insert_rec(
	 * xfs_attr_set creates and commits its own transaction.  If the attr
	 * already exists, we'll just drop it during the rebuild.
	 */
	error = xfs_attr_set(&args);
	error = xfs_attr_set(&args, XFS_ATTRUPDATE_CREATE);
	if (error == -EEXIST)
		error = 0;

+1 −1
Original line number Diff line number Diff line
@@ -203,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_change(&args);
	error = xfs_attr_change(&args, XFS_ATTRUPDATE_UPSERTR);
	kvfree(args.value);

	/*
Loading