extern "C" {
#endif
+/* Target cache size levels. */
+extern int bluesky_watermark_low_dirty;
+extern int bluesky_watermark_medium_dirty;
+extern int bluesky_watermark_high_dirty;
+
/* TODO: Make this go away entirely. */
BlueSkyFS *bluesky_new_fs(gchar *name);
if (g_hash_table_remove(fs->inodes, &inode->inum))
bluesky_inode_unref(inode);
}
+ bluesky_list_unlink(&inode->fs->accessed_list,
+ inode->accessed_list);
+ inode->accessed_list = NULL;
+ bluesky_list_unlink(&inode->fs->dirty_list,
+ inode->dirty_list);
+ inode->dirty_list = NULL;
g_mutex_unlock(fs->lock);
}
}
* limit */
int bluesky_max_threads = 16;
+/* Watermark levels for cache tuning: these control when dirty data is flushed
+ * from cache, when clean data is dropped from the cache, etc. These values
+ * are measured in blocks, not bytes.
+ *
+ * There are a few relevant levels:
+ * low: Below this point, data is not forced out due to memory pressure
+ * medium: At this point start flushing data to get back below medium
+ * high: Flush data very aggressively (launch extra tasks if needed)
+ */
+int bluesky_watermark_low_dirty = (64 << 20) / BLUESKY_BLOCK_SIZE;
+int bluesky_watermark_medium_dirty = (96 << 20) / BLUESKY_BLOCK_SIZE;
+int bluesky_watermark_high_dirty = (192 << 20) / BLUESKY_BLOCK_SIZE;
+
/* Environment variables that can be used to initialize settings. */
static struct {
const char *env;
/* Sanity check: Is the inode clean? */
if (inode->change_commit < inode->change_count
+ || inode->accessed_list != NULL
|| inode->dirty_list != NULL) {
- g_warning("Dropping inode which is not clean (commit %"PRIi64" < change %"PRIi64"; dirty_list = %p)\n", inode->change_commit, inode->change_count, inode->dirty_list);
+ g_warning("Dropping inode which is not clean (commit %"PRIi64" < change %"PRIi64"; accessed_list = %p; dirty_list = %p)\n", inode->change_commit, inode->change_count, inode->accessed_list, inode->dirty_list);
}
+ /* These shouldn't be needed, but in case the above warning fires and
+ * we delete the inode anyway, we ought to be sure the inode is not on
+ * any LRU list. */
g_mutex_lock(inode->fs->lock);
bluesky_list_unlink(&inode->fs->accessed_list, inode->accessed_list);
bluesky_list_unlink(&inode->fs->dirty_list, inode->dirty_list);