X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fbluesky-private.h;h=ba9df02bbdb7b8e929468ed1013869f76dffa966;hb=641411b0a7ce9afa309bea28c01320eda913b2d2;hp=d00f7c39c440b84a87006772ff4b67fa2682d872;hpb=625d4ed1c01e01a5f2a508264f8605fb79a620fb;p=bluesky.git diff --git a/bluesky/bluesky-private.h b/bluesky/bluesky-private.h index d00f7c3..ba9df02 100644 --- a/bluesky/bluesky-private.h +++ b/bluesky/bluesky-private.h @@ -19,15 +19,31 @@ 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; + +extern int bluesky_watermark_low_total; +extern int bluesky_watermark_medium_total; +extern int bluesky_watermark_high_total; + /* TODO: Make this go away entirely. */ BlueSkyFS *bluesky_new_fs(gchar *name); +/* Linked list update functions for LRU lists. */ +void bluesky_list_unlink(GList *head, GList *item); +GList *bluesky_list_prepend(GList *head, BlueSkyInode *inode); +GList *bluesky_list_append(GList *head, BlueSkyInode *inode); +BlueSkyInode *bluesky_list_head(GList *head); +BlueSkyInode *bluesky_list_tail(GList *head); + /* Serialization and deserialization of filesystem data for storing to * persistent storage. */ void bluesky_serialize_superblock(GString *out, BlueSkyFS *fs); BlueSkyFS *bluesky_deserialize_superblock(const gchar *buf); void bluesky_serialize_inode(GString *out, BlueSkyInode *inode); -BlueSkyInode *bluesky_deserialize_inode(BlueSkyFS *fs, const gchar *buf); +gboolean bluesky_deserialize_inode(BlueSkyInode *inode, const gchar *buf); /* Storage layer. Requests can be performed asynchronously, so these objects * help keep track of operations in progress. */ @@ -47,7 +63,8 @@ typedef enum { } BlueSkyAsyncStatus; struct BlueSkyNotifierList; -typedef struct { +typedef struct _BlueSkyStoreAsync BlueSkyStoreAsync; +struct _BlueSkyStoreAsync { BlueSkyStore *store; GMutex *lock; @@ -63,9 +80,18 @@ typedef struct { int result; /* Result code; 0 for success. */ struct BlueSkyNotifierList *notifiers; + gint notifier_count; + + /* The barrier waiting on this operation. Support for more than one + * barrier for a single async is not well-supported and should be avoided + * if possible. */ + BlueSkyStoreAsync *barrier; + + bluesky_time_hires start_time; /* Time operation was submitted. */ + bluesky_time_hires exec_time; /* Time processing started on operation. */ gpointer store_private; /* For use by the storage implementation */ -} BlueSkyStoreAsync; +}; /* Support for notification lists. These are lists of one-shot functions which * can be called when certain events--primarily, competed storage @@ -81,7 +107,7 @@ struct BlueSkyNotifierList { /* The abstraction layer for storage, allowing multiple implementations. */ typedef struct { /* Create a new store instance and return a handle to it. */ - gpointer (*create)(); + gpointer (*create)(const gchar *path); /* Clean up any resources used by this store. */ void (*destroy)(gpointer store); @@ -98,6 +124,7 @@ void bluesky_store_register(const BlueSkyStoreImplementation *impl, const gchar *name); BlueSkyStoreAsync *bluesky_store_async_new(BlueSkyStore *store); +gpointer bluesky_store_async_get_handle(BlueSkyStoreAsync *async); void bluesky_store_async_ref(BlueSkyStoreAsync *async); void bluesky_store_async_unref(BlueSkyStoreAsync *async); void bluesky_store_async_wait(BlueSkyStoreAsync *async); @@ -110,6 +137,16 @@ void bluesky_store_sync(BlueSkyStore *store); void bluesky_store_add_barrier(BlueSkyStoreAsync *barrier, BlueSkyStoreAsync *async); +void bluesky_inode_start_sync(BlueSkyInode *inode, BlueSkyStoreAsync *barrier); + +void bluesky_block_touch(BlueSkyInode *inode, uint64_t i); +void bluesky_block_fetch(BlueSkyFS *fs, BlueSkyBlock *block, + BlueSkyStoreAsync *barrier); +void bluesky_block_flush(BlueSkyFS *fs, BlueSkyBlock *block, + BlueSkyStoreAsync *barrier); +void bluesky_file_flush(BlueSkyInode *inode, BlueSkyStoreAsync *barrier); +void bluesky_file_drop_cached(BlueSkyInode *inode); + #ifdef __cplusplus } #endif