diff options
author | Simon Rettberg | 2014-06-16 19:24:17 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-06-16 19:24:17 +0200 |
commit | 49f9218d330f5842fe24bce79267bd2c5b239df3 (patch) | |
tree | 74e7b49e9c058145069ac4e2aa6de5d9f2cac3ce /src/server/globals.h | |
parent | [CLIENT] Debug argument handling in daemon mode (diff) | |
download | dnbd3-49f9218d330f5842fe24bce79267bd2c5b239df3.tar.gz dnbd3-49f9218d330f5842fe24bce79267bd2c5b239df3.tar.xz dnbd3-49f9218d330f5842fe24bce79267bd2c5b239df3.zip |
Improve uplink handling, add code to debug thread creation/destruction, change stupid convention of freeDiskSpace returning 0 on error, which is ambiguous to the disk simply being full...
Diffstat (limited to 'src/server/globals.h')
-rw-r--r-- | src/server/globals.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/server/globals.h b/src/server/globals.h index e44b26d..1b17660 100644 --- a/src/server/globals.h +++ b/src/server/globals.h @@ -42,19 +42,19 @@ typedef struct struct _dnbd3_connection { int fd; // socket fd to remote server - int signal; // write end of pipe used to wake up the process + int signal; // eventfd used to wake up the process pthread_t thread; // thread holding the connection pthread_spinlock_t queueLock; // lock for synchronization on request queue etc. dnbd3_queued_request_t queue[SERVER_MAX_UPLINK_QUEUE]; volatile int queueLen; // length of queue - dnbd3_image_t *image; // image that this uplink is used for do not call get/release for this pointer + dnbd3_image_t *image; // image that this uplink is used for; do not call get/release for this pointer dnbd3_host_t currentServer; // Current server we're connected to volatile int rttTestResult; // RTT_* dnbd3_host_t betterServer; // The better server int betterFd; // Active connection to better server, ready to use uint8_t *recvBuffer; // Buffer for receiving payload int recvBufferLen; // Len of ^^ - volatile int shutdown; // bool to signal thread to stop, must only be set from uplink_shutdown() + volatile int shutdown; // bool to signal thread to stop, must only be set from uplink_shutdown() or cleanup in uplink_mainloop() int replicatedLastBlock; // bool telling if the last block has been replicated yet time_t lastReplication; // timestamp of when last replication requests were sent }; @@ -98,10 +98,10 @@ struct _dnbd3_image { char *path; // absolute path of the image char *lower_name; // relative path, all lowercase, minus revision ID - uint8_t *cache_map; // cache map telling which parts are locally cached, NULL if complete + uint8_t * volatile cache_map; // cache map telling which parts are locally cached, NULL if complete uint32_t *crc32; // list of crc32 checksums for each 16MiB block in image uint32_t masterCrc32; // CRC-32 of the crc-32 list - dnbd3_connection_t *uplink; // pointer to a server connection + dnbd3_connection_t * volatile uplink; // pointer to a server connection uint64_t filesize; // size of image int cacheFd; // used to write to the image, in case it is relayed. ONLY USE FROM UPLINK THREAD! int rid; // revision of image |