From: Dave Chinner <david@fromorbit.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 2/8] xfs: don't commit the first deferred transaction without intents
Date: Wed, 27 Apr 2022 12:22:53 +1000 [thread overview]
Message-ID: <20220427022259.695399-3-david@fromorbit.com> (raw)
In-Reply-To: <20220427022259.695399-1-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
If the first operation in a string of defer ops has no intents,
then there is no reason to commit it before running the first call
to xfs_defer_finish_one(). This allows the defer ops to be used
effectively for non-intent based operations without requiring an
unnecessary extra transaction commit when first called.
This fixes a regression in per-attribute modification transaction
count when delayed attributes are not being used.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
fs/xfs/libxfs/xfs_defer.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
index 0805ade2d300..66b4555bda8e 100644
--- a/fs/xfs/libxfs/xfs_defer.c
+++ b/fs/xfs/libxfs/xfs_defer.c
@@ -186,7 +186,7 @@ static const struct xfs_defer_op_type *defer_op_types[] = {
[XFS_DEFER_OPS_TYPE_AGFL_FREE] = &xfs_agfl_free_defer_type,
};
-static void
+static bool
xfs_defer_create_intent(
struct xfs_trans *tp,
struct xfs_defer_pending *dfp,
@@ -197,6 +197,7 @@ xfs_defer_create_intent(
if (!dfp->dfp_intent)
dfp->dfp_intent = ops->create_intent(tp, &dfp->dfp_work,
dfp->dfp_count, sort);
+ return dfp->dfp_intent;
}
/*
@@ -204,16 +205,18 @@ xfs_defer_create_intent(
* associated extents, then add the entire intake list to the end of
* the pending list.
*/
-STATIC void
+static bool
xfs_defer_create_intents(
struct xfs_trans *tp)
{
struct xfs_defer_pending *dfp;
+ bool ret = false;
list_for_each_entry(dfp, &tp->t_dfops, dfp_list) {
trace_xfs_defer_create_intent(tp->t_mountp, dfp);
- xfs_defer_create_intent(tp, dfp, true);
+ ret |= xfs_defer_create_intent(tp, dfp, true);
}
+ return ret;
}
/* Abort all the intents that were committed. */
@@ -487,7 +490,7 @@ int
xfs_defer_finish_noroll(
struct xfs_trans **tp)
{
- struct xfs_defer_pending *dfp;
+ struct xfs_defer_pending *dfp = NULL;
int error = 0;
LIST_HEAD(dop_pending);
@@ -506,17 +509,19 @@ xfs_defer_finish_noroll(
* of time that any one intent item can stick around in memory,
* pinning the log tail.
*/
- xfs_defer_create_intents(*tp);
+ bool has_intents = xfs_defer_create_intents(*tp);
list_splice_init(&(*tp)->t_dfops, &dop_pending);
- error = xfs_defer_trans_roll(tp);
- if (error)
- goto out_shutdown;
+ if (has_intents || dfp) {
+ error = xfs_defer_trans_roll(tp);
+ if (error)
+ goto out_shutdown;
- /* Possibly relog intent items to keep the log moving. */
- error = xfs_defer_relog(tp, &dop_pending);
- if (error)
- goto out_shutdown;
+ /* Possibly relog intent items to keep the log moving. */
+ error = xfs_defer_relog(tp, &dop_pending);
+ if (error)
+ goto out_shutdown;
+ }
dfp = list_first_entry(&dop_pending, struct xfs_defer_pending,
dfp_list);
--
2.35.1
next prev parent reply other threads:[~2022-04-27 2:23 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 2:22 [PATCH 0/8 v5] xfs: intent whiteouts Dave Chinner
2022-04-27 2:22 ` [PATCH 1/8] xfs: hide log iovec alignment constraints Dave Chinner
2022-04-27 3:14 ` Darrick J. Wong
2022-04-27 4:50 ` Dave Chinner
2022-04-27 16:45 ` Darrick J. Wong
2022-04-28 13:00 ` Christoph Hellwig
2022-04-27 2:22 ` Dave Chinner [this message]
2022-04-27 3:03 ` [PATCH 2/8] xfs: don't commit the first deferred transaction without intents Darrick J. Wong
2022-04-27 4:52 ` Dave Chinner
2022-04-28 13:02 ` Christoph Hellwig
2022-04-30 17:02 ` Alli
2022-04-27 2:22 ` [PATCH 3/8] xfs: add log item flags to indicate intents Dave Chinner
2022-04-27 3:04 ` Darrick J. Wong
2022-04-28 13:04 ` Christoph Hellwig
2022-04-27 2:22 ` [PATCH 4/8] xfs: tag transactions that contain intent done items Dave Chinner
2022-04-27 3:06 ` Darrick J. Wong
2022-04-28 13:05 ` Christoph Hellwig
2022-04-27 2:22 ` [PATCH 5/8] xfs: factor and move some code in xfs_log_cil.c Dave Chinner
2022-04-27 3:15 ` Darrick J. Wong
2022-04-27 4:56 ` Dave Chinner
2022-04-28 13:06 ` Christoph Hellwig
2022-04-29 1:56 ` Alli
2022-04-27 2:22 ` [PATCH 6/8] xfs: add log item method to return related intents Dave Chinner
2022-04-27 3:18 ` Darrick J. Wong
2022-04-28 13:10 ` Christoph Hellwig
2022-04-27 2:22 ` [PATCH 7/8] xfs: whiteouts release intents that are not in the AIL Dave Chinner
2022-04-27 3:19 ` Darrick J. Wong
2022-04-28 13:15 ` Christoph Hellwig
2022-04-27 2:22 ` [PATCH 8/8] xfs: intent item whiteouts Dave Chinner
2022-04-27 3:32 ` Darrick J. Wong
2022-04-27 5:47 ` Dave Chinner
2022-04-27 17:31 ` Darrick J. Wong
2022-04-27 22:05 ` Dave Chinner
2022-04-28 13:22 ` Christoph Hellwig
2022-04-28 21:38 ` Dave Chinner
-- strict thread matches above, loose matches on Subject: below --
2022-03-14 22:06 [PATCH 0/8 v3] xfs: intent whiteouts Dave Chinner
2022-03-14 22:06 ` [PATCH 2/8] xfs: don't commit the first deferred transaction without intents Dave Chinner
2022-04-11 5:22 ` Alli
2022-04-12 10:21 ` Dave Chinner
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=20220427022259.695399-3-david@fromorbit.com \
--to=david@fromorbit.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox