map->prefetches = bluesky_rangeset_new();
gchar *id = bluesky_cloudlog_id_to_string(item->id);
- g_print("Need to prefetch %s\n", id);
+ if (bluesky_verbose)
+ g_print("Need to prefetch %s\n", id);
g_free(id);
bluesky_rangeset_insert(map->prefetches,
uint64_t start, length;
bluesky_rangeset_get_extents(map->prefetches, &start, &length);
- g_print("Range to prefetch: %"PRIu64" + %"PRIu64"\n", start, length);
+ if (bluesky_verbose)
+ g_print("Range to prefetch: %"PRIu64" + %"PRIu64"\n",
+ start, length);
}
bluesky_cachefile_unref(map);
break;
if (bluesky_crypt_block_decrypt(data, item_size, keys)) {
if (items != NULL) {
- g_print(" data item at %zx\n", offset);
+ if (bluesky_verbose)
+ g_print(" data item at %zx\n", offset);
bluesky_rangeset_insert(items, offset, item_size,
GINT_TO_POINTER(TRUE));
}
/* A stale reference to a journal file which doesn't exist any longer
* because it was reclaimed. Return NULL. */
} else if (map == NULL) {
- g_print("Adding cache file %s\n", logname);
+ if (bluesky_verbose)
+ g_print("Adding cache file %s\n", logname);
map = g_new0(BlueSkyCacheFile, 1);
map->fs = fs;
item = bluesky_rangeset_lookup_next(items, item_offset);
if (item == NULL)
break;
- g_print(" item offset from range request: %d\n",
- (int)(item->start + async->start));
+ if (bluesky_verbose) {
+ g_print(" item offset from range request: %d\n",
+ (int)(item->start + async->start));
+ }
if (bluesky_rangeset_insert(cachefile->items,
async->start + item->start,
item->length, item->data))
goto exit2;
}
if (rangeitem == NULL) {
- g_print("Item at offset 0x%zx not available, need to fetch.\n",
- file_offset);
+ if (bluesky_verbose) {
+ g_print("Item at offset 0x%zx not available, need to fetch.\n",
+ file_offset);
+ }
if (range_request) {
uint64_t start = 0, length = 0, end;
if (map->prefetches != NULL)
g_cond_wait(map->cond, map->lock);
} else if (rangeitem->start == file_offset
&& rangeitem->length == file_size) {
- g_print("Item now available.\n");
+ if (bluesky_verbose)
+ g_print("Item now available.\n");
break;
}
}
if (g_atomic_int_dec_and_test(&mmap->mapcount)) {
g_mutex_lock(mmap->lock);
if (g_atomic_int_get(&mmap->mapcount) == 0) {
- g_print("Unmapped log segment %d...\n", mmap->log_seq);
+ if (bluesky_verbose)
+ g_print("Unmapped log segment %d...\n", mmap->log_seq);
munmap((void *)mmap->addr, mmap->len);
mmap->addr = NULL;
g_atomic_int_add(&mmap->refcount, -1);