Move disk cache cleanup code to cache.c from log.c
[bluesky.git] / bluesky / imap.c
index 24144b4..ec27d43 100644 (file)
@@ -110,7 +110,8 @@ InodeMapEntry *bluesky_inode_map_lookup(GSequence *inode_map, uint64_t inum,
         entry->inum = inum;
         g_sequence_insert_sorted(range->map_entries, entry, compare, NULL);
 
-        g_print("Created inode map entry for %"PRIu64"\n", inum);
+        if (bluesky_verbose)
+            g_print("Created inode map entry for %"PRIu64"\n", inum);
     }
 
     if (action != 0) {
@@ -153,6 +154,7 @@ static void bluesky_inode_map_serialize_section(BlueSkyFS *fs,
     log->data = bluesky_string_new_from_gstring(buf);
     bluesky_cloudlog_unref(range->serialized);
     range->serialized = log;
+    bluesky_cloudlog_stats_update(log, 1);
 }
 
 BlueSkyCloudLog *bluesky_inode_map_serialize(BlueSkyFS *fs)
@@ -181,6 +183,7 @@ BlueSkyCloudLog *bluesky_inode_map_serialize(BlueSkyFS *fs)
     }
 
     log->data = bluesky_string_new_from_gstring(buf);
+    bluesky_cloudlog_stats_update(log, 1);
 
     if (updated) {
         return log;
@@ -278,6 +281,9 @@ gboolean bluesky_checkpoint_load(BlueSkyFS *fs)
         return FALSE;
     }
 
+    last = bluesky_string_dup(last);
+    bluesky_cloudlog_decrypt(last->data, last->len, fs->keys);
+
     /* Scan through the contents of the last log segment to find a checkpoint
      * record.  We need to do a linear scan since at this point we don't have a
      * direct pointer; once we have the last commit record then all other data
@@ -323,6 +329,7 @@ gboolean bluesky_checkpoint_load(BlueSkyFS *fs)
     commit->location.offset = checkpoint - last->data;
     commit->location.size = checkpoint_size;
     g_mutex_unlock(commit->lock);
+    bluesky_cloudlog_stats_update(commit, 1);
 
     bluesky_inode_map_deserialize(fs, commit);
     bluesky_cloudlog_unref(commit);