From: Michael Vrable Date: Wed, 27 Jan 2010 19:49:59 +0000 (-0800) Subject: Flush file blocks to storage before the inode. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=1c95720b285aac9770a7ffa62c91040174dd68b8;p=bluesky.git Flush file blocks to storage before the inode. Otherwise, some blocks might not have been assigned a name and so seriaizing the inode will lose data. --- diff --git a/bluesky/inode.c b/bluesky/inode.c index a052fb4..3c6fa3c 100644 --- a/bluesky/inode.c +++ b/bluesky/inode.c @@ -232,13 +232,13 @@ void bluesky_inode_start_sync(BlueSkyInode *inode, BlueSkyStoreAsync *barrier) { BlueSkyFS *fs = inode->fs; + if (inode->type == BLUESKY_REGULAR) + bluesky_file_flush(inode, barrier); + GString *buf = g_string_new(""); bluesky_serialize_inode(buf, inode); BlueSkyRCStr *data = bluesky_string_new_from_gstring(buf); - if (inode->type == BLUESKY_REGULAR) - bluesky_file_flush(inode, barrier); - char key[64]; sprintf(key, "inode-%016"PRIx64, inode->inum);