void bluesky_cloudlog_insert(BlueSkyCloudLog *log);
void bluesky_cloudlog_insert_locked(BlueSkyCloudLog *log);
BlueSkyCloudLog *bluesky_cloudlog_get(BlueSkyFS *fs, BlueSkyCloudID id);
+void bluesky_cloudlog_prefetch(BlueSkyCloudLog *log);
void bluesky_cloudlog_fetch(BlueSkyCloudLog *log);
BlueSkyCloudPointer bluesky_cloudlog_serialize(BlueSkyCloudLog *log,
BlueSkyFS *fs);
return item;
}
+/* Attempt to prefetch a cloud log item. This does not guarantee that it will
+ * be made available, but does make it more likely that a future call to
+ * bluesky_cloudlog_fetch will complete quickly. */
+void bluesky_cloudlog_prefetch(BlueSkyCloudLog *log)
+{
+ gchar *id = bluesky_cloudlog_id_to_string(log->id);
+ g_print("Prefetch for %s\n", id);
+ g_free(id);
+}
+
/* Ensure that a cloud log item is loaded in memory, and if not read it in.
* TODO: Make asynchronous, and make this also fetch from the cloud. Right now
* we only read from the log. Log item must be locked. */
}
#endif
+ uint64_t start_block, end_block;
+ start_block = offset / BLUESKY_BLOCK_SIZE;
+ end_block = (offset + len - 1) / BLUESKY_BLOCK_SIZE;
+ for (uint64_t i = start_block; i <= end_block; i++) {
+ BlueSkyBlock *b = &g_array_index(inode->blocks, BlueSkyBlock,
+ i);
+ if (b->type == BLUESKY_BLOCK_REF)
+ bluesky_cloudlog_prefetch(b->ref);
+ }
+
while (len > 0) {
uint64_t block_num = offset / BLUESKY_BLOCK_SIZE;
gint block_offset = offset % BLUESKY_BLOCK_SIZE;