From: Michael Vrable Date: Thu, 9 Dec 2010 20:12:04 +0000 (-0800) Subject: Fix to the cleaner when writing out a new inode map. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=4a22b094a5dbd2aabc101ee5a6579b577b6e614c;p=bluesky.git Fix to the cleaner when writing out a new inode map. --- diff --git a/bluesky/cleaner.c b/bluesky/cleaner.c index b13983e..e2eccc5 100644 --- a/bluesky/cleaner.c +++ b/bluesky/cleaner.c @@ -190,6 +190,10 @@ gboolean needs_merging(BlueSkyFS *fs, BlueSkyCloudPointer location) if (location.directory == BLUESKY_CLOUD_DIR_PRIMARY) return FALSE; + if (location.directory == BLUESKY_CLOUD_DIR_CLEANER + && location.sequence <= fs->log_state->latest_cleaner_seq_seen) + return FALSE; + return TRUE; } @@ -206,8 +210,8 @@ void bluesky_cleaner_merge(BlueSkyFS *fs) for (int i = 0; i < checkpoint->links->len; i++) { BlueSkyCleanerLink *link = &g_array_index(checkpoint->links, BlueSkyCleanerLink, i); - /*if (!needs_merging(fs, link->location)) - continue; */ + if (!needs_merging(fs, link->location)) + continue; BlueSkyCleanerItem *imap = cleaner_load_item(fs, link->location); if (imap == NULL) { @@ -219,6 +223,8 @@ void bluesky_cleaner_merge(BlueSkyFS *fs) for (int j = 0; j < imap->links->len; j++) { BlueSkyCleanerLink *link = &g_array_index(imap->links, BlueSkyCleanerLink, j); + if (!needs_merging(fs, link->location)) + continue; BlueSkyCleanerItem *inode = cleaner_load_item(fs, link->location); if (inode != NULL) { g_print("Got inode %"PRIu64"\n", inode->inum); diff --git a/bluesky/log.c b/bluesky/log.c index 2e5c920..6475b5d 100644 --- a/bluesky/log.c +++ b/bluesky/log.c @@ -443,14 +443,16 @@ BlueSkyCacheFile *bluesky_cachefile_lookup(BlueSkyFS *fs, ftruncate(fd, 5 << 20); // FIXME close(fd); } - - // If the log file is stored in the cloud, we may need to fetch it - if (clouddir >= 0 && start_fetch) - cloudlog_fetch_start(map); } else { g_mutex_lock(map->lock); } + + /* If the log file is stored in the cloud and has not been fully fetched, + * we may need to initiate a fetch now. */ + if (clouddir >= 0 && start_fetch && !map->complete && !map->fetching) + cloudlog_fetch_start(map); + g_mutex_unlock(log->mmap_lock); if (map != NULL) g_atomic_int_inc(&map->refcount); diff --git a/cleaner/cleaner b/cleaner/cleaner index b148b95..675819b 100755 --- a/cleaner/cleaner +++ b/cleaner/cleaner @@ -419,7 +419,7 @@ class InodeMap: for d in sorted(self.version_vector): new_checkpoint.data += struct.pack('