aboutsummaryrefslogtreecommitdiffstats
diff options
authorCarlos Maiolino <cem@kernel.org>2025-01-29 10:20:40 +0100
committerCarlos Maiolino <cem@kernel.org>2025-02-05 13:46:40 +0100
commit100fe4705ca2b8c1720b19adfcfe9b90e1c06f5b (patch)
tree8161291b1ba7d506c5386875e6d4713a1da5114e
parent479ae68478d9c98436a6e6b8254457df025e03c8 (diff)
downloadxfs-linux-100fe4705ca2b8c1720b19adfcfe9b90e1c06f5b.tar.gz
Turn busy_extents into a pointer within cil context
In order to make the busy extents list independent of the cil context, allocate it independently from the cil. By having its allocation independent, we can now pass the busy_extents list "ownership" to the discard code Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
-rw-r--r--fs/xfs/xfs_log_cil.c16
-rw-r--r--fs/xfs/xfs_log_priv.h2
2 files changed, 10 insertions, 8 deletions
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index 1ca406ec1b40b3..7dce152b5f286b 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -101,8 +101,9 @@ xlog_cil_ctx_alloc(void)
struct xfs_cil_ctx *ctx;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL | __GFP_NOFAIL);
+
+ ctx->busy_extents = xfs_busy_extents_alloc(GFP_KERNEL | __GFP_NOFAIL);
INIT_LIST_HEAD(&ctx->committing);
- INIT_LIST_HEAD(&ctx->busy_extents.extent_list);
INIT_LIST_HEAD(&ctx->log_items);
INIT_LIST_HEAD(&ctx->lv_chain);
INIT_WORK(&ctx->push_work, xlog_cil_push_work);
@@ -131,7 +132,7 @@ xlog_cil_push_pcp_aggregate(
if (!list_empty(&cilpcp->busy_extents)) {
list_splice_init(&cilpcp->busy_extents,
- &ctx->busy_extents.extent_list);
+ &ctx->busy_extents->extent_list);
}
if (!list_empty(&cilpcp->log_items))
list_splice_init(&cilpcp->log_items, &ctx->log_items);
@@ -903,8 +904,8 @@ xlog_cil_committed(
xlog_cil_ail_insert(ctx, abort);
- xfs_extent_busy_sort(&ctx->busy_extents.extent_list);
- xfs_extent_busy_clear(&ctx->busy_extents.extent_list,
+ xfs_extent_busy_sort(&ctx->busy_extents->extent_list);
+ xfs_extent_busy_clear(&ctx->busy_extents->extent_list,
xfs_has_discard(mp) && !abort);
spin_lock(&ctx->cil->xc_push_lock);
@@ -913,12 +914,13 @@ xlog_cil_committed(
xlog_cil_free_logvec(&ctx->lv_chain);
- if (!list_empty(&ctx->busy_extents.extent_list)) {
- ctx->busy_extents.owner = ctx;
- xfs_discard_extents(mp, &ctx->busy_extents);
+ if (!list_empty(&ctx->busy_extents->extent_list)) {
+ ctx->busy_extents->owner = ctx;
+ xfs_discard_extents(mp, ctx->busy_extents);
return;
}
+ kfree(ctx->busy_extents);
kfree(ctx);
}
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index f3d78869e5e5a3..63957d0ed909a9 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -225,7 +225,7 @@ struct xfs_cil_ctx {
struct xlog_in_core *commit_iclog;
struct xlog_ticket *ticket; /* chkpt ticket */
atomic_t space_used; /* aggregate size of regions */
- struct xfs_busy_extents busy_extents;
+ struct xfs_busy_extents *busy_extents;
struct list_head log_items; /* log items in chkpt */
struct list_head lv_chain; /* logvecs being pushed */
struct list_head iclog_entry;