* 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:
parent
e045a8c0df
commit
e7385fa68e
|
@ -1000,6 +1000,13 @@ block_cache::Allocate()
|
||||||
RemoveUnusedBlocks(1, 2);
|
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);
|
return object_cache_alloc(buffer_cache, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1332,9 +1339,9 @@ retry:
|
||||||
// The block is currently busy - wait and try again later
|
// The block is currently busy - wait and try again later
|
||||||
ConditionVariableEntry entry;
|
ConditionVariableEntry entry;
|
||||||
cache->busy_condition.Add(&entry);
|
cache->busy_condition.Add(&entry);
|
||||||
|
|
||||||
mutex_unlock(&cache->lock);
|
mutex_unlock(&cache->lock);
|
||||||
|
|
||||||
entry.Wait();
|
entry.Wait();
|
||||||
|
|
||||||
mutex_lock(&cache->lock);
|
mutex_lock(&cache->lock);
|
||||||
|
@ -2125,10 +2132,6 @@ wait_for_notifications(block_cache* cache)
|
||||||
|
|
||||||
// wait for notification hook to be called
|
// wait for notification hook to be called
|
||||||
entry.Wait();
|
entry.Wait();
|
||||||
|
|
||||||
ASSERT(notification.GetDoublyLinkedListLink()->next == NULL
|
|
||||||
&& notification.GetDoublyLinkedListLink()->previous == NULL
|
|
||||||
&& cache->pending_notifications.Head() != ¬ification);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2782,7 +2785,7 @@ block_cache_delete(void* _cache, bool allowWrites)
|
||||||
cache->busy_condition.Add(&entry);
|
cache->busy_condition.Add(&entry);
|
||||||
|
|
||||||
mutex_unlock(&cache->lock);
|
mutex_unlock(&cache->lock);
|
||||||
|
|
||||||
entry.Wait();
|
entry.Wait();
|
||||||
|
|
||||||
mutex_lock(&cache->lock);
|
mutex_lock(&cache->lock);
|
||||||
|
|
Loading…
Reference in New Issue