aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_extfree_item.c
diff options
context:
space:
mode:
authorDavid Chinner <david@fromorbit.com>2008-10-30 02:39:46 -0400
committerLachlan McIlroy <lachlan@sgi.com>2008-10-30 02:39:46 -0400
commitfc1829f34d30899701dfd5890030d39e13e1f47d (patch)
treec2532c6a1070396e39000f36a5728f0f0940b24d /fs/xfs/xfs_extfree_item.c
parenta9c21c1b9deaced836034e77fe25fe0b55c21f02 (diff)
[XFS] Add ail pointer into log items
Add an xfs_ail pointer to log items so that the log items can reference the AIL directly during callbacks without needed a struct xfs_mount. SGI-PV: 988143 SGI-Modid: xfs-linux-melb:xfs-kern:32352a 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/xfs_extfree_item.c')
-rw-r--r--fs/xfs/xfs_extfree_item.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/fs/xfs/xfs_extfree_item.c b/fs/xfs/xfs_extfree_item.c
index f1dcd80cf066..dab57374e1fe 100644
--- a/fs/xfs/xfs_extfree_item.c
+++ b/fs/xfs/xfs_extfree_item.c
@@ -108,10 +108,12 @@ xfs_efi_item_pin(xfs_efi_log_item_t *efip)
108STATIC void 108STATIC void
109xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale) 109xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
110{ 110{
111 xfs_mount_t *mp; 111 xfs_mount_t *mp;
112 struct xfs_ail *ailp;
112 113
113 mp = efip->efi_item.li_mountp; 114 mp = efip->efi_item.li_mountp;
114 spin_lock(&mp->m_ail->xa_lock); 115 ailp = efip->efi_item.li_ailp;
116 spin_lock(&ailp->xa_lock);
115 if (efip->efi_flags & XFS_EFI_CANCELED) { 117 if (efip->efi_flags & XFS_EFI_CANCELED) {
116 /* 118 /*
117 * xfs_trans_delete_ail() drops the AIL lock. 119 * xfs_trans_delete_ail() drops the AIL lock.
@@ -120,7 +122,7 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
120 xfs_efi_item_free(efip); 122 xfs_efi_item_free(efip);
121 } else { 123 } else {
122 efip->efi_flags |= XFS_EFI_COMMITTED; 124 efip->efi_flags |= XFS_EFI_COMMITTED;
123 spin_unlock(&mp->m_ail->xa_lock); 125 spin_unlock(&ailp->xa_lock);
124 } 126 }
125} 127}
126 128
@@ -134,11 +136,13 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
134STATIC void 136STATIC void
135xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp) 137xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
136{ 138{
137 xfs_mount_t *mp; 139 xfs_mount_t *mp;
140 struct xfs_ail *ailp;
138 xfs_log_item_desc_t *lidp; 141 xfs_log_item_desc_t *lidp;
139 142
140 mp = efip->efi_item.li_mountp; 143 mp = efip->efi_item.li_mountp;
141 spin_lock(&mp->m_ail->xa_lock); 144 ailp = efip->efi_item.li_ailp;
145 spin_lock(&ailp->xa_lock);
142 if (efip->efi_flags & XFS_EFI_CANCELED) { 146 if (efip->efi_flags & XFS_EFI_CANCELED) {
143 /* 147 /*
144 * free the xaction descriptor pointing to this item 148 * free the xaction descriptor pointing to this item
@@ -153,7 +157,7 @@ xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
153 xfs_efi_item_free(efip); 157 xfs_efi_item_free(efip);
154 } else { 158 } else {
155 efip->efi_flags |= XFS_EFI_COMMITTED; 159 efip->efi_flags |= XFS_EFI_COMMITTED;
156 spin_unlock(&mp->m_ail->xa_lock); 160 spin_unlock(&ailp->xa_lock);
157 } 161 }
158} 162}
159 163
@@ -268,6 +272,7 @@ xfs_efi_init(xfs_mount_t *mp,
268 efip->efi_item.li_type = XFS_LI_EFI; 272 efip->efi_item.li_type = XFS_LI_EFI;
269 efip->efi_item.li_ops = &xfs_efi_item_ops; 273 efip->efi_item.li_ops = &xfs_efi_item_ops;
270 efip->efi_item.li_mountp = mp; 274 efip->efi_item.li_mountp = mp;
275 efip->efi_item.li_ailp = mp->m_ail;
271 efip->efi_format.efi_nextents = nextents; 276 efip->efi_format.efi_nextents = nextents;
272 efip->efi_format.efi_id = (__psint_t)(void*)efip; 277 efip->efi_format.efi_id = (__psint_t)(void*)efip;
273 278
@@ -345,14 +350,16 @@ void
345xfs_efi_release(xfs_efi_log_item_t *efip, 350xfs_efi_release(xfs_efi_log_item_t *efip,
346 uint nextents) 351 uint nextents)
347{ 352{
348 xfs_mount_t *mp; 353 xfs_mount_t *mp;
349 int extents_left; 354 struct xfs_ail *ailp;
355 int extents_left;
350 356
351 mp = efip->efi_item.li_mountp; 357 mp = efip->efi_item.li_mountp;
358 ailp = efip->efi_item.li_ailp;
352 ASSERT(efip->efi_next_extent > 0); 359 ASSERT(efip->efi_next_extent > 0);
353 ASSERT(efip->efi_flags & XFS_EFI_COMMITTED); 360 ASSERT(efip->efi_flags & XFS_EFI_COMMITTED);
354 361
355 spin_lock(&mp->m_ail->xa_lock); 362 spin_lock(&ailp->xa_lock);
356 ASSERT(efip->efi_next_extent >= nextents); 363 ASSERT(efip->efi_next_extent >= nextents);
357 efip->efi_next_extent -= nextents; 364 efip->efi_next_extent -= nextents;
358 extents_left = efip->efi_next_extent; 365 extents_left = efip->efi_next_extent;
@@ -363,7 +370,7 @@ xfs_efi_release(xfs_efi_log_item_t *efip,
363 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip); 370 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
364 xfs_efi_item_free(efip); 371 xfs_efi_item_free(efip);
365 } else { 372 } else {
366 spin_unlock(&mp->m_ail->xa_lock); 373 spin_unlock(&ailp->xa_lock);
367 } 374 }
368} 375}
369 376
@@ -565,6 +572,7 @@ xfs_efd_init(xfs_mount_t *mp,
565 efdp->efd_item.li_type = XFS_LI_EFD; 572 efdp->efd_item.li_type = XFS_LI_EFD;
566 efdp->efd_item.li_ops = &xfs_efd_item_ops; 573 efdp->efd_item.li_ops = &xfs_efd_item_ops;
567 efdp->efd_item.li_mountp = mp; 574 efdp->efd_item.li_mountp = mp;
575 efdp->efd_item.li_ailp = mp->m_ail;
568 efdp->efd_efip = efip; 576 efdp->efd_efip = efip;
569 efdp->efd_format.efd_nextents = nextents; 577 efdp->efd_format.efd_nextents = nextents;
570 efdp->efd_format.efd_efi_id = efip->efi_format.efi_id; 578 efdp->efd_format.efd_efi_id = efip->efi_format.efi_id;