+ bluesky_block_flush(inode, b, log_items);
+ }
+}
+
+/* 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_REF) {
+ g_mutex_lock(b->ref->lock);
+ if (b->ref->data != NULL
+ && g_atomic_int_get(&b->ref->data_lock_count) == 0
+ && (b->ref->location_flags != 0))
+ {
+ bluesky_cloudlog_stats_update(b->ref, -1);
+ bluesky_string_unref(b->ref->data);
+ b->ref->data = NULL;
+ bluesky_cloudlog_stats_update(b->ref, 1);
+ }
+ g_mutex_unlock(b->ref->lock);
+ }