summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2013-11-13 17:27:19 +0100
committerSimon Rettberg2013-11-13 17:27:19 +0100
commit3551d4159392aa03668ed65bc83ce39d25030829 (patch)
tree9a6926f4c8f8c092c5da664530df5ac5fe2ddf32 /src
parent[SERVER] Decrease cache map save interval for now (diff)
downloaddnbd3-3551d4159392aa03668ed65bc83ce39d25030829.tar.gz
dnbd3-3551d4159392aa03668ed65bc83ce39d25030829.tar.xz
dnbd3-3551d4159392aa03668ed65bc83ce39d25030829.zip
[SERVER] Don't lock on image array when saving cache maps
Diffstat (limited to 'src')
-rw-r--r--src/server/image.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/server/image.c b/src/server/image.c
index f9e8ea1..4c296af 100644
--- a/src/server/image.c
+++ b/src/server/image.c
@@ -160,11 +160,9 @@ void image_markComplete(dnbd3_image_t *image)
*/
void image_saveAllCacheMaps()
{
- spin_lock( &_images_lock );
for (int i = 0; i < _num_images; ++i) {
image_saveCacheMap( _images[i] );
}
- spin_unlock( &_images_lock );
}
/**
@@ -638,7 +636,11 @@ static int image_try_load(char *base, char *path, int withUplink)
goto load_error;
} else if ( existing->cache_map != NULL && cache_map == NULL ) {
// Image seems complete now!
+ memlogf( "[INFO] Image %s is complete on disk now!", existing->lower_name );
memset( existing->cache_map, -1, IMGSIZE_TO_MAPBYTES(existing->filesize) );
+ spin_lock( &existing->lock );
+ image_markComplete( existing );
+ spin_unlock( &existing->lock );
function_return = TRUE;
goto load_error;
} else { // Nothing changed about the existing image, so do nothing