Looks like some bloke forgot to commit *some* files that should have been part

of r24768 (block cache notification mechanism rewrite).
Thanks for the note, Vasilis!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24772 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-04-03 14:14:27 +00:00
parent 4b7af69340
commit e63c117011
5 changed files with 23 additions and 23 deletions
+7 -5
View File
@@ -11,11 +11,12 @@
#include <fs_interface.h> #include <fs_interface.h>
/* transaction events */
enum { enum {
TRANSACTION_WRITTEN, TRANSACTION_WRITTEN = 0x01,
TRANSACTION_ABORTED, TRANSACTION_ABORTED = 0x02,
TRANSACTION_ENDED, TRANSACTION_ENDED = 0x04,
TRANSACTION_IDLE TRANSACTION_IDLE = 0x08
}; };
typedef void (*transaction_notification_hook)(int32 id, int32 event, typedef void (*transaction_notification_hook)(int32 id, int32 event,
@@ -36,7 +37,8 @@ extern int32 cache_detach_sub_transaction(void *_cache, int32 id,
extern status_t cache_abort_sub_transaction(void *_cache, int32 id); extern status_t cache_abort_sub_transaction(void *_cache, int32 id);
extern status_t cache_start_sub_transaction(void *_cache, int32 id); extern status_t cache_start_sub_transaction(void *_cache, int32 id);
extern status_t cache_add_transaction_listener(void *_cache, int32 id, extern status_t cache_add_transaction_listener(void *_cache, int32 id,
transaction_notification_hook hook, void *data); int32 events, transaction_notification_hook hook,
void *data);
extern status_t cache_remove_transaction_listener(void *_cache, int32 id, extern status_t cache_remove_transaction_listener(void *_cache, int32 id,
transaction_notification_hook hook, void *data); transaction_notification_hook hook, void *data);
extern status_t cache_next_block_in_transaction(void *_cache, int32 id, extern status_t cache_next_block_in_transaction(void *_cache, int32 id,
+6 -5
View File
@@ -12,10 +12,10 @@
enum { enum {
FSSH_TRANSACTION_WRITTEN, FSSH_TRANSACTION_WRITTEN = 0x01,
FSSH_TRANSACTION_ABORTED, FSSH_TRANSACTION_ABORTED = 0x02,
FSSH_TRANSACTION_ENDED, FSSH_TRANSACTION_ENDED = 0x04,
FSSH_TRANSACTION_IDLE FSSH_TRANSACTION_IDLE = 0x08
}; };
typedef void (*fssh_transaction_notification_hook)(int32_t id, int32_t event, typedef void (*fssh_transaction_notification_hook)(int32_t id, int32_t event,
@@ -40,7 +40,8 @@ extern fssh_status_t fssh_cache_abort_sub_transaction(void *_cache,
extern fssh_status_t fssh_cache_start_sub_transaction(void *_cache, extern fssh_status_t fssh_cache_start_sub_transaction(void *_cache,
int32_t id); int32_t id);
extern fssh_status_t fssh_cache_add_transaction_listener(void *_cache, extern fssh_status_t fssh_cache_add_transaction_listener(void *_cache,
int32_t id, fssh_transaction_notification_hook hook, int32_t id, int32_t events,
fssh_transaction_notification_hook hook,
void *data); void *data);
extern fssh_status_t fssh_cache_remove_transaction_listener(void *_cache, extern fssh_status_t fssh_cache_remove_transaction_listener(void *_cache,
int32_t id, fssh_transaction_notification_hook hook, int32_t id, fssh_transaction_notification_hook hook,
@@ -252,7 +252,7 @@ InodeAllocator::Keep()
if (status == B_OK) { if (status == B_OK) {
cache_add_transaction_listener(volume->BlockCache(), fTransaction->ID(), cache_add_transaction_listener(volume->BlockCache(), fTransaction->ID(),
&_TransactionListener, fInode); TRANSACTION_ABORTED, &_TransactionListener, fInode);
} }
fTransaction = NULL; fTransaction = NULL;
@@ -536,9 +536,6 @@ Journal::_TransactionWritten(int32 transactionID, int32 event, void *_logEntry)
{ {
LogEntry *logEntry = (LogEntry *)_logEntry; LogEntry *logEntry = (LogEntry *)_logEntry;
if (event != TRANSACTION_WRITTEN)
return;
PRINT(("Log entry %p has been finished, transaction ID = %ld\n", logEntry, PRINT(("Log entry %p has been finished, transaction ID = %ld\n", logEntry,
transactionID)); transactionID));
@@ -588,9 +585,6 @@ Journal::_TransactionWritten(int32 transactionID, int32 event, void *_logEntry)
/*static*/ void /*static*/ void
Journal::_TransactionListener(int32 transactionID, int32 event, void *_journal) Journal::_TransactionListener(int32 transactionID, int32 event, void *_journal)
{ {
if (event != TRANSACTION_IDLE)
return;
// The current transaction seems to be idle - flush it // The current transaction seems to be idle - flush it
Journal *journal = (Journal *)_journal; Journal *journal = (Journal *)_journal;
@@ -865,7 +859,7 @@ Journal::Lock(Transaction *owner)
} }
cache_add_transaction_listener(fVolume->BlockCache(), fTransactionID, cache_add_transaction_listener(fVolume->BlockCache(), fTransactionID,
_TransactionListener, this); TRANSACTION_IDLE, _TransactionListener, this);
return B_OK; return B_OK;
} }
+8 -5
View File
@@ -50,7 +50,7 @@ struct cache_hook : DoublyLinkedListLinkImpl<cache_hook> {
void *data; void *data;
}; };
typedef DoublyLinkedList<cache_hook> HookList; typedef DoublyLinkedList<cache_hook> HookList;
struct cache_transaction { struct cache_transaction {
cache_transaction(); cache_transaction();
@@ -377,7 +377,7 @@ put_cached_block(block_cache *cache, fssh_off_t blockNumber)
fssh_panic("put_cached_block: invalid block number %lld (max %lld)", fssh_panic("put_cached_block: invalid block number %lld (max %lld)",
blockNumber, cache->max_blocks - 1); blockNumber, cache->max_blocks - 1);
} }
cached_block *block = (cached_block *)hash_lookup(cache->hash, &blockNumber); cached_block *block = (cached_block *)hash_lookup(cache->hash, &blockNumber);
if (block != NULL) if (block != NULL)
put_cached_block(cache, block); put_cached_block(cache, block);
@@ -974,9 +974,11 @@ fssh_cache_start_sub_transaction(void *_cache, int32_t id)
The listener gets automatically removed in this case. The listener gets automatically removed in this case.
*/ */
fssh_status_t fssh_status_t
fssh_cache_add_transaction_listener(void *_cache, int32_t id, fssh_cache_add_transaction_listener(void *_cache, int32_t id, int32_t events,
fssh_transaction_notification_hook hookFunction, void *data) fssh_transaction_notification_hook hookFunction, void *data)
{ {
// TODO: this is currently not used in a critical context in BFS
#if 0
block_cache *cache = (block_cache *)_cache; block_cache *cache = (block_cache *)_cache;
cache_hook *hook = new(std::nothrow) cache_hook; cache_hook *hook = new(std::nothrow) cache_hook;
@@ -995,6 +997,7 @@ fssh_cache_add_transaction_listener(void *_cache, int32_t id,
hook->data = data; hook->data = data;
transaction->listeners.Add(hook); transaction->listeners.Add(hook);
#endif
return FSSH_B_OK; return FSSH_B_OK;
} }
@@ -1061,7 +1064,7 @@ fssh_cache_next_block_in_transaction(void *_cache, int32_t id, bool mainOnly,
*_unchangedData = block->original_data; *_unchangedData = block->original_data;
*_cookie = (fssh_addr_t)block; *_cookie = (fssh_addr_t)block;
return FSSH_B_OK; return FSSH_B_OK;
} }
@@ -1130,7 +1133,7 @@ fssh_block_cache_delete(void *_cache, bool allowWrites)
cache->FreeBlock(block); cache->FreeBlock(block);
} }
// free all transactions (they will all be aborted) // free all transactions (they will all be aborted)
cookie = 0; cookie = 0;
cache_transaction *transaction; cache_transaction *transaction;