From: Dave Chinner <david@fromorbit.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 11/14] xfs: move CIL ordering to the logvec chain
Date: Tue, 9 Nov 2021 12:52:37 +1100 [thread overview]
Message-ID: <20211109015240.1547991-12-david@fromorbit.com> (raw)
In-Reply-To: <20211109015240.1547991-1-david@fromorbit.com>
From: Dave Chinner <dchinner@redhat.com>
Adding a list_sort() call to the CIL push work while the xc_ctx_lock
is held exclusively has resulted in fairly long lock hold times and
that stops all front end transaction commits from making progress.
We can move the sorting out of the xc_ctx_lock if we can transfer
the ordering information to the log vectors as they are detached
from the log items and then we can sort the log vectors. With these
changes, we can move the list_sort() call to just before we call
xlog_write() when we aren't holding any locks at all.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/xfs_log.h | 1 +
fs/xfs/xfs_log_cil.c | 23 ++++++++++++++---------
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index 31e8a9f15c32..4f9f0a572ae9 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -10,6 +10,7 @@ struct xfs_cil_ctx;
struct xfs_log_vec {
struct list_head lv_list; /* CIL lv chain ptrs */
+ uint32_t lv_order_id; /* chain ordering info */
int lv_niovecs; /* number of iovecs in lv */
struct xfs_log_iovec *lv_iovecp; /* iovec array */
struct xfs_log_item *lv_item; /* owner */
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index aa3a86ca3d25..84924da6396d 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -989,10 +989,10 @@ xlog_cil_order_cmp(
const struct list_head *a,
const struct list_head *b)
{
- struct xfs_log_item *l1 = container_of(a, struct xfs_log_item, li_cil);
- struct xfs_log_item *l2 = container_of(b, struct xfs_log_item, li_cil);
+ struct xfs_log_vec *l1 = container_of(a, struct xfs_log_vec, lv_list);
+ struct xfs_log_vec *l2 = container_of(b, struct xfs_log_vec, lv_list);
- return l1->li_order_id > l2->li_order_id;
+ return l1->lv_order_id > l2->lv_order_id;
}
/*
@@ -1116,24 +1116,22 @@ xlog_cil_push_work(
xlog_cil_pcp_aggregate(cil, ctx);
- list_sort(NULL, &ctx->log_items, xlog_cil_order_cmp);
while (!list_empty(&ctx->log_items)) {
struct xfs_log_item *item;
item = list_first_entry(&ctx->log_items,
struct xfs_log_item, li_cil);
lv = item->li_lv;
- list_del_init(&item->li_cil);
- item->li_order_id = 0;
- item->li_lv = NULL;
-
+ lv->lv_order_id = item->li_order_id;
num_iovecs += lv->lv_niovecs;
/* we don't write ordered log vectors */
if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED)
num_bytes += lv->lv_bytes;
list_add_tail(&lv->lv_list, &ctx->lv_chain);
-
+ list_del_init(&item->li_cil);
+ item->li_order_id = 0;
+ item->li_lv = NULL;
}
/*
@@ -1166,6 +1164,13 @@ xlog_cil_push_work(
spin_unlock(&cil->xc_push_lock);
up_write(&cil->xc_ctx_lock);
+ /*
+ * Sort the log vector chain before we add the transaction headers.
+ * This ensures we always have the transaction headers at the start
+ * of the chain.
+ */
+ list_sort(NULL, &ctx->lv_chain, xlog_cil_order_cmp);
+
/*
* Build a checkpoint transaction header and write it to the log to
* begin the transaction. We need to account for the space used by the
--
2.33.0
next prev parent reply other threads:[~2021-11-09 1:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 1:52 [PATCH 00/14 v6] xfs: improve CIL scalability Dave Chinner
2021-11-09 1:52 ` [PATCH 01/14] xfs: use the CIL space used counter for emptiness checks Dave Chinner
2021-11-09 1:52 ` [PATCH 02/14] xfs: lift init CIL reservation out of xc_cil_lock Dave Chinner
2021-11-09 1:52 ` [PATCH 03/14] xfs: rework per-iclog header CIL reservation Dave Chinner
2021-11-09 1:52 ` [PATCH 04/14] xfs: introduce per-cpu CIL tracking structure Dave Chinner
2021-11-09 1:52 ` [PATCH 05/14] xfs: implement percpu cil space used calculation Dave Chinner
2021-11-09 1:52 ` [PATCH 06/14] xfs: track CIL ticket reservation in percpu structure Dave Chinner
2021-11-09 1:52 ` [PATCH 07/14] xfs: convert CIL busy extents to per-cpu Dave Chinner
2021-11-09 1:52 ` [PATCH 08/14] xfs: Add order IDs to log items in CIL Dave Chinner
2021-11-09 1:52 ` [PATCH 09/14] xfs: convert CIL to unordered per cpu lists Dave Chinner
2021-11-09 1:52 ` [PATCH 10/14] xfs: convert log vector chain to use list heads Dave Chinner
2021-11-09 1:52 ` Dave Chinner [this message]
2021-11-09 1:52 ` [PATCH 12/14] xfs: avoid cil push lock if possible Dave Chinner
2021-11-09 1:52 ` [PATCH 13/14] xfs: xlog_sync() manually adjusts grant head space Dave Chinner
2021-11-09 1:52 ` [PATCH 14/14] xfs: expanding delayed logging design with background material Dave Chinner
2021-11-18 23:15 ` [PATCH 00/14 v6] xfs: improve CIL scalability Dave Chinner
-- strict thread matches above, loose matches on Subject: below --
2022-06-15 7:53 [PATCH 00/14 v8] " Dave Chinner
2022-06-15 7:53 ` [PATCH 11/14] xfs: move CIL ordering to the logvec chain 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=20211109015240.1547991-12-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