Improve tracking of memory usage in BlueSky.
[bluesky.git] / bluesky / bluesky.h
index e9e40d8..099aad4 100644 (file)
@@ -143,10 +143,19 @@ typedef struct {
     BlueSkyCloudLogState *log_state;
 
     /* Accounting for memory used for caches.  Space is measured in blocks, not
-     * bytes.  We track both total data in the caches and dirty data (total
-     * data includes dirty data).  Updates to these variables must be made
-     * atomically. */
-    gint cache_total, cache_dirty;
+     * 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