From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> 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@xxxxxxxxxx> --- fs/xfs/xfs_log_recover.c | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) 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);