From 5cc2d7413ae0dd76a16d798dcf060effe70cb3f9 Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Sun, 28 Nov 2010 20:29:33 -0800 Subject: [PATCH] Reduce debugging messages in non-verbose mode. --- bluesky/cloudlog.c | 10 +++++++--- bluesky/log.c | 21 ++++++++++++++------- nfs3/rpc.c | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/bluesky/cloudlog.c b/bluesky/cloudlog.c index fb83e02..4c94c49 100644 --- a/bluesky/cloudlog.c +++ b/bluesky/cloudlog.c @@ -316,7 +316,8 @@ void bluesky_cloudlog_prefetch(BlueSkyCloudLog *item) 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, @@ -325,7 +326,9 @@ void bluesky_cloudlog_prefetch(BlueSkyCloudLog *item) 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); @@ -573,7 +576,8 @@ void bluesky_cloudlog_decrypt(char *segment, size_t len, 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)); } diff --git a/bluesky/log.c b/bluesky/log.c index 4cef5fd..6d5c590 100644 --- a/bluesky/log.c +++ b/bluesky/log.c @@ -402,7 +402,8 @@ BlueSkyCacheFile *bluesky_cachefile_lookup(BlueSkyFS *fs, /* 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; @@ -500,8 +501,10 @@ static void cloudlog_partial_fetch_complete(BlueSkyStoreAsync *async, 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)) @@ -614,8 +617,10 @@ BlueSkyRCStr *bluesky_log_map_object(BlueSkyCloudLog *item, gboolean map_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) @@ -633,7 +638,8 @@ BlueSkyRCStr *bluesky_log_map_object(BlueSkyCloudLog *item, gboolean map_data) 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; } } @@ -684,7 +690,8 @@ void bluesky_mmap_unref(BlueSkyCacheFile *mmap) 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); diff --git a/nfs3/rpc.c b/nfs3/rpc.c index 05d9722..fe7d620 100644 --- a/nfs3/rpc.c +++ b/nfs3/rpc.c @@ -231,7 +231,7 @@ async_rpc_send_reply(RPCRequest *req, void *result) bluesky_profile_add_event(req->profile, g_strdup("NFS reply sent")); - bluesky_profile_print(req->profile); + //bluesky_profile_print(req->profile); /* Clean up. */ bluesky_profile_free(req->profile); -- 2.20.1