All of lore.kernel.org
 help / color / mirror / Atom feed
From: Allison Henderson <allison.henderson@oracle.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH v14 09/14] xfsprogs: Skip flip flags for delayed attrs
Date: Fri, 18 Dec 2020 00:25:50 -0700	[thread overview]
Message-ID: <20201218072555.16694-10-allison.henderson@oracle.com> (raw)
In-Reply-To: <20201218072555.16694-1-allison.henderson@oracle.com>

Source kernel commit: 2b1c81a8c3f453ba16b6db8dae256723bf53c051

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: Allison Henderson <allison.henderson@oracle.com>
---
 libxfs/xfs_attr.c      | 43 ++++++++++++++++++++++++-------------------
 libxfs/xfs_attr_leaf.c |  3 ++-
 2 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c
index a3f256f..955e434 100644
--- a/libxfs/xfs_attr.c
+++ b/libxfs/xfs_attr.c
@@ -805,6 +805,7 @@ xfs_attr_leaf_addname(
 	struct xfs_buf			*bp = NULL;
 	int				error, forkoff;
 	struct xfs_inode		*dp = args->dp;
+	struct xfs_mount		*mp = args->dp->i_mount;
 
 	/* State machine switch */
 	switch (dac->dela_state) {
@@ -870,15 +871,17 @@ xfs_attr_leaf_addname(
 	 * In a separate transaction, set the incomplete flag on the "old" attr
 	 * and clear the incomplete flag on the "new" attr.
 	 */
-	error = xfs_attr3_leaf_flipflags(args);
-	if (error)
-		return error;
-	/*
-	 * Commit the flag value change and start the next trans in series.
-	 */
-	dac->dela_state = XFS_DAS_FLIP_LFLAG;
-	trace_xfs_das_state_return(dac->dela_state);
-	return -EAGAIN;
+	if (!xfs_hasdelattr(mp)) {
+		error = xfs_attr3_leaf_flipflags(args);
+		if (error)
+			return error;
+		/*
+		 * Commit the flag value change and start the next trans in series.
+		 */
+		dac->dela_state = XFS_DAS_FLIP_LFLAG;
+		trace_xfs_das_state_return(dac->dela_state);
+		return -EAGAIN;
+	}
 das_flip_flag:
 	/*
 	 * Dismantle the "old" attribute/value pair by removing a "remote" value
@@ -1077,6 +1080,7 @@ xfs_attr_node_addname(
 	struct xfs_da_state_blk		*blk;
 	int				retval = 0;
 	int				error = 0;
+	struct xfs_mount		*mp = args->dp->i_mount;
 
 	trace_xfs_attr_node_addname(args);
 
@@ -1238,15 +1242,17 @@ das_alloc_node:
 	 * In a separate transaction, set the incomplete flag on the "old" attr
 	 * and clear the incomplete flag on the "new" attr.
 	 */
-	error = xfs_attr3_leaf_flipflags(args);
-	if (error)
-		goto out;
-	/*
-	 * Commit the flag value change and start the next trans in series
-	 */
-	dac->dela_state = XFS_DAS_FLIP_NFLAG;
-	trace_xfs_das_state_return(dac->dela_state);
-	return -EAGAIN;
+	if (!xfs_hasdelattr(mp)) {
+		error = xfs_attr3_leaf_flipflags(args);
+		if (error)
+			goto out;
+		/*
+		 * Commit the flag value change and start the next trans in series
+		 */
+		dac->dela_state = XFS_DAS_FLIP_NFLAG;
+		trace_xfs_das_state_return(dac->dela_state);
+		return -EAGAIN;
+	}
 das_flip_flag:
 	/*
 	 * Dismantle the "old" attribute/value pair by removing a "remote" value
@@ -1275,7 +1281,6 @@ das_rm_nblk:
 	 * 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.
 	 */
-	args->attr_filter |= XFS_ATTR_INCOMPLETE;
 	state = xfs_da_state_alloc(args);
 	state->inleaf = 0;
 	error = xfs_da3_node_lookup_int(state, &retval);
diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c
index 2c7aa6b..9837bd5 100644
--- a/libxfs/xfs_attr_leaf.c
+++ b/libxfs/xfs_attr_leaf.c
@@ -1483,7 +1483,8 @@ xfs_attr3_leaf_add_work(
 	if (tmp)
 		entry->flags |= XFS_ATTR_LOCAL;
 	if (args->op_flags & XFS_DA_OP_RENAME) {
-		entry->flags |= XFS_ATTR_INCOMPLETE;
+		if (!xfs_hasdelattr(mp))
+			entry->flags |= XFS_ATTR_INCOMPLETE;
 		if ((args->blkno2 == args->blkno) &&
 		    (args->index2 <= args->index)) {
 			args->index2++;
-- 
2.7.4


  parent reply	other threads:[~2020-12-18  7:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18  7:25 [PATCH v14 00/14] xfsprogs: Delayed Attributes Allison Henderson
2020-12-18  7:25 ` [PATCH v14 01/14] xfsprogs: Add helper xfs_attr_node_remove_step Allison Henderson
2020-12-18  7:25 ` [PATCH v14 02/14] xfsprogs: Add xfs_attr_node_remove_cleanup Allison Henderson
2020-12-18  7:25 ` [PATCH v14 03/14] xfsprogs: Hoist transaction handling in xfs_attr_node_remove_step Allison Henderson
2020-12-18  7:25 ` [PATCH v14 04/14] xfsprogs: Add delay ready attr remove routines Allison Henderson
2020-12-18  7:25 ` [PATCH v14 05/14] xfsprogs: Add delay ready attr set routines Allison Henderson
2020-12-18  7:25 ` [PATCH v14 06/14] xfsprogs: Add state machine tracepoints Allison Henderson
2020-12-18  7:25 ` [PATCH v14 07/14] xfsprogs: Rename __xfs_attr_rmtval_remove Allison Henderson
2020-12-18  7:25 ` [PATCH v14 08/14] xfsprogs: Set up infastructure for deferred attribute operations Allison Henderson
2020-12-18  7:25 ` Allison Henderson [this message]
2020-12-18  7:25 ` [PATCH v14 10/14] xfsprogs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred Allison Henderson
2020-12-18  7:25 ` [PATCH v14 11/14] xfsprogs: Remove unused xfs_attr_*_args Allison Henderson
2020-12-18  7:25 ` [PATCH v14 12/14] xfsprogs: Add delayed attributes error tag Allison Henderson
2020-12-18  7:25 ` [PATCH v14 13/14] xfsprogs: Merge xfs_delattr_context into xfs_attr_item Allison Henderson
2020-12-18  7:25 ` [PATCH v14 14/14] xfsprogs: Add log item printing for ATTRI and ATTRD Allison Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201218072555.16694-10-allison.henderson@oracle.com \
    --to=allison.henderson@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.