Commit e57336ff7fc7520bec7b3a7741043bdebaf622ea

Authored by Dave Chinner
Committed by Alex Elder
1 parent 8b26c5825e

xfs: embed the pagb_list array in the perag structure

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>

Showing 3 changed files with 5 additions and 12 deletions Side-by-side Diff

... ... @@ -187,14 +187,8 @@
187 187 /*
188 188 * Per-ag incore structure, copies of information in agf and agi,
189 189 * to improve the performance of allocation group selection.
190   - *
191   - * pick sizes which fit in allocation buckets well
192 190 */
193   -#if (BITS_PER_LONG == 32)
194   -#define XFS_PAGB_NUM_SLOTS 84
195   -#elif (BITS_PER_LONG == 64)
196 191 #define XFS_PAGB_NUM_SLOTS 128
197   -#endif
198 192  
199 193 typedef struct xfs_perag {
200 194 struct xfs_mount *pag_mount; /* owner filesystem */
... ... @@ -212,8 +206,6 @@
212 206 __uint32_t pagf_btreeblks; /* # of blocks held in AGF btrees */
213 207 xfs_agino_t pagi_freecount; /* number of free inodes */
214 208 xfs_agino_t pagi_count; /* number of allocated inodes */
215   - int pagb_count; /* pagb slots in use */
216   - xfs_perag_busy_t *pagb_list; /* unstable blocks */
217 209  
218 210 /*
219 211 * Inode allocation search lookup optimisation.
... ... @@ -232,6 +224,8 @@
232 224 rwlock_t pag_ici_lock; /* incore inode lock */
233 225 struct radix_tree_root pag_ici_root; /* incore inode cache root */
234 226 #endif
  227 + int pagb_count; /* pagb slots in use */
  228 + xfs_perag_busy_t pagb_list[XFS_PAGB_NUM_SLOTS]; /* unstable blocks */
235 229 } xfs_perag_t;
236 230  
237 231 /*
... ... @@ -2200,8 +2200,8 @@
2200 2200 pag->pagf_levels[XFS_BTNUM_CNTi] =
2201 2201 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]);
2202 2202 spin_lock_init(&pag->pagb_lock);
2203   - pag->pagb_list = kmem_zalloc(XFS_PAGB_NUM_SLOTS *
2204   - sizeof(xfs_perag_busy_t), KM_SLEEP);
  2203 + pag->pagb_count = 0;
  2204 + memset(pag->pagb_list, 0, sizeof(pag->pagb_list));
2205 2205 pag->pagf_init = 1;
2206 2206 }
2207 2207 #ifdef DEBUG
... ... @@ -247,10 +247,9 @@
247 247 for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
248 248 spin_lock(&mp->m_perag_lock);
249 249 pag = radix_tree_delete(&mp->m_perag_tree, agno);
  250 + ASSERT(pag);
250 251 ASSERT(atomic_read(&pag->pag_ref) == 0);
251 252 spin_unlock(&mp->m_perag_lock);
252   - ASSERT(pag);
253   - kmem_free(pag->pagb_list);
254 253 kmem_free(pag);
255 254 }
256 255 }