summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_attr_item.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2022-05-12 15:12:56 +1000
committerDave Chinner <david@fromorbit.com>2022-05-12 15:12:56 +1000
commit4b9879b19cafa63ae02fef30f678b2179a648d45 (patch)
tree6b145ce957f0eff7a4efb754efe14b043f7d0e92 /fs/xfs/xfs_attr_item.c
parente5d5596a2a1790d8c57938f820aa33e58f90ad0d (diff)
xfs: switch attr remove to xfs_attri_set_iter
Now that xfs_attri_set_iter() has initial states for removing attributes, switch the pure attribute removal code over to using it. This requires attrs being removed to always be marked as INCOMPLETE before we start the removal due to the fact we look up the attr to remove again in xfs_attr_node_remove_attr(). Note: this drops the fillstate/refillstate optimisations from the remove path that avoid having to look up the path again after setting the incomplete flag and removing remote attrs. Restoring that optimisation to this path is future Dave's problem. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_attr_item.c')
-rw-r--r--fs/xfs/xfs_attr_item.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
index 1bf812830a5d..19ceb2d257b7 100644
--- a/fs/xfs/xfs_attr_item.c
+++ b/fs/xfs/xfs_attr_item.c
@@ -303,12 +303,9 @@ xfs_attrd_item_intent(
STATIC int
xfs_xattri_finish_update(
struct xfs_attr_item *attr,
- struct xfs_attrd_log_item *attrdp,
- uint32_t op_flags)
+ struct xfs_attrd_log_item *attrdp)
{
struct xfs_da_args *args = attr->xattri_da_args;
- unsigned int op = op_flags &
- XFS_ATTR_OP_FLAGS_TYPE_MASK;
int error;
if (XFS_TEST_ERROR(false, args->dp->i_mount, XFS_ERRTAG_LARP)) {
@@ -316,22 +313,9 @@ xfs_xattri_finish_update(
goto out;
}
- switch (op) {
- case XFS_ATTR_OP_FLAGS_SET:
- case XFS_ATTR_OP_FLAGS_REPLACE:
- error = xfs_attr_set_iter(attr);
- if (!error && attr->xattri_dela_state != XFS_DAS_DONE)
- error = -EAGAIN;
- break;
- case XFS_ATTR_OP_FLAGS_REMOVE:
- ASSERT(XFS_IFORK_Q(args->dp));
- error = xfs_attr_remove_iter(attr);
- break;
- default:
- error = -EFSCORRUPTED;
- break;
- }
-
+ error = xfs_attr_set_iter(attr);
+ if (!error && attr->xattri_dela_state != XFS_DAS_DONE)
+ error = -EAGAIN;
out:
/*
* Mark the transaction dirty, even on error. This ensures the
@@ -439,8 +423,7 @@ xfs_attr_finish_item(
*/
attr->xattri_da_args->trans = tp;
- error = xfs_xattri_finish_update(attr, done_item,
- attr->xattri_op_flags);
+ error = xfs_xattri_finish_update(attr, done_item);
if (error != -EAGAIN)
kmem_free(attr);
@@ -588,7 +571,7 @@ xfs_attri_item_recover(
attr->xattri_dela_state = xfs_attr_init_add_state(args);
break;
case XFS_ATTR_OP_FLAGS_REMOVE:
- attr->xattri_dela_state = XFS_DAS_UNINIT;
+ attr->xattri_dela_state = xfs_attr_init_remove_state(args);
break;
default:
ASSERT(0);
@@ -607,7 +590,7 @@ xfs_attri_item_recover(
xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, 0);
- ret = xfs_xattri_finish_update(attr, done_item, attrp->alfi_op_flags);
+ ret = xfs_xattri_finish_update(attr, done_item);
if (ret == -EAGAIN) {
/* There's more work to do, so add it to this transaction */
xfs_defer_add(tp, XFS_DEFER_OPS_TYPE_ATTR, &attr->xattri_list);