summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_log.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2021-06-28 18:23:19 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-07-02 16:07:53 -0700
commitca73408d652845caee55e25dd420fa29dfc2cd6c (patch)
tree54481bb4852f46e564d8ea1e9c3b9742255c1fc9 /fs/xfs/xfs_log.c
parent41b1fe81692d289d21ff9d8b24f362b31bfd372c (diff)
xfs: remove callback dequeue loop from xlog_state_do_iclog_callbacks
If we are processing callbacks on an iclog, nothing can be concurrently adding callbacks to the loop. We only add callbacks to the iclog when they are in ACTIVE or WANT_SYNC state, and we explicitly do not add callbacks if the iclog is already in IOERROR state. The only way to have a dequeue racing with an enqueue is to be processing a shutdown without a direct reference to an iclog in ACTIVE or WANT_SYNC state. As the enqueue avoids this race condition, we only ever need a single dequeue operation in xlog_state_do_iclog_callbacks(). Hence we can remove the loop. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r--fs/xfs/xfs_log.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index bb4390942275..05b00fa4d661 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -2774,19 +2774,15 @@ xlog_state_do_iclog_callbacks(
struct xlog *log,
struct xlog_in_core *iclog)
{
- trace_xlog_iclog_callbacks_start(iclog, _RET_IP_);
- spin_lock(&iclog->ic_callback_lock);
- while (!list_empty(&iclog->ic_callbacks)) {
- LIST_HEAD(tmp);
+ LIST_HEAD(tmp);
- list_splice_init(&iclog->ic_callbacks, &tmp);
-
- spin_unlock(&iclog->ic_callback_lock);
- xlog_cil_process_committed(&tmp);
- spin_lock(&iclog->ic_callback_lock);
- }
+ trace_xlog_iclog_callbacks_start(iclog, _RET_IP_);
+ spin_lock(&iclog->ic_callback_lock);
+ list_splice_init(&iclog->ic_callbacks, &tmp);
spin_unlock(&iclog->ic_callback_lock);
+
+ xlog_cil_process_committed(&tmp);
trace_xlog_iclog_callbacks_done(iclog, _RET_IP_);
}