block_range::Delete() did not remove the block_range from the free list,

and thus, it could be used again which led to a crash.
Changed the free ranges list from a singly linked list to a doubly linked
list so that not all free ranges have to be searched for the one to be
freed anymore.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15696 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-12-28 16:40:05 +00:00
parent 3dcaf063c2
commit 529bf1c6d7
3 changed files with 17 additions and 25 deletions
+3 -4
View File
@@ -153,8 +153,7 @@ block_cache::block_cache(int _fd, off_t numBlocks, size_t blockSize)
next_transaction_id(1),
last_transaction(NULL),
transaction_hash(NULL),
ranges_hash(NULL),
free_ranges(NULL)
ranges_hash(NULL)
{
hash = hash_init(32, 0, &cached_block::Compare, &cached_block::Hash);
if (hash == NULL)
@@ -208,8 +207,8 @@ block_cache::InitCheck()
block_range *
block_cache::GetFreeRange()
{
if (free_ranges != NULL)
return free_ranges;
if (!free_ranges.IsEmpty())
return free_ranges.First();
// we need to allocate a new range
block_range *range;