xfs: Replace per-ag array with a radix tree
[safe/jmp/linux-2.6] / fs / xfs / xfs_mount.h
index f8a68a2..cfa7a5d 100644 (file)
@@ -207,8 +207,8 @@ typedef struct xfs_mount {
        uint                    m_ag_maxlevels; /* XFS_AG_MAXLEVELS */
        uint                    m_bm_maxlevels[2]; /* XFS_BM_MAXLEVELS */
        uint                    m_in_maxlevels; /* max inobt btree levels. */
-       struct xfs_perag        *m_perag;       /* per-ag accounting info */
-       struct rw_semaphore     m_peraglock;    /* lock for m_perag (pointer) */
+       struct radix_tree_root  m_perag_tree;   /* per-ag accounting info */
+       spinlock_t              m_perag_lock;   /* lock for m_perag_tree */
        struct mutex            m_growlock;     /* growfs mutex */
        int                     m_fixedfsid[2]; /* unchanged for life of FS */
        uint                    m_dmevmask;     /* DMI events for this FS */
@@ -389,7 +389,12 @@ xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
 static inline struct xfs_perag *
 xfs_perag_get(struct xfs_mount *mp, xfs_agnumber_t agno)
 {
-       return &mp->m_perag[agno];
+       struct xfs_perag        *pag;
+
+       spin_lock(&mp->m_perag_lock);
+       pag = radix_tree_lookup(&mp->m_perag_tree, agno);
+       spin_unlock(&mp->m_perag_lock);
+       return pag;
 }
 
 static inline void
@@ -450,7 +455,8 @@ extern struct xfs_dmops xfs_dmcore_xfs;
 #endif /* __KERNEL__ */
 
 extern void    xfs_mod_sb(struct xfs_trans *, __int64_t);
-extern xfs_agnumber_t  xfs_initialize_perag(struct xfs_mount *, xfs_agnumber_t);
+extern int     xfs_initialize_perag(struct xfs_mount *, xfs_agnumber_t,
+                                       xfs_agnumber_t *);
 extern void    xfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
 extern void    xfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *, __int64_t);