Moved the definition of the BlockAddressPool class into block_allocator.cpp, as it's
not used outside of it. Added tracking for the last transaction in the block cache; that way it can test if the last transaction has been closed before opening a new one. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13022 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+8
@@ -82,6 +82,9 @@ static void
|
||||
delete_transaction(block_cache *cache, cache_transaction *transaction)
|
||||
{
|
||||
hash_remove(cache->transaction_hash, transaction);
|
||||
if (cache->last_transaction == transaction)
|
||||
cache->last_transaction = NULL;
|
||||
|
||||
delete transaction;
|
||||
}
|
||||
|
||||
@@ -132,6 +135,7 @@ block_cache::block_cache(int _fd, off_t numBlocks, size_t blockSize)
|
||||
max_blocks(numBlocks),
|
||||
block_size(blockSize),
|
||||
next_transaction_id(1),
|
||||
last_transaction(NULL),
|
||||
transaction_hash(NULL),
|
||||
ranges_hash(NULL),
|
||||
free_ranges(NULL)
|
||||
@@ -522,6 +526,9 @@ cache_start_transaction(void *_cache)
|
||||
{
|
||||
block_cache *cache = (block_cache *)_cache;
|
||||
|
||||
if (cache->last_transaction && cache->last_transaction->open)
|
||||
panic("last transaction (%ld) still open!\n", cache->last_transaction->id);
|
||||
|
||||
cache_transaction *transaction = new cache_transaction;
|
||||
if (transaction == NULL)
|
||||
return B_NO_MEMORY;
|
||||
@@ -532,6 +539,7 @@ cache_start_transaction(void *_cache)
|
||||
transaction->notification_hook = NULL;
|
||||
transaction->notification_data = NULL;
|
||||
transaction->open = true;
|
||||
cache->last_transaction = transaction;
|
||||
|
||||
TRACE(("cache_transaction_start(): id %ld started\n", transaction->id));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user