aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
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
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')
-rw-r--r--fs/xfs/xfs_buf_item.c5
-rw-r--r--fs/xfs/xfs_extfree_item.c28
-rw-r--r--fs/xfs/xfs_inode_item.c1
-rw-r--r--fs/xfs/xfs_trans.c9
-rw-r--r--fs/xfs/xfs_trans.h1
-rw-r--r--fs/xfs/xfs_trans_item.c10
6 files changed, 40 insertions, 14 deletions
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index c557fd682527..793e53c01dc0 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -731,6 +731,7 @@ xfs_buf_item_init(
731 bip->bli_item.li_type = XFS_LI_BUF; 731 bip->bli_item.li_type = XFS_LI_BUF;
732 bip->bli_item.li_ops = &xfs_buf_item_ops; 732 bip->bli_item.li_ops = &xfs_buf_item_ops;
733 bip->bli_item.li_mountp = mp; 733 bip->bli_item.li_mountp = mp;
734 bip->bli_item.li_ailp = mp->m_ail;
734 bip->bli_buf = bp; 735 bip->bli_buf = bp;
735 xfs_buf_hold(bp); 736 xfs_buf_hold(bp);
736 bip->bli_format.blf_type = XFS_LI_BUF; 737 bip->bli_format.blf_type = XFS_LI_BUF;
@@ -1123,11 +1124,13 @@ xfs_buf_iodone(
1123 xfs_buf_log_item_t *bip) 1124 xfs_buf_log_item_t *bip)
1124{ 1125{
1125 struct xfs_mount *mp; 1126 struct xfs_mount *mp;
1127 struct xfs_ail *ailp;
1126 1128
1127 ASSERT(bip->bli_buf == bp); 1129 ASSERT(bip->bli_buf == bp);
1128 1130
1129 xfs_buf_rele(bp); 1131 xfs_buf_rele(bp);
1130 mp = bip->bli_item.li_mountp; 1132 mp = bip->bli_item.li_mountp;
1133 ailp = bip->bli_item.li_ailp;
1131 1134
1132 /* 1135 /*
1133 * If we are forcibly shutting down, this may well be 1136 * If we are forcibly shutting down, this may well be
@@ -1138,7 +1141,7 @@ xfs_buf_iodone(
1138 * 1141 *
1139 * Either way, AIL is useless if we're forcing a shutdown. 1142 * Either way, AIL is useless if we're forcing a shutdown.
1140 */ 1143 */
1141 spin_lock(&mp->m_ail->xa_lock); 1144 spin_lock(&ailp->xa_lock);
1142 /* 1145 /*
1143 * xfs_trans_delete_ail() drops the AIL lock. 1146 * xfs_trans_delete_ail() drops the AIL lock.
1144 */ 1147 */
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;
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 291d30aded69..47594f4b51db 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -932,6 +932,7 @@ xfs_inode_item_init(
932 iip->ili_item.li_type = XFS_LI_INODE; 932 iip->ili_item.li_type = XFS_LI_INODE;
933 iip->ili_item.li_ops = &xfs_inode_item_ops; 933 iip->ili_item.li_ops = &xfs_inode_item_ops;
934 iip->ili_item.li_mountp = mp; 934 iip->ili_item.li_mountp = mp;
935 iip->ili_item.li_ailp = mp->m_ail;
935 iip->ili_inode = ip; 936 iip->ili_inode = ip;
936 937
937 /* 938 /*
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index 99ba0e2658b7..5163e1216c8e 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -1383,11 +1383,13 @@ xfs_trans_chunk_committed(
1383 xfs_log_item_desc_t *lidp; 1383 xfs_log_item_desc_t *lidp;
1384 xfs_log_item_t *lip; 1384 xfs_log_item_t *lip;
1385 xfs_lsn_t item_lsn; 1385 xfs_lsn_t item_lsn;
1386 struct xfs_mount *mp;
1387 int i; 1386 int i;
1388 1387
1389 lidp = licp->lic_descs; 1388 lidp = licp->lic_descs;
1390 for (i = 0; i < licp->lic_unused; i++, lidp++) { 1389 for (i = 0; i < licp->lic_unused; i++, lidp++) {
1390 struct xfs_mount *mp;
1391 struct xfs_ail *ailp;
1392
1391 if (xfs_lic_isfree(licp, i)) { 1393 if (xfs_lic_isfree(licp, i)) {
1392 continue; 1394 continue;
1393 } 1395 }
@@ -1425,7 +1427,8 @@ xfs_trans_chunk_committed(
1425 * the test below. 1427 * the test below.
1426 */ 1428 */
1427 mp = lip->li_mountp; 1429 mp = lip->li_mountp;
1428 spin_lock(&mp->m_ail->xa_lock); 1430 ailp = lip->li_ailp;
1431 spin_lock(&ailp->xa_lock);
1429 if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) { 1432 if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) {
1430 /* 1433 /*
1431 * This will set the item's lsn to item_lsn 1434 * This will set the item's lsn to item_lsn
@@ -1436,7 +1439,7 @@ xfs_trans_chunk_committed(
1436 */ 1439 */
1437 xfs_trans_update_ail(mp, lip, item_lsn); 1440 xfs_trans_update_ail(mp, lip, item_lsn);
1438 } else { 1441 } else {
1439 spin_unlock(&mp->m_ail->xa_lock); 1442 spin_unlock(&ailp->xa_lock);
1440 } 1443 }
1441 1444
1442 /* 1445 /*
diff --git a/fs/xfs/xfs_trans.h b/fs/xfs/xfs_trans.h
index ae2ae3e020d6..0df515477577 100644
--- a/fs/xfs/xfs_trans.h
+++ b/fs/xfs/xfs_trans.h
@@ -768,6 +768,7 @@ typedef struct xfs_log_item {
768 xfs_lsn_t li_lsn; /* last on-disk lsn */ 768 xfs_lsn_t li_lsn; /* last on-disk lsn */
769 struct xfs_log_item_desc *li_desc; /* ptr to current desc*/ 769 struct xfs_log_item_desc *li_desc; /* ptr to current desc*/
770 struct xfs_mount *li_mountp; /* ptr to fs mount */ 770 struct xfs_mount *li_mountp; /* ptr to fs mount */
771 struct xfs_ail *li_ailp; /* ptr to AIL */
771 uint li_type; /* item type */ 772 uint li_type; /* item type */
772 uint li_flags; /* misc flags */ 773 uint li_flags; /* misc flags */
773 struct xfs_log_item *li_bio_list; /* buffer item list */ 774 struct xfs_log_item *li_bio_list; /* buffer item list */
diff --git a/fs/xfs/xfs_trans_item.c b/fs/xfs/xfs_trans_item.c
index 3c666e8317f8..e110bf57d7f4 100644
--- a/fs/xfs/xfs_trans_item.c
+++ b/fs/xfs/xfs_trans_item.c
@@ -22,6 +22,14 @@
22#include "xfs_inum.h" 22#include "xfs_inum.h"
23#include "xfs_trans.h" 23#include "xfs_trans.h"
24#include "xfs_trans_priv.h" 24#include "xfs_trans_priv.h"
25/* XXX: from here down needed until struct xfs_trans has it's own ailp */
26#include "xfs_bit.h"
27#include "xfs_buf_item.h"
28#include "xfs_sb.h"
29#include "xfs_ag.h"
30#include "xfs_dir2.h"
31#include "xfs_dmapi.h"
32#include "xfs_mount.h"
25 33
26STATIC int xfs_trans_unlock_chunk(xfs_log_item_chunk_t *, 34STATIC int xfs_trans_unlock_chunk(xfs_log_item_chunk_t *,
27 int, int, xfs_lsn_t); 35 int, int, xfs_lsn_t);
@@ -79,6 +87,7 @@ xfs_trans_add_item(xfs_trans_t *tp, xfs_log_item_t *lip)
79 lidp->lid_size = 0; 87 lidp->lid_size = 0;
80 lip->li_desc = lidp; 88 lip->li_desc = lidp;
81 lip->li_mountp = tp->t_mountp; 89 lip->li_mountp = tp->t_mountp;
90 lip->li_ailp = tp->t_mountp->m_ail;
82 return lidp; 91 return lidp;
83 } 92 }
84 93
@@ -120,6 +129,7 @@ xfs_trans_add_item(xfs_trans_t *tp, xfs_log_item_t *lip)
120 lidp->lid_size = 0; 129 lidp->lid_size = 0;
121 lip->li_desc = lidp; 130 lip->li_desc = lidp;
122 lip->li_mountp = tp->t_mountp; 131 lip->li_mountp = tp->t_mountp;
132 lip->li_ailp = tp->t_mountp->m_ail;
123 return lidp; 133 return lidp;
124} 134}
125 135