From: Michael Vrable Date: Wed, 1 Sep 2010 18:15:29 +0000 (-0700) Subject: Fixes for journal replay, and drop the "superblock" cloud item. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=831077a3e64381afd0297d8ae5c21d5cdede5f4a;p=bluesky.git Fixes for journal replay, and drop the "superblock" cloud item. That file in the cloud wasn't storing useful information any longer and wasn't being used much; drop it. It's functionality will be replaced with some form of commit log in the cloud journal. --- diff --git a/bluesky/bluesky.h b/bluesky/bluesky.h index 54e8450..c4d175e 100644 --- a/bluesky/bluesky.h +++ b/bluesky/bluesky.h @@ -302,7 +302,6 @@ typedef struct { } BlueSkyBlock; BlueSkyFS *bluesky_init_fs(gchar *name, BlueSkyStore *store); -void bluesky_superblock_flush(BlueSkyFS *fs); gboolean bluesky_inode_is_ready(BlueSkyInode *inode); diff --git a/bluesky/inode.c b/bluesky/inode.c index 7560010..00e1142 100644 --- a/bluesky/inode.c +++ b/bluesky/inode.c @@ -99,21 +99,6 @@ BlueSkyFS *bluesky_new_fs(gchar *name) BlueSkyFS *bluesky_init_fs(gchar *name, BlueSkyStore *store) { - BlueSkyRCStr *data = bluesky_store_get(store, "superblock"); - if (data != NULL) { - BlueSkyFS *fs = bluesky_deserialize_superblock(data->data); - if (fs != NULL) { - fs->store = store; - fs->log = bluesky_log_new("journal"); - fs->log->fs = fs; - g_print("Loaded filesystem superblock\n"); - g_free(fs->name); - fs->name = g_strdup(name); - return fs; - } - bluesky_string_unref(data); - } - g_print("Initializing fresh filesystem\n"); BlueSkyFS *fs = bluesky_new_fs(name); fs->store = store; @@ -130,7 +115,6 @@ BlueSkyFS *bluesky_init_fs(gchar *name, BlueSkyStore *store) bluesky_replay(fs); bluesky_inode_do_sync(root); - bluesky_superblock_flush(fs); return fs; } @@ -227,8 +211,6 @@ uint64_t bluesky_fs_alloc_inode(BlueSkyFS *fs) inum = fs->next_inum; fs->next_inum++; - bluesky_superblock_flush(fs); - return inum; } @@ -418,22 +400,3 @@ void bluesky_inode_fetch(BlueSkyFS *fs, uint64_t inum) bluesky_store_async_unref(async); } - -/* Synchronize filesystem superblock to stable storage. */ -void bluesky_superblock_flush(BlueSkyFS *fs) -{ -#if 0 - GString *buf = g_string_new(""); - bluesky_serialize_superblock(buf, fs); - BlueSkyRCStr *data = bluesky_string_new_from_gstring(buf); - - BlueSkyStoreAsync *async = bluesky_store_async_new(fs->store); - async->op = STORE_OP_PUT; - async->key = g_strdup("superblock"); - async->data = data; - bluesky_store_async_submit(async); - bluesky_store_async_unref(async); - - //bluesky_store_sync(fs->store); -#endif -} diff --git a/bluesky/log.c b/bluesky/log.c index c94794c..c879ccd 100644 --- a/bluesky/log.c +++ b/bluesky/log.c @@ -761,6 +761,16 @@ static void bluesky_replay_scan_journal2(BlueSkyFS *fs, GList **objects, if (!bluesky_deserialize_inode(inode, log_item)) g_print("Error deserializing inode %"PRIu64"\n", inum); fs->next_inum = MAX(fs->next_inum, inum + 1); + bluesky_list_unlink(&fs->accessed_list, inode->accessed_list); + inode->accessed_list = bluesky_list_prepend(&fs->accessed_list, inode); + bluesky_list_unlink(&fs->dirty_list, inode->dirty_list); + inode->dirty_list = bluesky_list_prepend(&fs->dirty_list, inode); + bluesky_list_unlink(&fs->unlogged_list, inode->unlogged_list); + inode->unlogged_list = NULL; + inode->change_cloud = inode->change_commit; + bluesky_cloudlog_ref(log_item); + bluesky_cloudlog_unref(inode->committed_item); + inode->committed_item = log_item; g_mutex_unlock(inode->lock); g_mutex_unlock(fs->lock); }