From 6a7f219c8d45d3ef0137d92b87b219e3482102a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 3 Mar 2010 14:39:26 +0000 Subject: [PATCH] * block_notifier_and_writer() will now flush 1000 blocks when reaching the soft memory limit. * Improved debug output. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35735 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/cache/block_cache.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index 23a03a01a6..5d5cfeee6a 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -2022,6 +2022,9 @@ dump_block_long(cached_block* block) kprintf(" current data: %p\n", block->current_data); kprintf(" original data: %p\n", block->original_data); kprintf(" parent data: %p\n", block->parent_data); +#if BLOCK_CACHE_DEBUG_CHANGED + kprintf(" compare data: %p\n", block->compare); +#endif kprintf(" ref_count: %ld\n", block->ref_count); kprintf(" accessed: %ld\n", block->LastAccess()); kprintf(" flags: "); @@ -2123,6 +2126,7 @@ dump_cache(int argc, char** argv) kprintf(" max_blocks: %Ld\n", cache->max_blocks); kprintf(" block_size: %lu\n", cache->block_size); kprintf(" next_transaction_id: %ld\n", cache->next_transaction_id); + kprintf(" buffer_cache: %p\n", cache->buffer_cache); kprintf(" busy_reading: %lu, %s waiters\n", cache->busy_reading_count, cache->busy_reading_waiters ? "has" : "no"); kprintf(" busy_writing: %lu, %s waiters\n", cache->busy_writing_count, @@ -2447,7 +2451,8 @@ block_notifier_and_writer(void* /*data*/) // write 64 blocks of each block_cache every two seconds // TODO: change this once we have an I/O scheduler timeout = kTimeout; - size_t usedMemory = 0; + size_t usedMemory; + object_cache_get_usage(sBlockCache, &usedMemory); block_cache* cache = NULL; while ((cache = get_next_locked_block_cache(cache)) != NULL) { @@ -2503,7 +2508,7 @@ block_notifier_and_writer(void* /*data*/) > vm_page_num_pages() / 2) { // Try to reduce memory usage to half of the available // RAM at maximum - cache->RemoveUnusedBlocks(500, 10); + cache->RemoveUnusedBlocks(1000, 10); } }