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_iget.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_iget.c')
-rw-r--r-- | fs/xfs/xfs_iget.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 30eebc2fd90e..e304ab078273 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -50,7 +50,7 @@ void | |||
50 | xfs_ihash_init(xfs_mount_t *mp) | 50 | xfs_ihash_init(xfs_mount_t *mp) |
51 | { | 51 | { |
52 | __uint64_t icount; | 52 | __uint64_t icount; |
53 | uint i, flags = KM_SLEEP | KM_MAYFAIL | KM_LARGE; | 53 | uint i; |
54 | 54 | ||
55 | if (!mp->m_ihsize) { | 55 | if (!mp->m_ihsize) { |
56 | icount = mp->m_maxicount ? mp->m_maxicount : | 56 | icount = mp->m_maxicount ? mp->m_maxicount : |
@@ -61,14 +61,13 @@ xfs_ihash_init(xfs_mount_t *mp) | |||
61 | (64 * NBPP) / sizeof(xfs_ihash_t)); | 61 | (64 * NBPP) / sizeof(xfs_ihash_t)); |
62 | } | 62 | } |
63 | 63 | ||
64 | while (!(mp->m_ihash = (xfs_ihash_t *)kmem_zalloc(mp->m_ihsize * | 64 | mp->m_ihash = kmem_zalloc_greedy(&mp->m_ihsize, |
65 | sizeof(xfs_ihash_t), flags))) { | 65 | NBPC * sizeof(xfs_ihash_t), |
66 | if ((mp->m_ihsize >>= 1) <= NBPP) | 66 | mp->m_ihsize * sizeof(xfs_ihash_t), |
67 | flags = KM_SLEEP; | 67 | KM_SLEEP | KM_MAYFAIL | KM_LARGE); |
68 | } | 68 | mp->m_ihsize /= sizeof(xfs_ihash_t); |
69 | for (i = 0; i < mp->m_ihsize; i++) { | 69 | for (i = 0; i < mp->m_ihsize; i++) |
70 | rwlock_init(&(mp->m_ihash[i].ih_lock)); | 70 | rwlock_init(&(mp->m_ihash[i].ih_lock)); |
71 | } | ||
72 | } | 71 | } |
73 | 72 | ||
74 | /* | 73 | /* |
@@ -77,7 +76,7 @@ xfs_ihash_init(xfs_mount_t *mp) | |||
77 | void | 76 | void |
78 | xfs_ihash_free(xfs_mount_t *mp) | 77 | xfs_ihash_free(xfs_mount_t *mp) |
79 | { | 78 | { |
80 | kmem_free(mp->m_ihash, mp->m_ihsize*sizeof(xfs_ihash_t)); | 79 | kmem_free(mp->m_ihash, mp->m_ihsize * sizeof(xfs_ihash_t)); |
81 | mp->m_ihash = NULL; | 80 | mp->m_ihash = NULL; |
82 | } | 81 | } |
83 | 82 | ||