diff options
Diffstat (limited to 'fs/xfs/linux-2.6/kmem.c')
-rw-r--r-- | fs/xfs/linux-2.6/kmem.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index f77fe5c8fcc1..80b9340488e5 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c | |||
@@ -68,6 +68,22 @@ kmem_zalloc(size_t size, unsigned int __nocast flags) | |||
68 | return ptr; | 68 | return ptr; |
69 | } | 69 | } |
70 | 70 | ||
71 | void * | ||
72 | kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize, | ||
73 | unsigned int __nocast flags) | ||
74 | { | ||
75 | void *ptr; | ||
76 | |||
77 | while (!(ptr = kmem_zalloc(maxsize, flags))) { | ||
78 | if ((maxsize >>= 1) <= minsize) { | ||
79 | maxsize = minsize; | ||
80 | flags = KM_SLEEP; | ||
81 | } | ||
82 | } | ||
83 | *size = maxsize; | ||
84 | return ptr; | ||
85 | } | ||
86 | |||
71 | void | 87 | void |
72 | kmem_free(void *ptr, size_t size) | 88 | kmem_free(void *ptr, size_t size) |
73 | { | 89 | { |