summaryrefslogtreecommitdiffstats
path: root/src/server/image.c
diff options
context:
space:
mode:
authorsr2013-07-16 12:30:06 +0200
committersr2013-07-16 12:30:06 +0200
commit0c584f43f1b30ab0ae895f58593c8035d666e16f (patch)
tree5e6abce006c41b1a8a8f06ddd377ebae7051090a /src/server/image.c
parentFix bugs from rewrite so it actually works (diff)
downloaddnbd3-0c584f43f1b30ab0ae895f58593c8035d666e16f.tar.gz
dnbd3-0c584f43f1b30ab0ae895f58593c8035d666e16f.tar.xz
dnbd3-0c584f43f1b30ab0ae895f58593c8035d666e16f.zip
Fix more bugs, remove debug messages
Diffstat (limited to 'src/server/image.c')
-rw-r--r--src/server/image.c8
1 files changed, 2 insertions, 6 deletions
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 ) ) {