Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 37166
b: refs/heads/master
c: 6216ff1
h: refs/heads/master
v: v3
  • Loading branch information
Vlad Apostolov authored and Tim Shimmin committed Sep 28, 2006
1 parent 9a8e60b commit 5e2f7ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f273ab848b7cbc0088b0ac7457b3769e6566074e
refs/heads/master: 6216ff18839bf302805f67c93e8bc344387c513b
17 changes: 11 additions & 6 deletions trunk/fs/xfs/linux-2.6/kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 5e2f7ae

Please sign in to comment.