Disable most debugging print messages; should help with performance.
[bluesky.git] / bluesky / cache.c
index f11168c..72c181a 100644 (file)
@@ -21,8 +21,10 @@ static void writeback_complete(gpointer a, gpointer i)
 {
     BlueSkyInode *inode = (BlueSkyInode *)i;
 
-    g_log("bluesky/flushd", G_LOG_LEVEL_DEBUG,
-          "Writeback for inode %"PRIu64" complete", inode->inum);
+    if (bluesky_verbose) {
+        g_log("bluesky/flushd", G_LOG_LEVEL_DEBUG,
+              "Writeback for inode %"PRIu64" complete", inode->inum);
+    }
 
     g_mutex_lock(inode->lock);
 
@@ -145,8 +147,10 @@ static void flushd_dirty_inode(BlueSkyInode *inode)
         return;
     }
 
-    g_log("bluesky/flushd", G_LOG_LEVEL_DEBUG,
-          "Starting flush of inode %"PRIu64, inode->inum);
+    if (bluesky_verbose) {
+        g_log("bluesky/flushd", G_LOG_LEVEL_DEBUG,
+            "Starting flush of inode %"PRIu64, inode->inum);
+    }
     inode->change_pending = inode->change_count;
 
     /* Create a store barrier.  All operations part of the writeback will be
@@ -175,7 +179,10 @@ static void flushd_dirty(BlueSkyFS *fs)
             break;
         inode = fs->dirty_list.prev->data;
 
-        g_print("Considering flushing inode %"PRIu64"\n", inode->inum);
+        if (bluesky_verbose) {
+            g_log("bluesky/flushd", G_LOG_LEVEL_DEBUG,
+                  "Considering flushing inode %"PRIu64, inode->inum);
+        }
 
         /* Stop processing dirty inodes if we both have enough memory available
          * and the oldest inode is sufficiently new that it need not be flushed
@@ -227,8 +234,11 @@ static void flushd_clean(BlueSkyFS *fs)
             break;
         inode = fs->accessed_list.prev->data;
 
-        g_print("Considering dropping cached data for inode %"PRIu64"\n",
-                inode->inum);
+        if (bluesky_verbose) {
+            g_log("bluesky/flushd", G_LOG_LEVEL_DEBUG,
+                  "Considering dropping cached data for inode %"PRIu64,
+                  inode->inum);
+        }
 
         bluesky_inode_ref(inode);
 
@@ -276,10 +286,12 @@ void bluesky_flushd_invoke_conditional(BlueSkyFS *fs)
         && g_atomic_int_get(&fs->cache_total) < bluesky_watermark_high_total)
         return;
 
-    g_log("bluesky/flushd", G_LOG_LEVEL_DEBUG,
-          "Too much data; invoking flushd: dirty=%d total=%d",
-          g_atomic_int_get(&fs->cache_dirty),
-          g_atomic_int_get(&fs->cache_total));
+    if (bluesky_verbose) {
+        g_log("bluesky/flushd", G_LOG_LEVEL_DEBUG,
+              "Too much data; invoking flushd: dirty=%d total=%d",
+              g_atomic_int_get(&fs->cache_dirty),
+              g_atomic_int_get(&fs->cache_total));
+    }
 
     bluesky_flushd_invoke(fs);
 }