Fixes for journal replay, and drop the "superblock" cloud item.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Wed, 1 Sep 2010 18:15:29 +0000 (11:15 -0700)
committerMichael Vrable <mvrable@cs.ucsd.edu>
Wed, 1 Sep 2010 18:15:29 +0000 (11:15 -0700)
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.

bluesky/bluesky.h
bluesky/inode.c
bluesky/log.c

index 54e8450..c4d175e 100644 (file)
@@ -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);
 
index 7560010..00e1142 100644 (file)
@@ -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
-}
index c94794c..c879ccd 100644 (file)
@@ -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);
         }