X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=bluesky%2Fbluesky.h;h=7b8aad2073cfb787462f388995965320b75064fa;hb=e6ca13c07e0cb5dd05d48a12cd50a2cf6179ce1a;hp=41618b532ad12b45715db0739c67fd23c8f9907d;hpb=7bb8900e1209a2abf3d83e7f06e2dfb314cef61e;p=bluesky.git diff --git a/bluesky/bluesky.h b/bluesky/bluesky.h index 41618b5..7b8aad2 100644 --- a/bluesky/bluesky.h +++ b/bluesky/bluesky.h @@ -24,6 +24,15 @@ typedef struct { /* Write data in cache immediately after file is modified. */ int writethrough_cache; + + /* Can inodes be fetched asynchronously? (Inode object is initially + * created in a pending state, and not unlocked until the data is actually + * available.) */ + int sync_inode_fetches; + + /* Should frontends handle requests serially or allow operations to proceed + * in parallel? */ + int sync_frontends; } BlueSkyOptions; extern BlueSkyOptions bluesky_options; @@ -87,6 +96,10 @@ typedef enum { BLUESKY_SYMLINK = 5, BLUESKY_SOCKET = 6, BLUESKY_FIFO = 7, + + /* Special types used only internally. */ + BLUESKY_PENDING = 0, /* Inode being loaded; type not yet determined */ + BLUESKY_INVALID = -1, /* Inode is invalid (failed to load) */ } BlueSkyFileType; /* Filesystem state. Each filesystem which is exported is represented by a @@ -121,6 +134,13 @@ bluesky_time_hires bluesky_now_hires(); * dropping from the cache. * - Any pending operations should hold extra references to the inode as * appropriate to keep it available until the operation completes. + * - Locking dependency order is, when multiple locks are to be acquired, to + * acquire locks on parents in the filesystem tree before children. + * (TODO: What about rename when we acquire locks in unrelated parts of the + * filesystem?) + * - An inode should not be locked while the filesystem lock is already held, + * since some code may do an inode lookup (which acquires the filesystem + * lock) while a different inode is locked. * */ typedef struct { GMutex *lock; @@ -208,9 +228,12 @@ void bluesky_superblock_flush(BlueSkyFS *fs); int64_t bluesky_get_current_time(); void bluesky_inode_update_ctime(BlueSkyInode *inode, gboolean update_mtime); uint64_t bluesky_fs_alloc_inode(BlueSkyFS *fs); +void bluesky_init_inode(BlueSkyInode *i, BlueSkyFileType type); BlueSkyInode *bluesky_new_inode(uint64_t inum, BlueSkyFS *fs, BlueSkyFileType type); BlueSkyInode *bluesky_get_inode(BlueSkyFS *fs, uint64_t inum); +void bluesky_inode_ref(BlueSkyInode *inode); +void bluesky_inode_unref(BlueSkyInode *inode); void bluesky_insert_inode(BlueSkyFS *fs, BlueSkyInode *inode); void bluesky_dirent_destroy(gpointer dirent); @@ -236,6 +259,7 @@ gint bluesky_dirent_compare(gconstpointer a, gconstpointer b, gpointer unused); void bluesky_flushd_invoke(BlueSkyFS *fs); +void bluesky_inode_do_sync(BlueSkyInode *inode); void bluesky_debug_dump(BlueSkyFS *fs);