Commit f38dc503 authored by Allison Henderson's avatar Allison Henderson Committed by Dave Chinner

xfs: Skip flip flags for delayed attrs

This is a clean up patch that skips the flip flag logic for delayed attr
renames.  Since the log replay keeps the inode locked, we do not need to
worry about race windows with attr lookups.  So we can skip over
flipping the flag and the extra transaction roll for it
Signed-off-by: default avatarAllison Henderson <allison.henderson@oracle.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChandan Babu R <chandanrlinux@gmail.com>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent 1d08e11d
...@@ -358,6 +358,7 @@ xfs_attr_set_iter( ...@@ -358,6 +358,7 @@ xfs_attr_set_iter(
struct xfs_inode *dp = args->dp; struct xfs_inode *dp = args->dp;
struct xfs_buf *bp = NULL; struct xfs_buf *bp = NULL;
int forkoff, error = 0; int forkoff, error = 0;
struct xfs_mount *mp = args->dp->i_mount;
/* State machine switch */ /* State machine switch */
switch (dac->dela_state) { switch (dac->dela_state) {
...@@ -480,16 +481,21 @@ xfs_attr_set_iter( ...@@ -480,16 +481,21 @@ xfs_attr_set_iter(
* In a separate transaction, set the incomplete flag on the * In a separate transaction, set the incomplete flag on the
* "old" attr and clear the incomplete flag on the "new" attr. * "old" attr and clear the incomplete flag on the "new" attr.
*/ */
if (!xfs_has_larp(mp)) {
error = xfs_attr3_leaf_flipflags(args); error = xfs_attr3_leaf_flipflags(args);
if (error) if (error)
return error; return error;
/* /*
* Commit the flag value change and start the next trans in * Commit the flag value change and start the next trans
* series. * in series.
*/ */
dac->dela_state = XFS_DAS_FLIP_LFLAG; dac->dela_state = XFS_DAS_FLIP_LFLAG;
trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); trace_xfs_attr_set_iter_return(dac->dela_state,
args->dp);
return -EAGAIN; return -EAGAIN;
}
fallthrough;
case XFS_DAS_FLIP_LFLAG: case XFS_DAS_FLIP_LFLAG:
/* /*
* Dismantle the "old" attribute/value pair by removing a * Dismantle the "old" attribute/value pair by removing a
...@@ -592,17 +598,21 @@ xfs_attr_set_iter( ...@@ -592,17 +598,21 @@ xfs_attr_set_iter(
* In a separate transaction, set the incomplete flag on the * In a separate transaction, set the incomplete flag on the
* "old" attr and clear the incomplete flag on the "new" attr. * "old" attr and clear the incomplete flag on the "new" attr.
*/ */
if (!xfs_has_larp(mp)) {
error = xfs_attr3_leaf_flipflags(args); error = xfs_attr3_leaf_flipflags(args);
if (error) if (error)
goto out; goto out;
/* /*
* Commit the flag value change and start the next trans in * Commit the flag value change and start the next trans
* series * in series
*/ */
dac->dela_state = XFS_DAS_FLIP_NFLAG; dac->dela_state = XFS_DAS_FLIP_NFLAG;
trace_xfs_attr_set_iter_return(dac->dela_state, args->dp); trace_xfs_attr_set_iter_return(dac->dela_state,
args->dp);
return -EAGAIN; return -EAGAIN;
}
fallthrough;
case XFS_DAS_FLIP_NFLAG: case XFS_DAS_FLIP_NFLAG:
/* /*
* Dismantle the "old" attribute/value pair by removing a * Dismantle the "old" attribute/value pair by removing a
...@@ -1273,6 +1283,7 @@ xfs_attr_node_addname_clear_incomplete( ...@@ -1273,6 +1283,7 @@ xfs_attr_node_addname_clear_incomplete(
{ {
struct xfs_da_args *args = dac->da_args; struct xfs_da_args *args = dac->da_args;
struct xfs_da_state *state = NULL; struct xfs_da_state *state = NULL;
struct xfs_mount *mp = args->dp->i_mount;
int retval = 0; int retval = 0;
int error = 0; int error = 0;
...@@ -1280,6 +1291,7 @@ xfs_attr_node_addname_clear_incomplete( ...@@ -1280,6 +1291,7 @@ xfs_attr_node_addname_clear_incomplete(
* Re-find the "old" attribute entry after any split ops. The INCOMPLETE * Re-find the "old" attribute entry after any split ops. The INCOMPLETE
* flag means that we will find the "old" attr, not the "new" one. * flag means that we will find the "old" attr, not the "new" one.
*/ */
if (!xfs_has_larp(mp))
args->attr_filter |= XFS_ATTR_INCOMPLETE; args->attr_filter |= XFS_ATTR_INCOMPLETE;
state = xfs_da_state_alloc(args); state = xfs_da_state_alloc(args);
state->inleaf = 0; state->inleaf = 0;
......
...@@ -1487,6 +1487,7 @@ xfs_attr3_leaf_add_work( ...@@ -1487,6 +1487,7 @@ xfs_attr3_leaf_add_work(
if (tmp) if (tmp)
entry->flags |= XFS_ATTR_LOCAL; entry->flags |= XFS_ATTR_LOCAL;
if (args->op_flags & XFS_DA_OP_RENAME) { if (args->op_flags & XFS_DA_OP_RENAME) {
if (!xfs_has_larp(mp))
entry->flags |= XFS_ATTR_INCOMPLETE; entry->flags |= XFS_ATTR_INCOMPLETE;
if ((args->blkno2 == args->blkno) && if ((args->blkno2 == args->blkno) &&
(args->index2 <= args->index)) { (args->index2 <= args->index)) {
......
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