summaryrefslogtreecommitdiffstats
path: root/src/server/image.c
diff options
context:
space:
mode:
authorsr2013-07-26 18:42:52 +0200
committersr2013-07-26 18:42:52 +0200
commit8b65d18653bb7a5c7aba714de0767a1e93ef78c1 (patch)
tree207212bdedaa918c2dc84005fe54826db40b26a6 /src/server/image.c
parentWork in progress: uplink (diff)
downloaddnbd3-8b65d18653bb7a5c7aba714de0767a1e93ef78c1.tar.gz
dnbd3-8b65d18653bb7a5c7aba714de0767a1e93ef78c1.tar.xz
dnbd3-8b65d18653bb7a5c7aba714de0767a1e93ef78c1.zip
[SERVER] Still working on the uplink... Almost there
Diffstat (limited to 'src/server/image.c')
-rw-r--r--src/server/image.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/server/image.c b/src/server/image.c
index abecda5..2a24092 100644
--- a/src/server/image.c
+++ b/src/server/image.c
@@ -106,6 +106,7 @@ void image_update_cachemap(dnbd3_image_t *image, uint64_t start, uint64_t end, c
while ( pos < end ) {
const int block = pos / HASH_BLOCK_SIZE;
// TODO: Actually queue the hash block for checking as soon as there's a worker for that
+ (void)block;
pos += HASH_BLOCK_SIZE;
}
}
@@ -250,7 +251,7 @@ dnbd3_image_t* image_free(dnbd3_image_t *image)
free( image->crc32 );
free( image->path );
free( image->lower_name );
- image->uplink = uplink_shutdown( image->uplink );
+ uplink_shutdown( image );
if ( image->cacheFd != -1 ) close( image->cacheFd );
spin_destroy( &image->lock );
//
@@ -482,6 +483,10 @@ static int image_try_load(char *base, char *path)
} else if ( existing->crc32 != NULL && crc32list != NULL
&& memcmp( existing->crc32, crc32list, sizeof(uint32_t) * hashBlocks ) != 0 ) {
memlogf( "[WARNING] CRC32 list of image '%s' has changed.", path );
+ } else if ( existing->crc32 == NULL && crc32list != NULL ) {
+ memlogf( "[INFO] Found CRC-32 list for already loaded image, adding...", path );
+ existing->crc32 = crc32list;
+ crc32list = NULL;
} else {
function_return = TRUE;
goto load_error;
@@ -515,7 +520,8 @@ static int image_try_load(char *base, char *path)
free( image->cache_map );
image->cache_map = NULL;
image->working = TRUE;
- } else {
+ }
+ if ( image->cache_map != NULL ) {
image->working = FALSE;
image->cacheFd = open( path, O_WRONLY );
if ( image->cacheFd < 0 ) {