* If a block allocation fails, remove an unused one and try again - this might

improve the reliability as long as our slab implementation is a PITA.
* Removed an assertion that will no longer work (due to the DoublyLinkedList
  changes).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34877 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2010-01-03 19:08:40 +00:00
parent e045a8c0df
commit e7385fa68e
1 changed files with 10 additions and 7 deletions

View File

@ -1000,6 +1000,13 @@ block_cache::Allocate()
RemoveUnusedBlocks(1, 2);
}
void* block = object_cache_alloc(buffer_cache, 0);
if (block != NULL)
return block;
// recycle existing before allocating a new one
RemoveUnusedBlocks(1, 2);
return object_cache_alloc(buffer_cache, 0);
}
@ -1332,9 +1339,9 @@ retry:
// The block is currently busy - wait and try again later
ConditionVariableEntry entry;
cache->busy_condition.Add(&entry);
mutex_unlock(&cache->lock);
entry.Wait();
mutex_lock(&cache->lock);
@ -2125,10 +2132,6 @@ wait_for_notifications(block_cache* cache)
// wait for notification hook to be called
entry.Wait();
ASSERT(notification.GetDoublyLinkedListLink()->next == NULL
&& notification.GetDoublyLinkedListLink()->previous == NULL
&& cache->pending_notifications.Head() != &notification);
}
@ -2782,7 +2785,7 @@ block_cache_delete(void* _cache, bool allowWrites)
cache->busy_condition.Add(&entry);
mutex_unlock(&cache->lock);
entry.Wait();
mutex_lock(&cache->lock);