A few more minor fixes cleaning up the cloud log state counting.
[bluesky.git] / bluesky / cache.c
index 1f10ca3..b05baf8 100644 (file)
@@ -217,9 +217,6 @@ static void drop_caches(BlueSkyInode *inode)
             log->data = NULL;
             bluesky_cloudlog_stats_update(log, 1);
         }
-        if (log->location_flags & CLOUDLOG_CLOUD) {
-            log->location_flags &= ~CLOUDLOG_JOURNAL;
-        }
         g_mutex_unlock(log->lock);
     }
 }
@@ -281,11 +278,6 @@ static gpointer flushd_task(BlueSkyFS *fs)
 {
     if (!g_mutex_trylock(fs->flushd_lock))
         return NULL;
-    flushd_dirty(fs);
-    flushd_cloud(fs);
-    flushd_clean(fs);
-    bluesky_cachefile_gc(fs);
-    g_mutex_unlock(fs->flushd_lock);
 
     g_print("\nCloudlog cache: %d dirty, %d writeback, %d journal, %d cloud\n",
             g_atomic_int_get(&fs->cache_log_dirty),
@@ -293,6 +285,12 @@ static gpointer flushd_task(BlueSkyFS *fs)
             g_atomic_int_get(&fs->cache_log_journal),
             g_atomic_int_get(&fs->cache_log_cloud));
 
+    flushd_dirty(fs);
+    flushd_cloud(fs);
+    flushd_clean(fs);
+    bluesky_cachefile_gc(fs);
+    g_mutex_unlock(fs->flushd_lock);
+
     return NULL;
 }