+ BlueSkyLog *log;
+ BlueSkyCloudLogState *log_state;
+
+ /* Filesystem crypto keys */
+ char *master_key;
+ struct BlueSkyCryptKeys *keys;
+
+ /* Accounting for memory used for caches. Space is measured in blocks, not
+ * bytes. Updates to these variables must be made atomically. */
+ gint cache_dirty;
+
+ /* Like above, but tracking data stored in the cloudlog entries
+ * specifically:
+ * - cache_log_dirty: data uncommitted to journal and cloud
+ * - cache_log_writeback: data being written to journal
+ * - cache_log_journal: data committed to journal
+ * - cache_log_cloud: data written to cloud as well
+ * Log entries should progress from the top state to the bottom, and are
+ * only ever counted in one category at a time. */
+ gint cache_log_dirty, cache_log_writeback,
+ cache_log_journal, cache_log_cloud;
+
+ /* Linked list of inodes, sorted by access/modification times for cache
+ * management. Editing these lists is protected by the filesystem lock; to
+ * avoid deadlock do not attempt to take any other locks while the FS lock
+ * is held for list editing purposes. Items at the head of the list are
+ * most recently accessed/modified. */
+ GList unlogged_list; // Changes not yet synced to journal
+ GList dirty_list; // Not yet written to cloud storage
+ GList accessed_list; // All in-memory inodes
+
+ /* Mutex for the flush daemon, to prevent concurrent execution. */
+ GMutex *flushd_lock;
+
+ /* Used to wait for the cache daemon to free up space */
+ GCond *flushd_cond;
+
+ /* Mapping of object identifiers (blocks, inodes) to physical location (in
+ * the local cache or in the logs in the cloud). */
+ GHashTable *locations;
+
+ /* The inode map, which maps inode numbers to the location of the most
+ * recent version. */
+ GSequence *inode_map;
+
+ /* Queue for asynchronous cloudlog unrefs, where needed. */
+ GAsyncQueue *unref_queue;
+
+ /* Thread pool for asynchronous inode fetches */
+ GThreadPool *inode_fetch_thread_pool;