diff options
author | Vlad Apostolov <vapo@sgi.com> | 2006-09-27 21:06:10 -0400 |
---|---|---|
committer | Tim Shimmin <tes@sgi.com> | 2006-09-27 21:06:10 -0400 |
commit | 6216ff18839bf302805f67c93e8bc344387c513b (patch) | |
tree | 3b94cb694ef8277ab0006cb2363dadfe7c348124 /fs/xfs/linux-2.6/kmem.c | |
parent | f273ab848b7cbc0088b0ac7457b3769e6566074e (diff) |
[XFS] pv 956240, author: nathans, rv: vapo - Minor fixes in
kmem_zalloc_greedy()
SGI-PV: 956240
SGI-Modid: xfs-linux-melb:xfs-kern:26983a
Signed-off-by: Vlad Apostolov <vapo@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/kmem.c')
-rw-r--r-- | fs/xfs/linux-2.6/kmem.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index 80b9340488e5..d59737589815 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c | |||
@@ -72,15 +72,20 @@ void * | |||
72 | kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize, | 72 | kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize, |
73 | unsigned int __nocast flags) | 73 | unsigned int __nocast flags) |
74 | { | 74 | { |
75 | void *ptr; | 75 | void *ptr; |
76 | size_t kmsize = maxsize; | ||
77 | unsigned int kmflags = (flags & ~KM_SLEEP) | KM_NOSLEEP; | ||
76 | 78 | ||
77 | while (!(ptr = kmem_zalloc(maxsize, flags))) { | 79 | while (!(ptr = kmem_zalloc(kmsize, kmflags))) { |
78 | if ((maxsize >>= 1) <= minsize) { | 80 | if ((kmsize <= minsize) && (flags & KM_NOSLEEP)) |
79 | maxsize = minsize; | 81 | break; |
80 | flags = KM_SLEEP; | 82 | if ((kmsize >>= 1) <= minsize) { |
83 | kmsize = minsize; | ||
84 | kmflags = flags; | ||
81 | } | 85 | } |
82 | } | 86 | } |
83 | *size = maxsize; | 87 | if (ptr) |
88 | *size = kmsize; | ||
84 | return ptr; | 89 | return ptr; |
85 | } | 90 | } |
86 | 91 | ||