+ g_assert(raw != NULL);
+ bluesky_deserialize_cloudlog(log, raw->data, raw->len);
+ bluesky_string_unref(raw);
+ }
+
+ /* At this point all metadata should be available and we need only remap
+ * the object data. */
+
+ int offset;
+ if ((log->location_flags | log->pending_write) & CLOUDLOG_JOURNAL) {
+ bluesky_cloudlog_stats_update(log, -1);
+ offset = log->log_offset + sizeof(struct log_header);
+ log->data = bluesky_log_map_object(log->fs, -1, log->log_seq,
+ offset, log->data_size);
+ bluesky_cloudlog_stats_update(log, 1);
+ }
+
+ if (log->data == NULL && (log->location_flags & CLOUDLOG_CLOUD)) {
+ log->location_flags &= ~CLOUDLOG_JOURNAL;
+ bluesky_cloudlog_stats_update(log, -1);
+ offset = log->location.offset + sizeof(struct cloudlog_header);
+ log->data = bluesky_log_map_object(log->fs, log->location.directory,
+ log->location.sequence,
+ offset, log->data_size);
+ bluesky_cloudlog_stats_update(log, 1);
+ }
+
+ if (log->data == NULL) {
+ g_error("Unable to fetch cloudlog entry!");
+ }