[07/19] xfs: refactor log recovery intent item dispatch for pass2 commit functions
diff mbox series

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

Commit Message

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

Move the log intent item pass2 commit code into the per-item source code
files and use the dispatch function to call it.  We do these one at a
time because there's a lot of code to move.  No functional changes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 fs/xfs/xfs_log_recover.c |   44 +++++++++++++++++++++++++++++++-------------
 1 file changed, 31 insertions(+), 13 deletions(-)

Comments

Christoph Hellwig April 25, 2020, 6:24 p.m. UTC | #1
On Tue, Apr 21, 2020 at 07:06:48PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Move the log intent item pass2 commit code into the per-item source code
> files and use the dispatch function to call it.  We do these one at a
> time because there's a lot of code to move.  No functional changes.

This commit log doesn't really match what is going on, as no move
beween files happens.  And the changes themselves look pretty odd
as well.
Darrick J. Wong April 28, 2020, 10:42 p.m. UTC | #2
On Sat, Apr 25, 2020 at 11:24:17AM -0700, Christoph Hellwig wrote:
> On Tue, Apr 21, 2020 at 07:06:48PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Move the log intent item pass2 commit code into the per-item source code
> > files and use the dispatch function to call it.  We do these one at a
> > time because there's a lot of code to move.  No functional changes.
> 
> This commit log doesn't really match what is going on, as no move
> beween files happens.  And the changes themselves look pretty odd
> as well.

Yeah.  This patch will look very different once I get rid of
xlog_recover_intent_type.

(Fair warning: I was replying to these two threads in reverse order.)

--D

Patch
diff mbox series

diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 2e4f400d3f6e..2abcca26e4c7 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -1770,8 +1770,13 @@  xlog_clear_stale_blocks(
 
 /* Log intent item dispatching. */
 
+STATIC int xlog_recover_intent_pass2(struct xlog *log,
+		struct list_head *buffer_list, struct xlog_recover_item *item,
+		xfs_lsn_t current_lsn);
+
 const struct xlog_recover_item_type xlog_intent_item_type = {
 	.reorder		= XLOG_REORDER_INODE_LIST,
+	.commit_pass2_fn	= xlog_recover_intent_pass2,
 };
 
 /******************************************************************************
@@ -2693,35 +2698,48 @@  xlog_recover_commit_pass1(
 }
 
 STATIC int
-xlog_recover_commit_pass2(
+xlog_recover_intent_pass2(
 	struct xlog			*log,
-	struct xlog_recover		*trans,
 	struct list_head		*buffer_list,
-	struct xlog_recover_item	*item)
+	struct xlog_recover_item	*item,
+	xfs_lsn_t			current_lsn)
 {
-	trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS2);
-
-	if (item->ri_type && item->ri_type->commit_pass2_fn)
-		return item->ri_type->commit_pass2_fn(log, buffer_list, item,
-				trans->r_lsn);
-
 	switch (ITEM_TYPE(item)) {
 	case XFS_LI_EFI:
-		return xlog_recover_efi_pass2(log, item, trans->r_lsn);
+		return xlog_recover_efi_pass2(log, item, current_lsn);
 	case XFS_LI_EFD:
 		return xlog_recover_efd_pass2(log, item);
 	case XFS_LI_RUI:
-		return xlog_recover_rui_pass2(log, item, trans->r_lsn);
+		return xlog_recover_rui_pass2(log, item, current_lsn);
 	case XFS_LI_RUD:
 		return xlog_recover_rud_pass2(log, item);
 	case XFS_LI_CUI:
-		return xlog_recover_cui_pass2(log, item, trans->r_lsn);
+		return xlog_recover_cui_pass2(log, item, current_lsn);
 	case XFS_LI_CUD:
 		return xlog_recover_cud_pass2(log, item);
 	case XFS_LI_BUI:
-		return xlog_recover_bui_pass2(log, item, trans->r_lsn);
+		return xlog_recover_bui_pass2(log, item, current_lsn);
 	case XFS_LI_BUD:
 		return xlog_recover_bud_pass2(log, item);
+	}
+
+	return -EFSCORRUPTED;
+}
+
+STATIC int
+xlog_recover_commit_pass2(
+	struct xlog			*log,
+	struct xlog_recover		*trans,
+	struct list_head		*buffer_list,
+	struct xlog_recover_item	*item)
+{
+	trace_xfs_log_recover_item_recover(log, trans, item, XLOG_RECOVER_PASS2);
+
+	if (item->ri_type && item->ri_type->commit_pass2_fn)
+		return item->ri_type->commit_pass2_fn(log, buffer_list, item,
+				trans->r_lsn);
+
+	switch (ITEM_TYPE(item)) {
 	case XFS_LI_DQUOT:
 		return xlog_recover_dquot_pass2(log, buffer_list, item,
 						trans->r_lsn);