Some initial work to support delayed flushing of data.
[bluesky.git] / bluesky / file.c
index f9f6444..9f4d980 100644 (file)
@@ -215,3 +215,14 @@ void bluesky_block_flush(BlueSkyFS *fs, BlueSkyBlock *block)
     g_checksum_free(csum);
     //bluesky_string_unref(data);
 }
+
+/* Flush all blocks in a file to stable storage. */
+void bluesky_file_flush(BlueSkyInode *inode)
+{
+    g_return_if_fail(inode->type == BLUESKY_REGULAR);
+
+    for (int i = 0; i < inode->blocks->len; i++) {
+        BlueSkyBlock *b = &g_array_index(inode->blocks, BlueSkyBlock, i);
+        bluesky_block_flush(inode->fs, b);
+    }
+}