Skip to content

Commit 4165994

Browse files
Dave Chinnerdjwong
authored andcommitted
xfs: factor common AIL item deletion code
Factor the common AIL deletion code that does all the wakeups into a helper so we only have one copy of this somewhat tricky code to interface with all the wakeups necessary when the LSN of the log tail changes. Signed-off-by: Dave Chinner <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Allison Collins <[email protected]> Reviewed-by: Brian Foster <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent d59eada commit 4165994

File tree

3 files changed

+30
-34
lines changed

3 files changed

+30
-34
lines changed

fs/xfs/xfs_inode_item.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -742,17 +742,7 @@ xfs_iflush_done(
742742
xfs_clear_li_failed(blip);
743743
}
744744
}
745-
746-
if (mlip_changed) {
747-
if (!XFS_FORCED_SHUTDOWN(ailp->ail_mount))
748-
xlog_assign_tail_lsn_locked(ailp->ail_mount);
749-
if (list_empty(&ailp->ail_head))
750-
wake_up_all(&ailp->ail_empty);
751-
}
752-
spin_unlock(&ailp->ail_lock);
753-
754-
if (mlip_changed)
755-
xfs_log_space_wake(ailp->ail_mount);
745+
xfs_ail_update_finish(ailp, mlip_changed);
756746
}
757747

758748
/*

fs/xfs/xfs_trans_ail.c

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,27 @@ xfs_ail_push_all_sync(
681681
finish_wait(&ailp->ail_empty, &wait);
682682
}
683683

684+
void
685+
xfs_ail_update_finish(
686+
struct xfs_ail *ailp,
687+
bool do_tail_update) __releases(ailp->ail_lock)
688+
{
689+
struct xfs_mount *mp = ailp->ail_mount;
690+
691+
if (!do_tail_update) {
692+
spin_unlock(&ailp->ail_lock);
693+
return;
694+
}
695+
696+
if (!XFS_FORCED_SHUTDOWN(mp))
697+
xlog_assign_tail_lsn_locked(mp);
698+
699+
if (list_empty(&ailp->ail_head))
700+
wake_up_all(&ailp->ail_empty);
701+
spin_unlock(&ailp->ail_lock);
702+
xfs_log_space_wake(mp);
703+
}
704+
684705
/*
685706
* xfs_trans_ail_update - bulk AIL insertion operation.
686707
*
@@ -740,15 +761,7 @@ xfs_trans_ail_update_bulk(
740761
if (!list_empty(&tmp))
741762
xfs_ail_splice(ailp, cur, &tmp, lsn);
742763

743-
if (mlip_changed) {
744-
if (!XFS_FORCED_SHUTDOWN(ailp->ail_mount))
745-
xlog_assign_tail_lsn_locked(ailp->ail_mount);
746-
spin_unlock(&ailp->ail_lock);
747-
748-
xfs_log_space_wake(ailp->ail_mount);
749-
} else {
750-
spin_unlock(&ailp->ail_lock);
751-
}
764+
xfs_ail_update_finish(ailp, mlip_changed);
752765
}
753766

754767
bool
@@ -792,10 +805,10 @@ void
792805
xfs_trans_ail_delete(
793806
struct xfs_ail *ailp,
794807
struct xfs_log_item *lip,
795-
int shutdown_type) __releases(ailp->ail_lock)
808+
int shutdown_type)
796809
{
797810
struct xfs_mount *mp = ailp->ail_mount;
798-
bool mlip_changed;
811+
bool need_update;
799812

800813
if (!test_bit(XFS_LI_IN_AIL, &lip->li_flags)) {
801814
spin_unlock(&ailp->ail_lock);
@@ -808,17 +821,8 @@ xfs_trans_ail_delete(
808821
return;
809822
}
810823

811-
mlip_changed = xfs_ail_delete_one(ailp, lip);
812-
if (mlip_changed) {
813-
if (!XFS_FORCED_SHUTDOWN(mp))
814-
xlog_assign_tail_lsn_locked(mp);
815-
if (list_empty(&ailp->ail_head))
816-
wake_up_all(&ailp->ail_empty);
817-
}
818-
819-
spin_unlock(&ailp->ail_lock);
820-
if (mlip_changed)
821-
xfs_log_space_wake(ailp->ail_mount);
824+
need_update = xfs_ail_delete_one(ailp, lip);
825+
xfs_ail_update_finish(ailp, need_update);
822826
}
823827

824828
int

fs/xfs/xfs_trans_priv.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,10 @@ xfs_trans_ail_update(
9292
}
9393

9494
bool xfs_ail_delete_one(struct xfs_ail *ailp, struct xfs_log_item *lip);
95+
void xfs_ail_update_finish(struct xfs_ail *ailp, bool do_tail_update)
96+
__releases(ailp->ail_lock);
9597
void xfs_trans_ail_delete(struct xfs_ail *ailp, struct xfs_log_item *lip,
96-
int shutdown_type) __releases(ailp->ail_lock);
98+
int shutdown_type);
9799

98100
static inline void
99101
xfs_trans_ail_remove(

0 commit comments

Comments
 (0)