* wait_for_notifications() must make sure that the order of the notifications
in the cache is the same as in the condition variable. It now uses the low-contention sCachesLock to accomplish this. * Also added an ASSERT to make sure the notification is no longer part of the list at this point. * Improved KDL command output. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28516 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+9
-1
@@ -1431,6 +1431,8 @@ dump_cache(int argc, char** argv)
|
|||||||
kprintf(" is-dirty");
|
kprintf(" is-dirty");
|
||||||
if (block->unused)
|
if (block->unused)
|
||||||
kprintf(" unused");
|
kprintf(" unused");
|
||||||
|
if (block->discard)
|
||||||
|
kprintf(" discard");
|
||||||
kprintf("\n");
|
kprintf("\n");
|
||||||
if (block->transaction != NULL) {
|
if (block->transaction != NULL) {
|
||||||
kprintf(" transaction: %p (%ld)\n", block->transaction,
|
kprintf(" transaction: %p (%ld)\n", block->transaction,
|
||||||
@@ -1771,10 +1773,11 @@ is_valid_cache(block_cache* cache)
|
|||||||
static void
|
static void
|
||||||
wait_for_notifications(block_cache* cache)
|
wait_for_notifications(block_cache* cache)
|
||||||
{
|
{
|
||||||
|
MutexLocker locker(sCachesLock);
|
||||||
|
|
||||||
if (find_thread(NULL) == sNotifierWriterThread) {
|
if (find_thread(NULL) == sNotifierWriterThread) {
|
||||||
// We're the notifier thread, don't wait, but flush all pending
|
// We're the notifier thread, don't wait, but flush all pending
|
||||||
// notifications directly.
|
// notifications directly.
|
||||||
MutexLocker _(sCachesLock);
|
|
||||||
if (is_valid_cache(cache))
|
if (is_valid_cache(cache))
|
||||||
flush_pending_notifications(cache);
|
flush_pending_notifications(cache);
|
||||||
return;
|
return;
|
||||||
@@ -1789,9 +1792,14 @@ wait_for_notifications(block_cache* cache)
|
|||||||
cache->condition_variable.Add(&entry);
|
cache->condition_variable.Add(&entry);
|
||||||
|
|
||||||
add_notification(cache, ¬ification, TRANSACTION_WRITTEN, false);
|
add_notification(cache, ¬ification, TRANSACTION_WRITTEN, false);
|
||||||
|
locker.Unlock();
|
||||||
|
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user