break;
}
+ if (block->type != BLUESKY_BLOCK_CACHED
+ && block->type != BLUESKY_BLOCK_DIRTY)
+ g_atomic_int_add(&inode->fs->cache_total, 1);
+ if (block->type != BLUESKY_BLOCK_DIRTY)
+ g_atomic_int_add(&inode->fs->cache_dirty, 1);
+
block->type = BLUESKY_BLOCK_DIRTY;
}
for (guint i = inode->blocks->len; i < blocks; i++) {
BlueSkyBlock *b = &g_array_index(inode->blocks, BlueSkyBlock, i);
g_free(b->ref);
+ if (b->type == BLUESKY_BLOCK_CACHED
+ || b->type == BLUESKY_BLOCK_DIRTY)
+ g_atomic_int_add(&inode->fs->cache_total, -1);
+ if (b->type == BLUESKY_BLOCK_DIRTY)
+ g_atomic_int_add(&inode->fs->cache_dirty, -1);
bluesky_string_unref(b->data);
}
g_array_set_size(inode->blocks, blocks);
bluesky_store_add_barrier(barrier, async);
else
bluesky_store_async_wait(async);
+
+ bluesky_store_async_unref(async);
+ g_atomic_int_add(&fs->cache_total, 1);
}
/* Write the given block to cloud-backed storage and mark it clean. */
block->ref = name;
block->type = BLUESKY_BLOCK_CACHED;
+ g_atomic_int_add(&fs->cache_dirty, -1);
g_checksum_free(csum);
}
"Dropping block %d of inode %"PRIu64" from cache",
i, inode->inum);
+ g_log("bluesky/cache", G_LOG_LEVEL_DEBUG,
+ " (reference count was %d)", b->data->refcount);
bluesky_string_unref(b->data);
b->data = NULL;
b->type = BLUESKY_BLOCK_REF;
+ g_atomic_int_add(&inode->fs->cache_total, -1);
}
}
}