X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fdebug.c;h=7de509559bb573dee5bdddb3d86850862d6833aa;hb=3545d572eecff2a6e0ad53bfae3ed0c35f232cbe;hp=2b32c9c327acdd6780c2da24400fe92268eac99a;hpb=8ec7f79f834ff8c3493b1bbdd63314d276786aa4;p=bluesky.git diff --git a/bluesky/debug.c b/bluesky/debug.c index 2b32c9c..7de5095 100644 --- a/bluesky/debug.c +++ b/bluesky/debug.c @@ -31,8 +31,9 @@ static void inode_dump(gpointer key, gpointer value, gpointer user_data) locked ? 'T' : 'F', inode->refcount); g_print(" Type: %d Mode: %o\n", inode->type, inode->mode); - g_print(" change_count = %"PRIu64", change_commit = %"PRIu64"\n", - inode->change_count, inode->change_commit); + g_print(" change_count = %"PRIu64", change_commit = %"PRIu64", " + "change_cloud = %"PRIu64"\n", + inode->change_count, inode->change_commit, inode->change_cloud); } static void cloudlog_dump(gpointer key, gpointer value, gpointer user_data) @@ -44,20 +45,65 @@ 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"); +} + + +void inode_map_dump(GSequence *inode_map) +{ + GSequenceIter *i, *j; + + g_print("\nInode map dump:\n"); + for (i = g_sequence_get_begin_iter(inode_map); + !g_sequence_iter_is_end(i); i = g_sequence_iter_next(i)) + { + InodeMapRange *range = (InodeMapRange *)g_sequence_get(i); + + g_print(" Range [%"PRIu64", %"PRIu64"]\n", range->start, range->end); + + for (j = g_sequence_get_begin_iter(range->map_entries); + !g_sequence_iter_is_end(j); j = g_sequence_iter_next(j)) + { + InodeMapEntry *entry = (InodeMapEntry *)g_sequence_get(j); + BlueSkyCloudLog *item = entry->item; + if (item != NULL) { + char *id = bluesky_cloudlog_id_to_string(item->id); + g_print(" Entry %"PRIu64" id=%s\n", entry->inum, id); + g_free(id); + } else { + g_print(" Entry %"PRIu64" not available\n", entry->inum); + } + } + } +} /* 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:"); @@ -80,7 +126,14 @@ 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"); + + g_mutex_lock(fs->lock); + inode_map_dump(fs->inode_map); + g_mutex_unlock(fs->lock); } /* Statistics counters: for operation counts, bytes transferred, etc. */