aboutsummaryrefslogtreecommitdiffstats
diff options
authorCarlos Maiolino <cem@kernel.org>2025-01-31 14:39:33 +0100
committerCarlos Maiolino <cem@kernel.org>2025-02-05 14:33:14 +0100
commitef9169b63f4761314d17b71370ab7e61e2f2acc1 (patch)
tree4f512e06d3dfa36a0a8736799112313b4c03616b
parent100fe4705ca2b8c1720b19adfcfe9b90e1c06f5b (diff)
downloadxfs-linux-multithreaded_ail.tar.gz
Remove xfs_extent_busy owner fieldmultithreaded_ail
Now that xfs_busy_extents is not embedded in the cil context anymore, the owner field is unnecessary. The struct will be freed upon a call to xfs_discard_extents(), whether at io completion or by direct calling xf_discard_endio_work() in case of failure. What remains is xlog_cil_committed now be responsible for freeing the cil context itself. Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
-rw-r--r--fs/xfs/xfs_discard.c4
-rw-r--r--fs/xfs/xfs_extent_busy.h7
-rw-r--r--fs/xfs/xfs_log_cil.c22
3 files changed, 14 insertions, 19 deletions
diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
index 88f82eeda70e2b..decfffcc4009fc 100644
--- a/fs/xfs/xfs_discard.c
+++ b/fs/xfs/xfs_discard.c
@@ -85,7 +85,7 @@ xfs_discard_endio_work(
container_of(work, struct xfs_busy_extents, endio_work);
xfs_extent_busy_clear(&extents->extent_list, false);
- kfree(extents->owner);
+ kfree(extents);
}
/*
@@ -367,7 +367,6 @@ xfs_trim_perag_extents(
error = -ENOMEM;
break;
}
- extents->owner = extents;
error = xfs_trim_gather_extents(pag, &tcur, extents);
if (error) {
@@ -714,7 +713,6 @@ xfs_trim_rtgroup_extents(
break;
}
- tr.extents->owner = tr.extents;
tr.queued = 0;
tr.batch = XFS_DISCARD_MAX_EXAMINE;
diff --git a/fs/xfs/xfs_extent_busy.h b/fs/xfs/xfs_extent_busy.h
index c164f08985c480..181a04c42d7a14 100644
--- a/fs/xfs/xfs_extent_busy.h
+++ b/fs/xfs/xfs_extent_busy.h
@@ -34,13 +34,6 @@ struct xfs_extent_busy {
struct xfs_busy_extents {
struct list_head extent_list;
struct work_struct endio_work;
-
- /*
- * Owner is the object containing the struct xfs_busy_extents to free
- * once the busy extents have been processed. If only the
- * xfs_busy_extents object needs freeing, then point this at itself.
- */
- void *owner;
};
static inline struct xfs_busy_extents*
diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
index 7dce152b5f286b..926c0c34fd0708 100644
--- a/fs/xfs/xfs_log_cil.c
+++ b/fs/xfs/xfs_log_cil.c
@@ -887,6 +887,16 @@ xlog_cil_committed(
{
struct xfs_mount *mp = ctx->cil->xc_log->l_mp;
bool abort = xlog_is_shutdown(ctx->cil->xc_log);
+ struct xfs_busy_extents *extents = ctx->busy_extents;
+
+
+ /*
+ * XXX: Nothing else should be referencing ctx->busy_extents.
+ * Poison the list pointer here for testing purposes.
+ *
+ * This comment and the poison below shall be removed.
+ */
+ ctx->busy_extents = (void *)0xDEADBEEF;
/*
* If the I/O failed, we're aborting the commit and already shutdown.
@@ -904,8 +914,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(&extents->extent_list);
+ xfs_extent_busy_clear(&extents->extent_list,
xfs_has_discard(mp) && !abort);
spin_lock(&ctx->cil->xc_push_lock);
@@ -913,14 +923,8 @@ xlog_cil_committed(
spin_unlock(&ctx->cil->xc_push_lock);
xlog_cil_free_logvec(&ctx->lv_chain);
+ xfs_discard_extents(mp, 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);
}