]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
xfs: embed the pagb_list array in the perag structure
authorDave Chinner <david@fromorbit.com>
Mon, 11 Jan 2010 11:47:49 +0000 (11:47 +0000)
committerAlex Elder <aelder@sgi.com>
Fri, 15 Jan 2010 21:34:39 +0000 (15:34 -0600)
Now that the perag structure is allocated memory rather than held in
an array, we don't need to have the busy extent array external to
the structure. Embed it into the perag structure to avoid needing an
extra allocation when setting up.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Alex Elder <aelder@sgi.com>
fs/xfs/xfs_ag.h
fs/xfs/xfs_alloc.c
fs/xfs/xfs_mount.c

index 963bc2700bf7336e38abcc28a1c2b4896b04b2c9..b1a5a1ff88eac58f3618a977b1c3ce0e23e10b0b 100644 (file)
@@ -187,14 +187,8 @@ typedef struct xfs_perag_busy {
 /*
  * Per-ag incore structure, copies of information in agf and agi,
  * to improve the performance of allocation group selection.
- *
- * pick sizes which fit in allocation buckets well
  */
-#if (BITS_PER_LONG == 32)
-#define XFS_PAGB_NUM_SLOTS     84
-#elif (BITS_PER_LONG == 64)
 #define XFS_PAGB_NUM_SLOTS     128
-#endif
 
 typedef struct xfs_perag {
        struct xfs_mount *pag_mount;    /* owner filesystem */
@@ -212,8 +206,6 @@ typedef struct xfs_perag {
        __uint32_t      pagf_btreeblks; /* # of blocks held in AGF btrees */
        xfs_agino_t     pagi_freecount; /* number of free inodes */
        xfs_agino_t     pagi_count;     /* number of allocated inodes */
-       int             pagb_count;     /* pagb slots in use */
-       xfs_perag_busy_t *pagb_list;    /* unstable blocks */
 
        /*
         * Inode allocation search lookup optimisation.
@@ -232,6 +224,8 @@ typedef struct xfs_perag {
        rwlock_t        pag_ici_lock;   /* incore inode lock */
        struct radix_tree_root pag_ici_root;    /* incore inode cache root */
 #endif
+       int             pagb_count;     /* pagb slots in use */
+       xfs_perag_busy_t pagb_list[XFS_PAGB_NUM_SLOTS]; /* unstable blocks */
 } xfs_perag_t;
 
 /*
index 4d66bb75579c0550d2abd4d22e1619d4aa8d2e18..8aa181d6dd7df53bf7222b64c68ea37f72264976 100644 (file)
@@ -2200,8 +2200,8 @@ xfs_alloc_read_agf(
                pag->pagf_levels[XFS_BTNUM_CNTi] =
                        be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]);
                spin_lock_init(&pag->pagb_lock);
-               pag->pagb_list = kmem_zalloc(XFS_PAGB_NUM_SLOTS *
-                                       sizeof(xfs_perag_busy_t), KM_SLEEP);
+               pag->pagb_count = 0;
+               memset(pag->pagb_list, 0, sizeof(pag->pagb_list));
                pag->pagf_init = 1;
        }
 #ifdef DEBUG
index be643e588067fea1d61b37072ddea21bb89dec8b..0df5045abd3b3faddc06f75b0c15dc8bc866069a 100644 (file)
@@ -247,10 +247,9 @@ xfs_free_perag(
        for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
                spin_lock(&mp->m_perag_lock);
                pag = radix_tree_delete(&mp->m_perag_tree, agno);
+               ASSERT(pag);
                ASSERT(atomic_read(&pag->pag_ref) == 0);
                spin_unlock(&mp->m_perag_lock);
-               ASSERT(pag);
-               kmem_free(pag->pagb_list);
                kmem_free(pag);
        }
 }