diff options
author | David Chinner <david@fromorbit.com> | 2008-10-30 02:39:35 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@sgi.com> | 2008-10-30 02:39:35 -0400 |
commit | a9c21c1b9deaced836034e77fe25fe0b55c21f02 (patch) | |
tree | 908b333bd0dd310a6a24760e2eab3bc5371540af /fs/xfs | |
parent | c7e8f268278a292d3823b4352182fa7755a71410 (diff) |
[XFS] Given the log a pointer to the AIL
When we need to go from the log to the AIL, we have to go via the
xfs_mount. Add a xfs_ail pointer to the log so we can go directly to the
AIL associated with the log.
SGI-PV: 988143
SGI-Modid: xfs-linux-melb:xfs-kern:32351a
Signed-off-by: David Chinner <david@fromorbit.com>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_log.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_log_priv.h | 1 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 42 |
3 files changed, 24 insertions, 22 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index a2f7422a749f..405a41ab6855 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -572,6 +572,7 @@ xfs_log_mount( | |||
572 | cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error); | 572 | cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error); |
573 | goto error; | 573 | goto error; |
574 | } | 574 | } |
575 | mp->m_log->l_ailp = mp->m_ail; | ||
575 | 576 | ||
576 | /* | 577 | /* |
577 | * skip log recovery on a norecovery mount. pretend it all | 578 | * skip log recovery on a norecovery mount. pretend it all |
@@ -908,7 +909,7 @@ xfs_log_need_covered(xfs_mount_t *mp) | |||
908 | spin_lock(&log->l_icloglock); | 909 | spin_lock(&log->l_icloglock); |
909 | if (((log->l_covered_state == XLOG_STATE_COVER_NEED) || | 910 | if (((log->l_covered_state == XLOG_STATE_COVER_NEED) || |
910 | (log->l_covered_state == XLOG_STATE_COVER_NEED2)) | 911 | (log->l_covered_state == XLOG_STATE_COVER_NEED2)) |
911 | && !xfs_trans_ail_tail(mp->m_ail) | 912 | && !xfs_trans_ail_tail(log->l_ailp) |
912 | && xlog_iclogs_empty(log)) { | 913 | && xlog_iclogs_empty(log)) { |
913 | if (log->l_covered_state == XLOG_STATE_COVER_NEED) | 914 | if (log->l_covered_state == XLOG_STATE_COVER_NEED) |
914 | log->l_covered_state = XLOG_STATE_COVER_DONE; | 915 | log->l_covered_state = XLOG_STATE_COVER_DONE; |
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h index e7d8f84443fa..de7ef6ca9206 100644 --- a/fs/xfs/xfs_log_priv.h +++ b/fs/xfs/xfs_log_priv.h | |||
@@ -404,6 +404,7 @@ typedef struct xlog_in_core { | |||
404 | typedef struct log { | 404 | typedef struct log { |
405 | /* The following fields don't need locking */ | 405 | /* The following fields don't need locking */ |
406 | struct xfs_mount *l_mp; /* mount point */ | 406 | struct xfs_mount *l_mp; /* mount point */ |
407 | struct xfs_ail *l_ailp; /* AIL log is working with */ | ||
407 | struct xfs_buf *l_xbuf; /* extra buffer for log | 408 | struct xfs_buf *l_xbuf; /* extra buffer for log |
408 | * wrapping */ | 409 | * wrapping */ |
409 | struct xfs_buftarg *l_targ; /* buftarg of log */ | 410 | struct xfs_buftarg *l_targ; /* buftarg of log */ |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index a484febb9ec6..0bbde7b84fc9 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -2681,7 +2681,7 @@ xlog_recover_do_efi_trans( | |||
2681 | efip->efi_next_extent = efi_formatp->efi_nextents; | 2681 | efip->efi_next_extent = efi_formatp->efi_nextents; |
2682 | efip->efi_flags |= XFS_EFI_COMMITTED; | 2682 | efip->efi_flags |= XFS_EFI_COMMITTED; |
2683 | 2683 | ||
2684 | spin_lock(&mp->m_ail->xa_lock); | 2684 | spin_lock(&log->l_ailp->xa_lock); |
2685 | /* | 2685 | /* |
2686 | * xfs_trans_update_ail() drops the AIL lock. | 2686 | * xfs_trans_update_ail() drops the AIL lock. |
2687 | */ | 2687 | */ |
@@ -2710,6 +2710,7 @@ xlog_recover_do_efd_trans( | |||
2710 | xfs_log_item_t *lip; | 2710 | xfs_log_item_t *lip; |
2711 | __uint64_t efi_id; | 2711 | __uint64_t efi_id; |
2712 | struct xfs_ail_cursor cur; | 2712 | struct xfs_ail_cursor cur; |
2713 | struct xfs_ail *ailp; | ||
2713 | 2714 | ||
2714 | if (pass == XLOG_RECOVER_PASS1) { | 2715 | if (pass == XLOG_RECOVER_PASS1) { |
2715 | return; | 2716 | return; |
@@ -2727,8 +2728,9 @@ xlog_recover_do_efd_trans( | |||
2727 | * in the AIL. | 2728 | * in the AIL. |
2728 | */ | 2729 | */ |
2729 | mp = log->l_mp; | 2730 | mp = log->l_mp; |
2730 | spin_lock(&mp->m_ail->xa_lock); | 2731 | ailp = log->l_ailp; |
2731 | lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0); | 2732 | spin_lock(&ailp->xa_lock); |
2733 | lip = xfs_trans_ail_cursor_first(ailp, &cur, 0); | ||
2732 | while (lip != NULL) { | 2734 | while (lip != NULL) { |
2733 | if (lip->li_type == XFS_LI_EFI) { | 2735 | if (lip->li_type == XFS_LI_EFI) { |
2734 | efip = (xfs_efi_log_item_t *)lip; | 2736 | efip = (xfs_efi_log_item_t *)lip; |
@@ -2739,14 +2741,14 @@ xlog_recover_do_efd_trans( | |||
2739 | */ | 2741 | */ |
2740 | xfs_trans_delete_ail(mp, lip); | 2742 | xfs_trans_delete_ail(mp, lip); |
2741 | xfs_efi_item_free(efip); | 2743 | xfs_efi_item_free(efip); |
2742 | spin_lock(&mp->m_ail->xa_lock); | 2744 | spin_lock(&ailp->xa_lock); |
2743 | break; | 2745 | break; |
2744 | } | 2746 | } |
2745 | } | 2747 | } |
2746 | lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur); | 2748 | lip = xfs_trans_ail_cursor_next(ailp, &cur); |
2747 | } | 2749 | } |
2748 | xfs_trans_ail_cursor_done(mp->m_ail, &cur); | 2750 | xfs_trans_ail_cursor_done(ailp, &cur); |
2749 | spin_unlock(&mp->m_ail->xa_lock); | 2751 | spin_unlock(&ailp->xa_lock); |
2750 | } | 2752 | } |
2751 | 2753 | ||
2752 | /* | 2754 | /* |
@@ -3053,14 +3055,13 @@ xlog_recover_process_efis( | |||
3053 | { | 3055 | { |
3054 | xfs_log_item_t *lip; | 3056 | xfs_log_item_t *lip; |
3055 | xfs_efi_log_item_t *efip; | 3057 | xfs_efi_log_item_t *efip; |
3056 | xfs_mount_t *mp; | ||
3057 | int error = 0; | 3058 | int error = 0; |
3058 | struct xfs_ail_cursor cur; | 3059 | struct xfs_ail_cursor cur; |
3060 | struct xfs_ail *ailp; | ||
3059 | 3061 | ||
3060 | mp = log->l_mp; | 3062 | ailp = log->l_ailp; |
3061 | spin_lock(&mp->m_ail->xa_lock); | 3063 | spin_lock(&ailp->xa_lock); |
3062 | 3064 | lip = xfs_trans_ail_cursor_first(ailp, &cur, 0); | |
3063 | lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0); | ||
3064 | while (lip != NULL) { | 3065 | while (lip != NULL) { |
3065 | /* | 3066 | /* |
3066 | * We're done when we see something other than an EFI. | 3067 | * We're done when we see something other than an EFI. |
@@ -3068,8 +3069,7 @@ xlog_recover_process_efis( | |||
3068 | */ | 3069 | */ |
3069 | if (lip->li_type != XFS_LI_EFI) { | 3070 | if (lip->li_type != XFS_LI_EFI) { |
3070 | #ifdef DEBUG | 3071 | #ifdef DEBUG |
3071 | for (; lip; | 3072 | for (; lip; lip = xfs_trans_ail_cursor_next(ailp, &cur)) |
3072 | lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur)) | ||
3073 | ASSERT(lip->li_type != XFS_LI_EFI); | 3073 | ASSERT(lip->li_type != XFS_LI_EFI); |
3074 | #endif | 3074 | #endif |
3075 | break; | 3075 | break; |
@@ -3080,20 +3080,20 @@ xlog_recover_process_efis( | |||
3080 | */ | 3080 | */ |
3081 | efip = (xfs_efi_log_item_t *)lip; | 3081 | efip = (xfs_efi_log_item_t *)lip; |
3082 | if (efip->efi_flags & XFS_EFI_RECOVERED) { | 3082 | if (efip->efi_flags & XFS_EFI_RECOVERED) { |
3083 | lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur); | 3083 | lip = xfs_trans_ail_cursor_next(ailp, &cur); |
3084 | continue; | 3084 | continue; |
3085 | } | 3085 | } |
3086 | 3086 | ||
3087 | spin_unlock(&mp->m_ail->xa_lock); | 3087 | spin_unlock(&ailp->xa_lock); |
3088 | error = xlog_recover_process_efi(mp, efip); | 3088 | error = xlog_recover_process_efi(log->l_mp, efip); |
3089 | spin_lock(&mp->m_ail->xa_lock); | 3089 | spin_lock(&ailp->xa_lock); |
3090 | if (error) | 3090 | if (error) |
3091 | goto out; | 3091 | goto out; |
3092 | lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur); | 3092 | lip = xfs_trans_ail_cursor_next(ailp, &cur); |
3093 | } | 3093 | } |
3094 | out: | 3094 | out: |
3095 | xfs_trans_ail_cursor_done(mp->m_ail, &cur); | 3095 | xfs_trans_ail_cursor_done(ailp, &cur); |
3096 | spin_unlock(&mp->m_ail->xa_lock); | 3096 | spin_unlock(&ailp->xa_lock); |
3097 | return error; | 3097 | return error; |
3098 | } | 3098 | } |
3099 | 3099 | ||