X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fdebug.c;h=207cb7b8031b5586d3a7963c178236d3c99d5cad;hb=97517d1bbc647846003d1a49b6ae97c69d856b90;hp=1df838294a457032442120adf7826bf98bf38155;hpb=e49fed25d000a51b316b480c1bfb1b00c1f5d345;p=bluesky.git diff --git a/bluesky/debug.c b/bluesky/debug.c index 1df8382..207cb7b 100644 --- a/bluesky/debug.c +++ b/bluesky/debug.c @@ -45,20 +45,37 @@ static void cloudlog_dump(gpointer key, gpointer value, gpointer user_data) } g_print(": refs=%d ty=%d inode=%"PRIu64" locs=%x log@(%d,%d) cloud@(%d,%d,%d)\n", log->refcount, - log->type, log->inum, log->location_flags, + log->type, log->inum, + log->location_flags | (log->data != NULL ? 0x100 : 0), log->log_seq, log->log_offset, log->location.directory, log->location.sequence, log->location.offset); } +static void cache_dump(gpointer key, gpointer value, gpointer user_data) +{ + BlueSkyCacheFile *cache = (BlueSkyCacheFile *)value; + + int64_t age = bluesky_get_current_time() - cache->atime; + g_print("%s addr=%p mapcount=%d refcount=%d atime_age=%f", + cache->filename, cache->addr, cache->mapcount, cache->refcount, + age / 1e6); + if (cache->fetching) + g_print(" (fetching)"); + g_print("\n"); +} + /* Dump a summary of filesystem state as it is cached in memory. */ void bluesky_debug_dump(BlueSkyFS *fs) { - g_print("*** DEBUG DUMP FOR FILESYSTEM %s ***\n", fs->name); - g_print("Cached blocks: %d\tDirty blocks: %d\n", - g_atomic_int_get(&fs->cache_total), - g_atomic_int_get(&fs->cache_dirty)); + g_print("\n*** DEBUG DUMP FOR FILESYSTEM %s ***\n", fs->name); + g_print("Dirty blocks: %d\n", g_atomic_int_get(&fs->cache_dirty)); g_print("Cached inodes: %u\tNext inode: %"PRIu64"\n", g_hash_table_size(fs->inodes), fs->next_inum); + g_print("Cloudlog cache: %d dirty, %d writeback, %d journal, %d cloud\n", + g_atomic_int_get(&fs->cache_log_dirty), + g_atomic_int_get(&fs->cache_log_writeback), + g_atomic_int_get(&fs->cache_log_journal), + g_atomic_int_get(&fs->cache_log_cloud)); GList *item; g_print("Unsynced inode list:"); @@ -81,6 +98,9 @@ void bluesky_debug_dump(BlueSkyFS *fs) g_print("\nLog Objects:\n"); g_hash_table_foreach(fs->locations, cloudlog_dump, fs); + + g_print("\nJournal/Cache Files:\n"); + g_hash_table_foreach(fs->log->mmap_cache, cache_dump, fs); g_print("\n"); }