* Fixed bug #2631 based on a patch by Salvatore: the block cache was put into
a global list before it was fully initialized. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27058 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
7fd3b44794
commit
1d136d5a76
18
src/system/kernel/cache/block_cache.cpp
vendored
18
src/system/kernel/cache/block_cache.cpp
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
* Copyright 2004-2008, Axel Dörfler, axeld@pinc-software.de.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -771,10 +771,6 @@ block_cache::block_cache(int _fd, off_t numBlocks, size_t blockSize,
|
|||||||
read_only(readOnly),
|
read_only(readOnly),
|
||||||
deleting(false)
|
deleting(false)
|
||||||
{
|
{
|
||||||
mutex_lock(&sCachesLock);
|
|
||||||
sCaches.Add(this);
|
|
||||||
mutex_unlock(&sCachesLock);
|
|
||||||
|
|
||||||
condition_variable.Publish(this, "cache transaction sync");
|
condition_variable.Publish(this, "cache transaction sync");
|
||||||
|
|
||||||
buffer_cache = create_object_cache_etc("block cache buffers", blockSize,
|
buffer_cache = create_object_cache_etc("block cache buffers", blockSize,
|
||||||
@ -793,8 +789,12 @@ block_cache::block_cache(int _fd, off_t numBlocks, size_t blockSize,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mutex_init(&lock, "block cache");
|
mutex_init(&lock, "block cache");
|
||||||
|
|
||||||
register_low_resource_handler(&block_cache::LowMemoryHandler, this,
|
register_low_resource_handler(&block_cache::LowMemoryHandler, this,
|
||||||
B_KERNEL_RESOURCE_PAGES | B_KERNEL_RESOURCE_MEMORY, 0);
|
B_KERNEL_RESOURCE_PAGES | B_KERNEL_RESOURCE_MEMORY, 0);
|
||||||
|
|
||||||
|
MutexLocker _(sCachesLock);
|
||||||
|
sCaches.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -803,16 +803,16 @@ block_cache::~block_cache()
|
|||||||
{
|
{
|
||||||
deleting = true;
|
deleting = true;
|
||||||
|
|
||||||
|
mutex_lock(&sCachesLock);
|
||||||
|
sCaches.Remove(this);
|
||||||
|
mutex_unlock(&sCachesLock);
|
||||||
|
|
||||||
unregister_low_resource_handler(&block_cache::LowMemoryHandler, this);
|
unregister_low_resource_handler(&block_cache::LowMemoryHandler, this);
|
||||||
|
|
||||||
mutex_destroy(&lock);
|
mutex_destroy(&lock);
|
||||||
|
|
||||||
condition_variable.Unpublish();
|
condition_variable.Unpublish();
|
||||||
|
|
||||||
mutex_lock(&sCachesLock);
|
|
||||||
sCaches.Remove(this);
|
|
||||||
mutex_unlock(&sCachesLock);
|
|
||||||
|
|
||||||
hash_uninit(transaction_hash);
|
hash_uninit(transaction_hash);
|
||||||
hash_uninit(hash);
|
hash_uninit(hash);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user