dect
/
linux-2.6
Archived
13
0
Fork 0

[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>
This commit is contained in:
David Chinner 2008-10-30 17:39:35 +11:00 committed by Lachlan McIlroy
parent c7e8f26827
commit a9c21c1b9d
3 changed files with 24 additions and 22 deletions

View File

@ -572,6 +572,7 @@ xfs_log_mount(
cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error); cmn_err(CE_WARN, "XFS: AIL initialisation failed: error %d", error);
goto error; goto error;
} }
mp->m_log->l_ailp = mp->m_ail;
/* /*
* skip log recovery on a norecovery mount. pretend it all * skip log recovery on a norecovery mount. pretend it all
@ -908,7 +909,7 @@ xfs_log_need_covered(xfs_mount_t *mp)
spin_lock(&log->l_icloglock); spin_lock(&log->l_icloglock);
if (((log->l_covered_state == XLOG_STATE_COVER_NEED) || if (((log->l_covered_state == XLOG_STATE_COVER_NEED) ||
(log->l_covered_state == XLOG_STATE_COVER_NEED2)) (log->l_covered_state == XLOG_STATE_COVER_NEED2))
&& !xfs_trans_ail_tail(mp->m_ail) && !xfs_trans_ail_tail(log->l_ailp)
&& xlog_iclogs_empty(log)) { && xlog_iclogs_empty(log)) {
if (log->l_covered_state == XLOG_STATE_COVER_NEED) if (log->l_covered_state == XLOG_STATE_COVER_NEED)
log->l_covered_state = XLOG_STATE_COVER_DONE; log->l_covered_state = XLOG_STATE_COVER_DONE;

View File

@ -404,6 +404,7 @@ typedef struct xlog_in_core {
typedef struct log { typedef struct log {
/* The following fields don't need locking */ /* The following fields don't need locking */
struct xfs_mount *l_mp; /* mount point */ struct xfs_mount *l_mp; /* mount point */
struct xfs_ail *l_ailp; /* AIL log is working with */
struct xfs_buf *l_xbuf; /* extra buffer for log struct xfs_buf *l_xbuf; /* extra buffer for log
* wrapping */ * wrapping */
struct xfs_buftarg *l_targ; /* buftarg of log */ struct xfs_buftarg *l_targ; /* buftarg of log */

View File

@ -2681,7 +2681,7 @@ xlog_recover_do_efi_trans(
efip->efi_next_extent = efi_formatp->efi_nextents; efip->efi_next_extent = efi_formatp->efi_nextents;
efip->efi_flags |= XFS_EFI_COMMITTED; efip->efi_flags |= XFS_EFI_COMMITTED;
spin_lock(&mp->m_ail->xa_lock); spin_lock(&log->l_ailp->xa_lock);
/* /*
* xfs_trans_update_ail() drops the AIL lock. * xfs_trans_update_ail() drops the AIL lock.
*/ */
@ -2710,6 +2710,7 @@ xlog_recover_do_efd_trans(
xfs_log_item_t *lip; xfs_log_item_t *lip;
__uint64_t efi_id; __uint64_t efi_id;
struct xfs_ail_cursor cur; struct xfs_ail_cursor cur;
struct xfs_ail *ailp;
if (pass == XLOG_RECOVER_PASS1) { if (pass == XLOG_RECOVER_PASS1) {
return; return;
@ -2727,8 +2728,9 @@ xlog_recover_do_efd_trans(
* in the AIL. * in the AIL.
*/ */
mp = log->l_mp; mp = log->l_mp;
spin_lock(&mp->m_ail->xa_lock); ailp = log->l_ailp;
lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0); spin_lock(&ailp->xa_lock);
lip = xfs_trans_ail_cursor_first(ailp, &cur, 0);
while (lip != NULL) { while (lip != NULL) {
if (lip->li_type == XFS_LI_EFI) { if (lip->li_type == XFS_LI_EFI) {
efip = (xfs_efi_log_item_t *)lip; efip = (xfs_efi_log_item_t *)lip;
@ -2739,14 +2741,14 @@ xlog_recover_do_efd_trans(
*/ */
xfs_trans_delete_ail(mp, lip); xfs_trans_delete_ail(mp, lip);
xfs_efi_item_free(efip); xfs_efi_item_free(efip);
spin_lock(&mp->m_ail->xa_lock); spin_lock(&ailp->xa_lock);
break; break;
} }
} }
lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur); lip = xfs_trans_ail_cursor_next(ailp, &cur);
} }
xfs_trans_ail_cursor_done(mp->m_ail, &cur); xfs_trans_ail_cursor_done(ailp, &cur);
spin_unlock(&mp->m_ail->xa_lock); spin_unlock(&ailp->xa_lock);
} }
/* /*
@ -3053,14 +3055,13 @@ xlog_recover_process_efis(
{ {
xfs_log_item_t *lip; xfs_log_item_t *lip;
xfs_efi_log_item_t *efip; xfs_efi_log_item_t *efip;
xfs_mount_t *mp;
int error = 0; int error = 0;
struct xfs_ail_cursor cur; struct xfs_ail_cursor cur;
struct xfs_ail *ailp;
mp = log->l_mp; ailp = log->l_ailp;
spin_lock(&mp->m_ail->xa_lock); spin_lock(&ailp->xa_lock);
lip = xfs_trans_ail_cursor_first(ailp, &cur, 0);
lip = xfs_trans_ail_cursor_first(mp->m_ail, &cur, 0);
while (lip != NULL) { while (lip != NULL) {
/* /*
* We're done when we see something other than an EFI. * We're done when we see something other than an EFI.
@ -3068,8 +3069,7 @@ xlog_recover_process_efis(
*/ */
if (lip->li_type != XFS_LI_EFI) { if (lip->li_type != XFS_LI_EFI) {
#ifdef DEBUG #ifdef DEBUG
for (; lip; for (; lip; lip = xfs_trans_ail_cursor_next(ailp, &cur))
lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur))
ASSERT(lip->li_type != XFS_LI_EFI); ASSERT(lip->li_type != XFS_LI_EFI);
#endif #endif
break; break;
@ -3080,20 +3080,20 @@ xlog_recover_process_efis(
*/ */
efip = (xfs_efi_log_item_t *)lip; efip = (xfs_efi_log_item_t *)lip;
if (efip->efi_flags & XFS_EFI_RECOVERED) { if (efip->efi_flags & XFS_EFI_RECOVERED) {
lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur); lip = xfs_trans_ail_cursor_next(ailp, &cur);
continue; continue;
} }
spin_unlock(&mp->m_ail->xa_lock); spin_unlock(&ailp->xa_lock);
error = xlog_recover_process_efi(mp, efip); error = xlog_recover_process_efi(log->l_mp, efip);
spin_lock(&mp->m_ail->xa_lock); spin_lock(&ailp->xa_lock);
if (error) if (error)
goto out; goto out;
lip = xfs_trans_ail_cursor_next(mp->m_ail, &cur); lip = xfs_trans_ail_cursor_next(ailp, &cur);
} }
out: out:
xfs_trans_ail_cursor_done(mp->m_ail, &cur); xfs_trans_ail_cursor_done(ailp, &cur);
spin_unlock(&mp->m_ail->xa_lock); spin_unlock(&ailp->xa_lock);
return error; return error;
} }