g_mutex_unlock(fs->lock);
g_mutex_lock(inode->lock);
- flushd_dirty_inode(inode);
+ g_assert(inode->change_cloud == inode->change_commit);
g_mutex_lock(fs->lock);
bluesky_list_unlink(&fs->dirty_list, inode->dirty_list);
inode->dirty_list = NULL;
g_mutex_unlock(fs->lock);
BlueSkyCloudLog *log = inode->committed_item;
- bluesky_cloudlog_ref(log);
+ inode->committed_item = NULL;
g_mutex_unlock(inode->lock);
if (log != NULL)
g_mutex_lock(inode->fs->lock);
bluesky_list_unlink(&inode->fs->unlogged_list, inode->unlogged_list);
inode->unlogged_list = bluesky_list_prepend(&inode->fs->unlogged_list, inode);
- bluesky_list_unlink(&inode->fs->dirty_list, inode->dirty_list);
- inode->dirty_list = bluesky_list_prepend(&inode->fs->dirty_list, inode);
bluesky_list_unlink(&inode->fs->accessed_list, inode->accessed_list);
inode->accessed_list = bluesky_list_prepend(&inode->fs->accessed_list, inode);
g_mutex_unlock(inode->fs->lock);
-
- bluesky_cloudlog_unref(inode->committed_item);
- inode->committed_item = NULL;
}
/* Unfortunately a glib hash table is only guaranteed to be able to store
g_mutex_lock(inode->fs->lock);
bluesky_list_unlink(&inode->fs->unlogged_list, inode->unlogged_list);
inode->unlogged_list = NULL;
+
+ /* Since a new version of the inode has been written to the log, also
+ * schedule a future flush of the new data to cloud storage. */
+ bluesky_list_unlink(&inode->fs->dirty_list, inode->dirty_list);
+ inode->dirty_list = bluesky_list_prepend(&inode->fs->dirty_list, inode);
+ inode->change_cloud = inode->change_count;
+
g_mutex_unlock(inode->fs->lock);
}
g_string_append_len(out, (gchar *)&size, sizeof(uint64_t));
for (int i = 0; i < inode->blocks->len; i++) {
BlueSkyBlock *b = &g_array_index(inode->blocks, BlueSkyBlock, i);
- BlueSkyCloudLog *ref = NULL;
- if (b->type == BLUESKY_BLOCK_REF)
- ref = b->ref;
+ BlueSkyCloudLog *ref = (b->type == BLUESKY_BLOCK_REF ? b->ref : NULL);
bluesky_cloudlog_ref(ref);
g_array_append_val(cloudlog->links, ref);
}