Reduce verbosity of debugging of disk cache contents
authorroot <root@c09-45.sysnet.ucsd.edu>
Fri, 4 Mar 2011 22:20:25 +0000 (14:20 -0800)
committerroot <root@c09-45.sysnet.ucsd.edu>
Fri, 4 Mar 2011 22:20:25 +0000 (14:20 -0800)
bluesky/cache.c

index 7327e68..16e3d81 100644 (file)
@@ -328,12 +328,14 @@ void bluesky_cachefile_gc(BlueSkyFS *fs)
          * then we'll just skip the file on this pass. */
         if (g_mutex_trylock(cachefile->lock)) {
             int64_t age = bluesky_get_current_time() - cachefile->atime;
-            g_print("%s addr=%p mapcount=%d refcount=%d size=%d atime_age=%f",
-                    cachefile->filename, cachefile->addr, cachefile->mapcount,
-                    cachefile->refcount, cachefile->disk_used, age / 1e6);
-            if (cachefile->fetching)
-                g_print(" (fetching)");
-            g_print("\n");
+            if (bluesky_verbose) {
+                g_print("%s addr=%p mapcount=%d refcount=%d size=%d atime_age=%f",
+                        cachefile->filename, cachefile->addr, cachefile->mapcount,
+                        cachefile->refcount, cachefile->disk_used, age / 1e6);
+                if (cachefile->fetching)
+                    g_print(" (fetching)");
+                g_print("\n");
+            }
 
             gboolean deletion_candidate = FALSE;
             if (g_atomic_int_get(&fs->log->disk_used)
@@ -353,7 +355,9 @@ void bluesky_cachefile_gc(BlueSkyFS *fs)
             }
 
             if (deletion_candidate) {
-                g_print("   ...deleting\n");
+                if (bluesky_verbose) {
+                    g_print("   ...deleting\n");
+                }
                 if (unlinkat(fs->log->dirfd, cachefile->filename, 0) < 0) {
                     fprintf(stderr, "Unable to unlink journal %s: %m\n",
                             cachefile->filename);