aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_log_recover.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2010-12-19 19:59:49 -0500
committerDave Chinner <david@fromorbit.com>2010-12-19 19:59:49 -0500
commitb199c8a4ba11879df87daad496ceee41fdc6aa82 (patch)
tree8652785ca70788e3cc43272be72f21123adafbe7 /fs/xfs/xfs_log_recover.c
parent9c5f8414efd5eeed9f498d4170337a3eb126341f (diff)
xfs: Pull EFI/EFD handling out from under the AIL lock
EFI/EFD interactions are protected from races by the AIL lock. They are the only type of log items that require the the AIL lock to serialise internal state, so they need to be separated from the AIL lock before we can do bulk insert operations on the AIL. To acheive this, convert the counter of the number of extents in the EFI to an atomic so it can be safely manipulated by EFD processing without locks. Also, convert the EFI state flag manipulations to use atomic bit operations so no locks are needed to record state changes. Finally, use the state bits to determine when it is safe to free the EFI and clean up the code to do this neatly. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/xfs_log_recover.c')
-rw-r--r--fs/xfs/xfs_log_recover.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 4ab4f6ff48aa..d7219e29d9ab 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2567,8 +2567,7 @@ xlog_recover_efi_pass2(
2567 xfs_efi_item_free(efip); 2567 xfs_efi_item_free(efip);
2568 return error; 2568 return error;
2569 } 2569 }
2570 efip->efi_next_extent = efi_formatp->efi_nextents; 2570 atomic_set(&efip->efi_next_extent, efi_formatp->efi_nextents);
2571 efip->efi_flags |= XFS_EFI_COMMITTED;
2572 2571
2573 spin_lock(&log->l_ailp->xa_lock); 2572 spin_lock(&log->l_ailp->xa_lock);
2574 /* 2573 /*
@@ -2878,7 +2877,7 @@ xlog_recover_process_efi(
2878 xfs_extent_t *extp; 2877 xfs_extent_t *extp;
2879 xfs_fsblock_t startblock_fsb; 2878 xfs_fsblock_t startblock_fsb;
2880 2879
2881 ASSERT(!(efip->efi_flags & XFS_EFI_RECOVERED)); 2880 ASSERT(!test_bit(XFS_EFI_RECOVERED, &efip->efi_flags));
2882 2881
2883 /* 2882 /*
2884 * First check the validity of the extents described by the 2883 * First check the validity of the extents described by the
@@ -2917,7 +2916,7 @@ xlog_recover_process_efi(
2917 extp->ext_len); 2916 extp->ext_len);
2918 } 2917 }
2919 2918
2920 efip->efi_flags |= XFS_EFI_RECOVERED; 2919 set_bit(XFS_EFI_RECOVERED, &efip->efi_flags);
2921 error = xfs_trans_commit(tp, 0); 2920 error = xfs_trans_commit(tp, 0);
2922 return error; 2921 return error;
2923 2922
@@ -2974,7 +2973,7 @@ xlog_recover_process_efis(
2974 * Skip EFIs that we've already processed. 2973 * Skip EFIs that we've already processed.
2975 */ 2974 */
2976 efip = (xfs_efi_log_item_t *)lip; 2975 efip = (xfs_efi_log_item_t *)lip;
2977 if (efip->efi_flags & XFS_EFI_RECOVERED) { 2976 if (test_bit(XFS_EFI_RECOVERED, &efip->efi_flags)) {
2978 lip = xfs_trans_ail_cursor_next(ailp, &cur); 2977 lip = xfs_trans_ail_cursor_next(ailp, &cur);
2979 continue; 2978 continue;
2980 } 2979 }