From 0c584f43f1b30ab0ae895f58593c8035d666e16f Mon Sep 17 00:00:00 2001 From: sr Date: Tue, 16 Jul 2013 12:30:06 +0200 Subject: Fix more bugs, remove debug messages --- src/server/image.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/server/image.c') diff --git a/src/server/image.c b/src/server/image.c index 4fe465b..4d066ad 100644 --- a/src/server/image.c +++ b/src/server/image.c @@ -70,7 +70,7 @@ int image_is_complete(dnbd3_image_t *image) */ int image_save_cache_map(dnbd3_image_t *image) { - if ( image == NULL ) return TRUE; + if ( image == NULL || image->cache_map == NULL ) return TRUE; char mapfile[strlen( image->path ) + 4 + 1]; int fd; strcpy( mapfile, image->path ); @@ -104,9 +104,7 @@ dnbd3_image_t* image_get(char *name, uint16_t revision) pthread_spin_lock( &_images_lock ); for (i = 0; i < _num_images; ++i) { dnbd3_image_t * const image = _images[i]; - printf( "Comparing '%s' and '%s'..\n", name, image->lower_name ); if ( image == NULL || strcmp( image->lower_name, name ) != 0 ) continue; - printf( "RID %d and %d\n", (int)revision, (int)image->rid ); if ( revision == image->rid ) { candidate = image; break; @@ -126,7 +124,7 @@ dnbd3_image_t* image_get(char *name, uint16_t revision) // Found, see if it works struct stat st; if ( stat( candidate->path, &st ) < 0 ) { - printf( "File '%s' has gone away...\n", candidate->path ); + printf( "[DEBUG] File '%s' has gone away...\n", candidate->path ); candidate->working = FALSE; // No file? OUT! } candidate->users++; @@ -318,7 +316,6 @@ static int image_try_load(char *base, char *path) sprintf( mapFile, "%s.map", path ); int fdMap = open( mapFile, O_RDONLY ); if ( fdMap >= 0 ) { - printf( "Opened %s, cache_map is %p\n", mapFile, cache_map ); size_t map_size = IMGSIZE_TO_MAPBYTES( fileSize ); cache_map = calloc( 1, map_size ); int rd = read( fdMap, cache_map, map_size ); @@ -405,7 +402,6 @@ static int image_try_load(char *base, char *path) image->atime = time( NULL ); } image->working = (image->cache_map == NULL ); - printf( "Map: %p, work: %d\n", image->cache_map, (int)image->working ); pthread_spin_init( &image->lock, PTHREAD_PROCESS_PRIVATE ); // Get rid of cache map if image is complete if ( image->cache_map != NULL && image_is_complete( image ) ) { -- cgit v1.2.3-55-g7522