More fixes to BlueSky cache management.
[bluesky.git] / bluesky / file.c
index 977618d..d3ba5f8 100644 (file)
@@ -44,9 +44,8 @@ void bluesky_block_touch(BlueSkyInode *inode, uint64_t i)
         break;
     }
 
-    /*if (block->type != BLUESKY_BLOCK_CACHED
-            && block->type != BLUESKY_BLOCK_DIRTY)
-        g_atomic_int_add(&inode->fs->cache_total, 1);   //FIXME */
+    if (block->type != BLUESKY_BLOCK_REF && block->type != BLUESKY_BLOCK_DIRTY)
+        g_atomic_int_add(&inode->fs->cache_total, 1);
     if (block->type != BLUESKY_BLOCK_DIRTY)
         g_atomic_int_add(&inode->fs->cache_dirty, 1);
 
@@ -98,9 +97,9 @@ void bluesky_file_truncate(BlueSkyInode *inode, uint64_t size)
         /* Delete blocks from a file.  Must reclaim memory. */
         for (guint i = inode->blocks->len; i < blocks; i++) {
             BlueSkyBlock *b = &g_array_index(inode->blocks, BlueSkyBlock, i);
-            /* if (b->type == BLUESKY_BLOCK_CACHED
+            if (b->type == BLUESKY_BLOCK_REF
                     || b->type == BLUESKY_BLOCK_DIRTY)
-                g_atomic_int_add(&inode->fs->cache_total, -1); FIXME */
+                g_atomic_int_add(&inode->fs->cache_total, -1);
             if (b->type == BLUESKY_BLOCK_DIRTY)
                 g_atomic_int_add(&inode->fs->cache_dirty, -1);
             bluesky_string_unref(b->dirty);