return;
}
- g_hash_table_remove(fs->locations, &log->id);
+ if (!g_hash_table_remove(fs->locations, &log->id)) {
+ if (bluesky_verbose)
+ g_warning("Could not find and remove cloud log item from hash table!");
+ }
g_mutex_unlock(fs->lock);
bluesky_cloudlog_stats_update(log, -1);
{
g_assert(log->data_lock_count == 0);
+ if (log->type == LOGTYPE_UNKNOWN)
+ return;
+
log->type = LOGTYPE_UNKNOWN;
log->data_size = 0;
bluesky_string_unref(log->data);
item = g_hash_table_lookup(fs->locations, &id);
if (item == NULL) {
item = bluesky_cloudlog_new(fs, &id);
- g_hash_table_insert(fs->locations, &id, item);
+ bluesky_cloudlog_insert_locked(item);
} else {
bluesky_cloudlog_ref(item);
}
if (range->serialized != NULL)
bluesky_cloudlog_erase(range->serialized);
+ GSequenceIter *j;
+ for (j = g_sequence_get_begin_iter(range->map_entries);
+ !g_sequence_iter_is_end(j); j = g_sequence_iter_next(j))
+ {
+ InodeMapEntry *entry = (InodeMapEntry *)g_sequence_get(j);
+ BlueSkyCloudLog *item = entry->item;
+ if (item != NULL) {
+ g_mutex_lock(item->lock);
+ if (g_atomic_int_get(&item->refcount) == 1) {
+ bluesky_cloudlog_erase(item);
+ }
+ g_mutex_unlock(item->lock);
+ } else {
+ g_warning("Null item for inode map entry %"PRIu64"!",
+ entry->inum);
+ }
+ }
+
i = g_sequence_iter_next(i);
}
}
g_mutex_unlock(commit->lock);
bluesky_inode_map_deserialize(fs, commit);
- //bluesky_cloudlog_unref(commit);
+ bluesky_cloudlog_unref(commit);
return TRUE;
}
return;
}
+ if (memcmp(&id, &item->id, sizeof(BlueSkyCloudID)) != 0) {
+ g_warning("ID does not match expected value!\n");
+ }
+
BlueSkyFS *fs = item->fs;
bluesky_string_unref(item->data);