aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorVlad Apostolov <vapo@sgi.com>2006-09-28 11:06:10 +1000
committerTim Shimmin <tes@sgi.com>2006-09-28 11:06:10 +1000
commit6216ff18839bf302805f67c93e8bc344387c513b (patch)
tree3b94cb694ef8277ab0006cb2363dadfe7c348124 /fs
parentf273ab848b7cbc0088b0ac7457b3769e6566074e (diff)
downloadkernel_samsung_tuna-6216ff18839bf302805f67c93e8bc344387c513b.zip
kernel_samsung_tuna-6216ff18839bf302805f67c93e8bc344387c513b.tar.gz
kernel_samsung_tuna-6216ff18839bf302805f67c93e8bc344387c513b.tar.bz2
[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')
-rw-r--r--fs/xfs/linux-2.6/kmem.c17
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 80b9340..d597375 100644
--- a/fs/xfs/linux-2.6/kmem.c
+++ b/fs/xfs/linux-2.6/kmem.c
@@ -72,15 +72,20 @@ void *
kmem_zalloc_greedy(size_t *size, size_t minsize, size_t maxsize,
unsigned int __nocast flags)
{
- void *ptr;
+ void *ptr;
+ size_t kmsize = maxsize;
+ unsigned int kmflags = (flags & ~KM_SLEEP) | KM_NOSLEEP;
- while (!(ptr = kmem_zalloc(maxsize, flags))) {
- if ((maxsize >>= 1) <= minsize) {
- maxsize = minsize;
- flags = KM_SLEEP;
+ while (!(ptr = kmem_zalloc(kmsize, kmflags))) {
+ if ((kmsize <= minsize) && (flags & KM_NOSLEEP))
+ break;
+ if ((kmsize >>= 1) <= minsize) {
+ kmsize = minsize;
+ kmflags = flags;
}
}
- *size = maxsize;
+ if (ptr)
+ *size = kmsize;
return ptr;
}