Commit 2a2c05d0 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: use helpers to extract xattr op from opflags

Create helper functions to extract the xattr op from the ondisk xattri
log item and the incore attr intent item.  These will get more use in
the patches that follow.
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 992c3b5c
......@@ -529,6 +529,11 @@ struct xfs_attr_intent {
struct xfs_bmbt_irec xattri_map;
};
static inline unsigned int
xfs_attr_intent_op(const struct xfs_attr_intent *attr)
{
return attr->xattri_op_flags & XFS_ATTRI_OP_FLAGS_TYPE_MASK;
}
/*========================================================================
* Function prototypes for the kernel.
......
......@@ -308,6 +308,12 @@ xfs_attrd_item_intent(
return &ATTRD_ITEM(lip)->attrd_attrip->attri_item;
}
static inline unsigned int
xfs_attr_log_item_op(const struct xfs_attri_log_format *attrp)
{
return attrp->alfi_op_flags & XFS_ATTRI_OP_FLAGS_TYPE_MASK;
}
/* Log an attr to the intent item. */
STATIC void
xfs_attr_log_item(
......@@ -466,8 +472,7 @@ xfs_attri_validate(
struct xfs_mount *mp,
struct xfs_attri_log_format *attrp)
{
unsigned int op = attrp->alfi_op_flags &
XFS_ATTRI_OP_FLAGS_TYPE_MASK;
unsigned int op = xfs_attr_log_item_op(attrp);
if (!xfs_is_using_logged_xattrs(mp))
return false;
......@@ -551,8 +556,7 @@ xfs_attri_recover_work(
args = (struct xfs_da_args *)(attr + 1);
attr->xattri_da_args = args;
attr->xattri_op_flags = attrp->alfi_op_flags &
XFS_ATTRI_OP_FLAGS_TYPE_MASK;
attr->xattri_op_flags = xfs_attr_log_item_op(attrp);
/*
* We're reconstructing the deferred work state structure from the
......@@ -573,7 +577,7 @@ xfs_attri_recover_work(
XFS_DA_OP_LOGGED;
args->owner = args->dp->i_ino;
switch (attr->xattri_op_flags) {
switch (xfs_attr_intent_op(attr)) {
case XFS_ATTRI_OP_FLAGS_SET:
case XFS_ATTRI_OP_FLAGS_REPLACE:
args->value = nv->value.i_addr;
......@@ -757,7 +761,7 @@ xlog_recover_attri_commit_pass2(
}
/* Check the number of log iovecs makes sense for the op code. */
op = attri_formatp->alfi_op_flags & XFS_ATTRI_OP_FLAGS_TYPE_MASK;
op = xfs_attr_log_item_op(attri_formatp);
switch (op) {
case XFS_ATTRI_OP_FLAGS_SET:
case XFS_ATTRI_OP_FLAGS_REPLACE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment