[17/19] xfs: hoist the ail unlock/lock cycle when cancelling intents during recovery
diff mbox series

Message ID 158752127272.2140829.17836221324265747282.stgit@magnolia
State New
Headers show
Series
  • xfs: refactor log recovery
Related show

Commit Message

Darrick J. Wong April 22, 2020, 2:07 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

Move the spin_unlock/spin_lock of the ail lock up to
xlog_recover_cancel_intents so that the individual ->cancel_intent
functions don't have to do that anymore.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/libxfs/xfs_log_recover.h |    3 +--
 fs/xfs/xfs_bmap_item.c          |    8 +-------
 fs/xfs/xfs_extfree_item.c       |    8 +-------
 fs/xfs/xfs_log_recover.c        |    4 +++-
 fs/xfs/xfs_refcount_item.c      |    8 +-------
 fs/xfs/xfs_rmap_item.c          |    8 +-------
 6 files changed, 8 insertions(+), 31 deletions(-)

Comments

Christoph Hellwig April 25, 2020, 6:35 p.m. UTC | #1
On Tue, Apr 21, 2020 at 07:07:52PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Move the spin_unlock/spin_lock of the ail lock up to
> xlog_recover_cancel_intents so that the individual ->cancel_intent
> functions don't have to do that anymore.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

Patch
diff mbox series

diff --git a/fs/xfs/libxfs/xfs_log_recover.h b/fs/xfs/libxfs/xfs_log_recover.h
index 8cb38d8327ce..5c37940386d6 100644
--- a/fs/xfs/libxfs/xfs_log_recover.h
+++ b/fs/xfs/libxfs/xfs_log_recover.h
@@ -132,8 +132,7 @@  typedef int (*xlog_recover_done_fn)(struct xlog *xlog,
 		struct xlog_recover_item *item);
 typedef int (*xlog_recover_process_intent_fn)(struct xlog *log,
 		struct xfs_trans *tp, struct xfs_log_item *lip);
-typedef void (*xlog_recover_cancel_intent_fn)(struct xlog *log,
-		struct xfs_log_item *lip);
+typedef void (*xlog_recover_cancel_intent_fn)(struct xfs_log_item *lip);
 
 struct xlog_recover_intent_type {
 	/*
diff --git a/fs/xfs/xfs_bmap_item.c b/fs/xfs/xfs_bmap_item.c
index df8155dfcc87..53160172c36b 100644
--- a/fs/xfs/xfs_bmap_item.c
+++ b/fs/xfs/xfs_bmap_item.c
@@ -701,15 +701,9 @@  xlog_recover_process_bui(
 /* Release the BUI since we're cancelling everything. */
 STATIC void
 xlog_recover_cancel_bui(
-	struct xlog			*log,
 	struct xfs_log_item		*lip)
 {
-	struct xfs_ail			*ailp = log->l_ailp;
-	struct xfs_bui_log_item		*buip = BUI_ITEM(lip);
-
-	spin_unlock(&ailp->ail_lock);
-	xfs_bui_release(buip);
-	spin_lock(&ailp->ail_lock);
+	xfs_bui_release(BUI_ITEM(lip));
 }
 
 const struct xlog_recover_intent_type xlog_recover_bmap_type = {
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index 3af9e37892f1..a15ede29244a 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -762,15 +762,9 @@  xlog_recover_process_efi(
 /* Release the EFI since we're cancelling everything. */
 STATIC void
 xlog_recover_cancel_efi(
-	struct xlog			*log,
 	struct xfs_log_item		*lip)
 {
-	struct xfs_ail			*ailp = log->l_ailp;
-	struct xfs_efi_log_item		*efip = EFI_ITEM(lip);
-
-	spin_unlock(&ailp->ail_lock);
-	xfs_efi_release(efip);
-	spin_lock(&ailp->ail_lock);
+	xfs_efi_release(EFI_ITEM(lip));
 }
 
 const struct xlog_recover_intent_type xlog_recover_extfree_type = {
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 913eb9101110..51a7d4b963cd 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2824,7 +2824,9 @@  xlog_recover_cancel_intents(
 			break;
 		}
 
-		type->cancel_intent(log, lip);
+		spin_unlock(&ailp->ail_lock);
+		type->cancel_intent(lip);
+		spin_lock(&ailp->ail_lock);
 		lip = xfs_trans_ail_cursor_next(ailp, &cur);
 	}
 
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index ab786739ff7c..01a393727a1e 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -724,15 +724,9 @@  xlog_recover_process_cui(
 /* Release the CUI since we're cancelling everything. */
 STATIC void
 xlog_recover_cancel_cui(
-	struct xlog			*log,
 	struct xfs_log_item		*lip)
 {
-	struct xfs_ail			*ailp = log->l_ailp;
-	struct xfs_cui_log_item		*cuip = CUI_ITEM(lip);
-
-	spin_unlock(&ailp->ail_lock);
-	xfs_cui_release(cuip);
-	spin_lock(&ailp->ail_lock);
+	xfs_cui_release(CUI_ITEM(lip));
 }
 
 const struct xlog_recover_intent_type xlog_recover_refcount_type = {
diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c
index a83f86915c40..69a2d23eedda 100644
--- a/fs/xfs/xfs_rmap_item.c
+++ b/fs/xfs/xfs_rmap_item.c
@@ -714,15 +714,9 @@  xlog_recover_process_rui(
 /* Release the RUI since we're cancelling everything. */
 STATIC void
 xlog_recover_cancel_rui(
-	struct xlog			*log,
 	struct xfs_log_item		*lip)
 {
-	struct xfs_ail			*ailp = log->l_ailp;
-	struct xfs_rui_log_item		*ruip = RUI_ITEM(lip);
-
-	spin_unlock(&ailp->ail_lock);
-	xfs_rui_release(ruip);
-	spin_lock(&ailp->ail_lock);
+	xfs_rui_release(RUI_ITEM(lip));
 }
 
 const struct xlog_recover_intent_type xlog_recover_rmap_type = {