1 /* Blue Sky: File Systems in the Cloud
3 * Copyright (C) 2009 The Regents of the University of California
4 * Written by Michael Vrable <mvrable@cs.ucsd.edu>
15 #include "bluesky-private.h"
17 /* Debugging support for BlueSky. */
19 static void inode_dump(gpointer key, gpointer value, gpointer user_data)
21 BlueSkyInode *inode = (BlueSkyInode *)value;
23 g_print("Inode %"PRIu64":\n", inode->inum);
25 gboolean locked = TRUE;
26 if (g_mutex_trylock(inode->lock)) {
28 g_mutex_unlock(inode->lock);
30 g_print(" Locked: %c Refcount: %d\n",
31 locked ? 'T' : 'F', inode->refcount);
33 g_print(" Type: %d Mode: %o\n", inode->type, inode->mode);
34 g_print(" change_count = %"PRIu64", change_commit = %"PRIu64"\n",
35 inode->change_count, inode->change_commit);
38 /* Dump a summary of filesystem state as it is cached in memory. */
39 void bluesky_debug_dump(BlueSkyFS *fs)
41 g_print("*** DEBUG DUMP FOR FILESYSTEM %s ***\n", fs->name);
42 g_print("Cached inodes: %u\tNext inode: %"PRIu64"\n",
43 g_hash_table_size(fs->inodes), fs->next_inum);
45 g_hash_table_foreach(fs->inodes, inode_dump, fs);