]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[XFS] Add ail pointer into log items
authorDavid Chinner <david@fromorbit.com>
Thu, 30 Oct 2008 06:39:46 +0000 (17:39 +1100)
committerLachlan McIlroy <lachlan@sgi.com>
Thu, 30 Oct 2008 06:39:46 +0000 (17:39 +1100)
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>
fs/xfs/xfs_buf_item.c
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_trans.c
fs/xfs/xfs_trans.h
fs/xfs/xfs_trans_item.c

index c557fd6825279c0823afdfa205e6368ee74af482..793e53c01dc014c7a1dd18ccd7d32ab95203bf4a 100644 (file)
@@ -731,6 +731,7 @@ xfs_buf_item_init(
        bip->bli_item.li_type = XFS_LI_BUF;
        bip->bli_item.li_ops = &xfs_buf_item_ops;
        bip->bli_item.li_mountp = mp;
+       bip->bli_item.li_ailp = mp->m_ail;
        bip->bli_buf = bp;
        xfs_buf_hold(bp);
        bip->bli_format.blf_type = XFS_LI_BUF;
@@ -1123,11 +1124,13 @@ xfs_buf_iodone(
        xfs_buf_log_item_t      *bip)
 {
        struct xfs_mount        *mp;
+       struct xfs_ail          *ailp;
 
        ASSERT(bip->bli_buf == bp);
 
        xfs_buf_rele(bp);
        mp = bip->bli_item.li_mountp;
+       ailp = bip->bli_item.li_ailp;
 
        /*
         * If we are forcibly shutting down, this may well be
@@ -1138,7 +1141,7 @@ xfs_buf_iodone(
         *
         * Either way, AIL is useless if we're forcing a shutdown.
         */
-       spin_lock(&mp->m_ail->xa_lock);
+       spin_lock(&ailp->xa_lock);
        /*
         * xfs_trans_delete_ail() drops the AIL lock.
         */
index f1dcd80cf0668f9df06b4970c1358450a9ef5e94..dab57374e1feeb439bc24c46a667694479c2634c 100644 (file)
@@ -108,10 +108,12 @@ xfs_efi_item_pin(xfs_efi_log_item_t *efip)
 STATIC void
 xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
 {
-       xfs_mount_t     *mp;
+       xfs_mount_t             *mp;
+       struct xfs_ail          *ailp;
 
        mp = efip->efi_item.li_mountp;
-       spin_lock(&mp->m_ail->xa_lock);
+       ailp = efip->efi_item.li_ailp;
+       spin_lock(&ailp->xa_lock);
        if (efip->efi_flags & XFS_EFI_CANCELED) {
                /*
                 * xfs_trans_delete_ail() drops the AIL lock.
@@ -120,7 +122,7 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
                xfs_efi_item_free(efip);
        } else {
                efip->efi_flags |= XFS_EFI_COMMITTED;
-               spin_unlock(&mp->m_ail->xa_lock);
+               spin_unlock(&ailp->xa_lock);
        }
 }
 
@@ -134,11 +136,13 @@ xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
 STATIC void
 xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp)
 {
-       xfs_mount_t     *mp;
+       xfs_mount_t             *mp;
+       struct xfs_ail          *ailp;
        xfs_log_item_desc_t     *lidp;
 
        mp = efip->efi_item.li_mountp;
-       spin_lock(&mp->m_ail->xa_lock);
+       ailp = efip->efi_item.li_ailp;
+       spin_lock(&ailp->xa_lock);
        if (efip->efi_flags & XFS_EFI_CANCELED) {
                /*
                 * 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)
                xfs_efi_item_free(efip);
        } else {
                efip->efi_flags |= XFS_EFI_COMMITTED;
-               spin_unlock(&mp->m_ail->xa_lock);
+               spin_unlock(&ailp->xa_lock);
        }
 }
 
@@ -268,6 +272,7 @@ xfs_efi_init(xfs_mount_t    *mp,
        efip->efi_item.li_type = XFS_LI_EFI;
        efip->efi_item.li_ops = &xfs_efi_item_ops;
        efip->efi_item.li_mountp = mp;
+       efip->efi_item.li_ailp = mp->m_ail;
        efip->efi_format.efi_nextents = nextents;
        efip->efi_format.efi_id = (__psint_t)(void*)efip;
 
@@ -345,14 +350,16 @@ void
 xfs_efi_release(xfs_efi_log_item_t     *efip,
                uint                    nextents)
 {
-       xfs_mount_t     *mp;
-       int             extents_left;
+       xfs_mount_t             *mp;
+       struct xfs_ail          *ailp;
+       int                     extents_left;
 
        mp = efip->efi_item.li_mountp;
+       ailp = efip->efi_item.li_ailp;
        ASSERT(efip->efi_next_extent > 0);
        ASSERT(efip->efi_flags & XFS_EFI_COMMITTED);
 
-       spin_lock(&mp->m_ail->xa_lock);
+       spin_lock(&ailp->xa_lock);
        ASSERT(efip->efi_next_extent >= nextents);
        efip->efi_next_extent -= nextents;
        extents_left = efip->efi_next_extent;
@@ -363,7 +370,7 @@ xfs_efi_release(xfs_efi_log_item_t  *efip,
                xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
                xfs_efi_item_free(efip);
        } else {
-               spin_unlock(&mp->m_ail->xa_lock);
+               spin_unlock(&ailp->xa_lock);
        }
 }
 
@@ -565,6 +572,7 @@ xfs_efd_init(xfs_mount_t    *mp,
        efdp->efd_item.li_type = XFS_LI_EFD;
        efdp->efd_item.li_ops = &xfs_efd_item_ops;
        efdp->efd_item.li_mountp = mp;
+       efdp->efd_item.li_ailp = mp->m_ail;
        efdp->efd_efip = efip;
        efdp->efd_format.efd_nextents = nextents;
        efdp->efd_format.efd_efi_id = efip->efi_format.efi_id;
index 291d30aded69076f809ea4b23d1fffa08f6508da..47594f4b51db520cea3f10236219a01d2bf94339 100644 (file)
@@ -932,6 +932,7 @@ xfs_inode_item_init(
        iip->ili_item.li_type = XFS_LI_INODE;
        iip->ili_item.li_ops = &xfs_inode_item_ops;
        iip->ili_item.li_mountp = mp;
+       iip->ili_item.li_ailp = mp->m_ail;
        iip->ili_inode = ip;
 
        /*
index 99ba0e2658b70b2e283e64c4795a266170affe02..5163e1216c8e6138978a7d24efd320e24368c831 100644 (file)
@@ -1383,11 +1383,13 @@ xfs_trans_chunk_committed(
        xfs_log_item_desc_t     *lidp;
        xfs_log_item_t          *lip;
        xfs_lsn_t               item_lsn;
-       struct xfs_mount        *mp;
        int                     i;
 
        lidp = licp->lic_descs;
        for (i = 0; i < licp->lic_unused; i++, lidp++) {
+               struct xfs_mount        *mp;
+               struct xfs_ail          *ailp;
+
                if (xfs_lic_isfree(licp, i)) {
                        continue;
                }
@@ -1425,7 +1427,8 @@ xfs_trans_chunk_committed(
                 * the test below.
                 */
                mp = lip->li_mountp;
-               spin_lock(&mp->m_ail->xa_lock);
+               ailp = lip->li_ailp;
+               spin_lock(&ailp->xa_lock);
                if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) {
                        /*
                         * This will set the item's lsn to item_lsn
@@ -1436,7 +1439,7 @@ xfs_trans_chunk_committed(
                         */
                        xfs_trans_update_ail(mp, lip, item_lsn);
                } else {
-                       spin_unlock(&mp->m_ail->xa_lock);
+                       spin_unlock(&ailp->xa_lock);
                }
 
                /*
index ae2ae3e020d6f5b919596b8865e2d3328d34f45f..0df515477577ebd4021aeef55d1509765477a72d 100644 (file)
@@ -768,6 +768,7 @@ typedef struct xfs_log_item {
        xfs_lsn_t                       li_lsn;         /* last on-disk lsn */
        struct xfs_log_item_desc        *li_desc;       /* ptr to current desc*/
        struct xfs_mount                *li_mountp;     /* ptr to fs mount */
+       struct xfs_ail                  *li_ailp;       /* ptr to AIL */
        uint                            li_type;        /* item type */
        uint                            li_flags;       /* misc flags */
        struct xfs_log_item             *li_bio_list;   /* buffer item list */
index 3c666e8317f82bd3f0e41451a06bd39d3c9ff8db..e110bf57d7f496ddd70ce9f4927da8d67fa20545 100644 (file)
 #include "xfs_inum.h"
 #include "xfs_trans.h"
 #include "xfs_trans_priv.h"
+/* XXX: from here down needed until struct xfs_trans has it's own ailp */
+#include "xfs_bit.h"
+#include "xfs_buf_item.h"
+#include "xfs_sb.h"
+#include "xfs_ag.h"
+#include "xfs_dir2.h"
+#include "xfs_dmapi.h"
+#include "xfs_mount.h"
 
 STATIC int     xfs_trans_unlock_chunk(xfs_log_item_chunk_t *,
                                        int, int, xfs_lsn_t);
@@ -79,6 +87,7 @@ xfs_trans_add_item(xfs_trans_t *tp, xfs_log_item_t *lip)
                lidp->lid_size = 0;
                lip->li_desc = lidp;
                lip->li_mountp = tp->t_mountp;
+               lip->li_ailp = tp->t_mountp->m_ail;
                return lidp;
        }
 
@@ -120,6 +129,7 @@ xfs_trans_add_item(xfs_trans_t *tp, xfs_log_item_t *lip)
        lidp->lid_size = 0;
        lip->li_desc = lidp;
        lip->li_mountp = tp->t_mountp;
+       lip->li_ailp = tp->t_mountp->m_ail;
        return lidp;
 }