Debugging/refcount cleanups.
[bluesky.git] / bluesky / log.c
index bdf14ff..0918d37 100644 (file)
@@ -331,7 +331,7 @@ BlueSkyCacheFile *bluesky_cachefile_lookup(BlueSkyFS *fs,
         map->filename = logname;
         map->log_seq = log_seq;
         map->log = log;
-        g_atomic_int_set(&map->refcount, 0);
+        g_atomic_int_set(&map->mapcount, 0);
 
         g_hash_table_insert(log->mmap_cache, GINT_TO_POINTER(log_seq), map);
 
@@ -407,9 +407,9 @@ void bluesky_mmap_unref(BlueSkyCacheFile *mmap)
     if (mmap == NULL)
         return;
 
-    if (g_atomic_int_dec_and_test(&mmap->refcount)) {
+    if (g_atomic_int_dec_and_test(&mmap->mapcount)) {
         g_mutex_lock(mmap->lock);
-        if (g_atomic_int_get(&mmap->refcount) > 0) {
+        if (g_atomic_int_get(&mmap->mapcount) > 0) {
             g_print("Unmapped log segment %d...\n", mmap->log_seq);
             munmap((void *)mmap->addr, mmap->len);
             mmap->addr = NULL;