X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fdebug.c;h=43b29be1d25a036fffe0284f6a60e1762c55cc3d;hb=4a207da5eef9f87a702a011d003d5ad17b651085;hp=b409c74b492be2110ff0682978683a10f773cb6a;hpb=348aaaad42163d6829112c9b18026c16b09e1914;p=bluesky.git diff --git a/bluesky/debug.c b/bluesky/debug.c index b409c74..43b29be 100644 --- a/bluesky/debug.c +++ b/bluesky/debug.c @@ -31,21 +31,45 @@ 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) +{ + BlueSkyCloudLog *log = (BlueSkyCloudLog *)value; + + for (int i = 0; i < sizeof(BlueSkyCloudID); i++) { + g_print("%02x", (uint8_t)(log->id.bytes[i])); + } + 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->data != NULL ? 0x100 : 0), + log->log_seq, log->log_offset, log->location.directory, + log->location.sequence, log->location.offset); } /* 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("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:"); + for (item = fs->unlogged_list.next; item != NULL; item = item->next) { + g_print(" %"PRIu64";", ((BlueSkyInode *)item->data)->inum); + } + g_print("\n"); g_print("Dirty inode LRU list:"); for (item = fs->dirty_list.next; item != NULL; item = item->next) { g_print(" %"PRIu64";", ((BlueSkyInode *)item->data)->inum); @@ -58,6 +82,10 @@ void bluesky_debug_dump(BlueSkyFS *fs) g_print("\n"); g_hash_table_foreach(fs->inodes, inode_dump, fs); + + g_print("\nLog Objects:\n"); + g_hash_table_foreach(fs->locations, cloudlog_dump, fs); + g_print("\n"); } /* Statistics counters: for operation counts, bytes transferred, etc. */