summaryrefslogtreecommitdiffstats
path: root/src/server/uplink.c
diff options
context:
space:
mode:
authorSimon Rettberg2013-08-28 18:23:50 +0200
committerSimon Rettberg2013-08-28 18:23:50 +0200
commitc4141d61d8748bbbc3e21a9416b9fd7f8a5a75f3 (patch)
tree6ea18863656a0e264cf8b708d0741661a087f943 /src/server/uplink.c
parent[SERVER] Fix *printf format strings, remove falsely detected errors (diff)
downloaddnbd3-c4141d61d8748bbbc3e21a9416b9fd7f8a5a75f3.tar.gz
dnbd3-c4141d61d8748bbbc3e21a9416b9fd7f8a5a75f3.tar.xz
dnbd3-c4141d61d8748bbbc3e21a9416b9fd7f8a5a75f3.zip
[SERVER] Remove stupid 1MiB request expansion, this clearly needs to be done differently :)
Diffstat (limited to 'src/server/uplink.c')
-rw-r--r--src/server/uplink.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/server/uplink.c b/src/server/uplink.c
index e452557..111cda6 100644
--- a/src/server/uplink.c
+++ b/src/server/uplink.c
@@ -40,7 +40,10 @@ int uplink_init(dnbd3_image_t *image, int sock, dnbd3_host_t *host)
dnbd3_connection_t *link = NULL;
assert( image != NULL );
spin_lock( &image->lock );
- assert( image->uplink == NULL );
+ if ( image->uplink != NULL ) {
+ spin_unlock( &image->lock );
+ return TRUE;
+ }
if ( image->cache_map == NULL ) {
memlogf( "[WARNING] Uplink was requested for image %s, but it is already complete", image->lower_name );
goto failure;
@@ -127,8 +130,7 @@ int uplink_request(dnbd3_client_t *client, uint64_t handle, uint64_t start, uint
int existingType = -1; // ULR_* type of existing request
int i;
int freeSlot = -1;
- if ( length < 1024 * 1024 ) length = 1024 * 1024;
- const uint64_t end = MIN(start + length, uplink->image->filesize);
+ const uint64_t end = start + length;
spin_lock( &uplink->queueLock );
spin_unlock( &client->image->lock );