if (location.directory == BLUESKY_CLOUD_DIR_PRIMARY)
return FALSE;
+ if (location.directory == BLUESKY_CLOUD_DIR_CLEANER
+ && location.sequence <= fs->log_state->latest_cleaner_seq_seen)
+ return FALSE;
+
return TRUE;
}
for (int i = 0; i < checkpoint->links->len; i++) {
BlueSkyCleanerLink *link = &g_array_index(checkpoint->links,
BlueSkyCleanerLink, i);
- /*if (!needs_merging(fs, link->location))
- continue; */
+ if (!needs_merging(fs, link->location))
+ continue;
BlueSkyCleanerItem *imap = cleaner_load_item(fs, link->location);
if (imap == NULL) {
for (int j = 0; j < imap->links->len; j++) {
BlueSkyCleanerLink *link = &g_array_index(imap->links,
BlueSkyCleanerLink, j);
+ if (!needs_merging(fs, link->location))
+ continue;
BlueSkyCleanerItem *inode = cleaner_load_item(fs, link->location);
if (inode != NULL) {
g_print("Got inode %"PRIu64"\n", inode->inum);
ftruncate(fd, 5 << 20); // FIXME
close(fd);
}
-
- // If the log file is stored in the cloud, we may need to fetch it
- if (clouddir >= 0 && start_fetch)
- cloudlog_fetch_start(map);
} else {
g_mutex_lock(map->lock);
}
+
+ /* If the log file is stored in the cloud and has not been fully fetched,
+ * we may need to initiate a fetch now. */
+ if (clouddir >= 0 && start_fetch && !map->complete && !map->fetching)
+ cloudlog_fetch_start(map);
+
g_mutex_unlock(log->mmap_lock);
if (map != NULL)
g_atomic_int_inc(&map->refcount);
for d in sorted(self.version_vector):
new_checkpoint.data += struct.pack('<II', d, self.version_vector[d])
- data = self.checkpoint_record.data[self.vvsize:]
+ data = self.checkpoint_record.data[self.vvsize + len(CHECKPOINT_MAGIC):]
for i in range(len(data) // 16):
(start, end) = struct.unpack_from("<QQ", data, 16*i)
rewrite_inode(backend, inode_map, i, log, i in dirty_inode_data)
if __name__ == '__main__':
- #backend = S3Backend("mvrable-bluesky", cachedir=".")
- backend = FileBackend(".")
+ backend = S3Backend("mvrable-bluesky", cachedir=".")
+ #backend = FileBackend(".")
chkpt = load_checkpoint_record(backend)
print backend.list()
imap = InodeMap()