From: Michael Vrable Date: Tue, 19 Oct 2010 02:01:21 +0000 (-0700) Subject: A few more minor fixes cleaning up the cloud log state counting. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=c576372ed59370ff97a3bf2353ab477e4b744fac;p=bluesky.git A few more minor fixes cleaning up the cloud log state counting. --- diff --git a/bluesky/cache.c b/bluesky/cache.c index 1f10ca3..b05baf8 100644 --- a/bluesky/cache.c +++ b/bluesky/cache.c @@ -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; } diff --git a/bluesky/cloudlog.c b/bluesky/cloudlog.c index 9d5333f..b2f95c7 100644 --- a/bluesky/cloudlog.c +++ b/bluesky/cloudlog.c @@ -259,6 +259,7 @@ BlueSkyCloudLog *bluesky_cloudlog_get(BlueSkyFS *fs, BlueSkyCloudID id) item = g_hash_table_lookup(fs->locations, &id); if (item == NULL) { item = bluesky_cloudlog_new(fs, &id); + bluesky_cloudlog_stats_update(item, 1); bluesky_cloudlog_insert_locked(item); } else { bluesky_cloudlog_ref(item); diff --git a/bluesky/log.c b/bluesky/log.c index f52ac01..d007eca 100644 --- a/bluesky/log.c +++ b/bluesky/log.c @@ -726,9 +726,11 @@ static void reload_item(BlueSkyCloudLog *log_item, /*const BlueSkyCloudPointer *data3 = (const BlueSkyCloudPointer *)(data + len1 + len2);*/ + bluesky_cloudlog_stats_update(log_item, -1); bluesky_string_unref(log_item->data); log_item->data = NULL; log_item->location_flags = CLOUDLOG_JOURNAL; + bluesky_cloudlog_stats_update(log_item, 1); BlueSkyCloudID id0; memset(&id0, 0, sizeof(id0));