+
+/* Drop clean data blocks for a file from cache. */
+void bluesky_file_drop_cached(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);
+ if (b->type == BLUESKY_BLOCK_CACHED) {
+ g_log("bluesky/cache", G_LOG_LEVEL_DEBUG,
+ "Dropping block %d of inode %"PRIu64" from cache",
+ i, inode->inum);
+
+ bluesky_string_unref(b->data);
+ b->data = NULL;
+ b->type = BLUESKY_BLOCK_REF;
+ }
+ }
+}