diff options
author | Nathan Scott <nathans@sgi.com> | 2006-09-27 21:03:27 -0400 |
---|---|---|
committer | Tim Shimmin <tes@sgi.com> | 2006-09-27 21:03:27 -0400 |
commit | 77e4635ae191774526ed695482a151ac986f3806 (patch) | |
tree | 42cfa03f913883cd7f3d53be19b7e8c25258ee2c /fs/xfs/xfs_itable.c | |
parent | 572d95f49f3652fffe8242c4498b85f4083e52ab (diff) |
[XFS] Add a greedy allocation interface, allocating within a min/max size
range.
SGI-PV: 955302
SGI-Modid: xfs-linux-melb:xfs-kern:26803a
Signed-off-by: Nathan Scott <nathans@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_itable.c')
-rw-r--r-- | fs/xfs/xfs_itable.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index 612689940659..0fbbd7b9c696 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
@@ -326,7 +326,6 @@ xfs_bulkstat( | |||
326 | int i; /* loop index */ | 326 | int i; /* loop index */ |
327 | int icount; /* count of inodes good in irbuf */ | 327 | int icount; /* count of inodes good in irbuf */ |
328 | int irbsize; /* size of irec buffer in bytes */ | 328 | int irbsize; /* size of irec buffer in bytes */ |
329 | unsigned int kmflags; /* flags for allocating irec buffer */ | ||
330 | xfs_ino_t ino; /* inode number (filesystem) */ | 329 | xfs_ino_t ino; /* inode number (filesystem) */ |
331 | xfs_inobt_rec_incore_t *irbp; /* current irec buffer pointer */ | 330 | xfs_inobt_rec_incore_t *irbp; /* current irec buffer pointer */ |
332 | xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */ | 331 | xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */ |
@@ -371,19 +370,8 @@ xfs_bulkstat( | |||
371 | (XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog); | 370 | (XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog); |
372 | nimask = ~(nicluster - 1); | 371 | nimask = ~(nicluster - 1); |
373 | nbcluster = nicluster >> mp->m_sb.sb_inopblog; | 372 | nbcluster = nicluster >> mp->m_sb.sb_inopblog; |
374 | /* | 373 | irbuf = kmem_zalloc_greedy(&irbsize, NBPC, NBPC * 4, |
375 | * Allocate a local buffer for inode cluster btree records. | 374 | KM_SLEEP | KM_MAYFAIL | KM_LARGE); |
376 | * This caps our maximum readahead window (so don't be stingy) | ||
377 | * but we must handle the case where we can't get a contiguous | ||
378 | * multi-page buffer, so we drop back toward pagesize; the end | ||
379 | * case we ensure succeeds, via appropriate allocation flags. | ||
380 | */ | ||
381 | irbsize = NBPP * 4; | ||
382 | kmflags = KM_SLEEP | KM_MAYFAIL; | ||
383 | while (!(irbuf = kmem_alloc(irbsize, kmflags))) { | ||
384 | if ((irbsize >>= 1) <= NBPP) | ||
385 | kmflags = KM_SLEEP; | ||
386 | } | ||
387 | nirbuf = irbsize / sizeof(*irbuf); | 375 | nirbuf = irbsize / sizeof(*irbuf); |
388 | 376 | ||
389 | /* | 377 | /* |