diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/client.c | 1 | ||||
-rw-r--r-- | src/clientconfig.h | 36 | ||||
-rw-r--r-- | src/config.h | 31 | ||||
-rw-r--r-- | src/fuse/connection.c | 2 | ||||
-rw-r--r-- | src/kernel/blk.c | 1 | ||||
-rw-r--r-- | src/kernel/core.c | 1 | ||||
-rw-r--r-- | src/kernel/net.c | 1 | ||||
-rw-r--r-- | src/server/altservers.c | 2 | ||||
-rw-r--r-- | src/server/globals.h | 2 | ||||
-rw-r--r-- | src/serverconfig.h (renamed from src/server/serverconfig.h) | 9 |
10 files changed, 51 insertions, 35 deletions
diff --git a/src/client/client.c b/src/client/client.c index fb1110d..685dbfd 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -18,6 +18,7 @@ * */ +#include "../clientconfig.h" #include "../types.h" #include "../version.h" diff --git a/src/clientconfig.h b/src/clientconfig.h new file mode 100644 index 0000000..f35f673 --- /dev/null +++ b/src/clientconfig.h @@ -0,0 +1,36 @@ +#ifndef _CLIENTCONFIG_H_ +#define _CLIENTCONFIG_H_ + +// Which is the minimum protocol version the client expects from the server +#define MIN_SUPPORTED_SERVER 2 + +// in seconds if not stated otherwise (MS = milliseconds) +#define SOCKET_TIMEOUT_CLIENT_DATA 2 +#define SOCKET_TIMEOUT_CLIENT_DISCOVERY 1 + +#define RTT_THRESHOLD_FACTOR(us) (((us) * 2) / 3) // 2/3 = current to best must be 33% worse +#define RTT_ABSOLUTE_THRESHOLD (80000) // Or 80ms worse +#define RTT_UNREACHABLE 0x7FFFFFFul // Use this value for timeout/unreachable as RTT. Don't set too high or you might get overflows. 0x7FFFFFF = 134 seconds +// This must be a power of two: +#define RTT_BLOCK_SIZE 4096 + +#define STARTUP_MODE_DURATION 30 +// Interval of several repeating tasks (in seconds) +#define TIMER_INTERVAL_PROBE_STARTUP 4 +#define TIMER_INTERVAL_PROBE_NORMAL 22 +#define TIMER_INTERVAL_PROBE_PANIC 2 +#define TIMER_INTERVAL_KEEPALIVE_PACKET 6 + +// Expect a keepalive response every X seconds +#define SOCKET_KEEPALIVE_TIMEOUT 8 + +// Number of unsuccessful alt_server probes before read errors are reported to the block layer +// (ALL servers will be probed this many times) +// Set to 0 to disable +#define PROBE_COUNT_TIMEOUT 0 + +// ++ Kernel module ++ +#define DEFAULT_READ_AHEAD_KB 512 +#define NUMBER_DEVICES 8 + +#endif diff --git a/src/config.h b/src/config.h index 6a03069..9f8ee10 100644 --- a/src/config.h +++ b/src/config.h @@ -33,41 +33,10 @@ // so either the client or server can run in compatibility mode, or they can // cancel the connection right away if the protocol has changed too much #define PROTOCOL_VERSION 2 -// Which is the minimum protocol version the client expects from the server -#define MIN_SUPPORTED_SERVER 2 -// Length of comment fields (for alt server etc.) -#define COMMENT_LENGTH 120 - -// in seconds if not stated otherwise (MS = milliseconds) -#define SOCKET_TIMEOUT_CLIENT_DATA 2 -#define SOCKET_TIMEOUT_CLIENT_DISCOVERY 1 #define NUMBER_SERVERS 8 // Number of alt servers per image/device -#define RTT_THRESHOLD_FACTOR(us) (((us) * 2) / 3) // 2/3 = current to best must be 33% worse -#define RTT_ABSOLUTE_THRESHOLD (80000) // Or 80ms worse -#define RTT_UNREACHABLE 0x7FFFFFFul // Use this value for timeout/unreachable as RTT. Don't set too high or you might get overflows. 0x7FFFFFF = 134 seconds -// This must be a power of two: -#define RTT_BLOCK_SIZE 4096 - -#define STARTUP_MODE_DURATION 30 -// Interval of several repeating tasks (in seconds) -#define TIMER_INTERVAL_PROBE_STARTUP 4 -#define TIMER_INTERVAL_PROBE_NORMAL 22 -#define TIMER_INTERVAL_PROBE_PANIC 2 -#define TIMER_INTERVAL_KEEPALIVE_PACKET 6 - -// Expect a keepalive response every X seconds -#define SOCKET_KEEPALIVE_TIMEOUT 8 - -// Number of unsuccessful alt_server probes before read errors are reported to the block layer -// (ALL servers will be probed this many times) -// Set to 0 to disable -#define PROBE_COUNT_TIMEOUT 0 // +++++ Block Device +++++ -#define KERNEL_SECTOR_SIZE 512 #define DNBD3_BLOCK_SIZE ((uint64_t)4096) // NEVER CHANGE THIS OR THE WORLD WILL END! -#define NUMBER_DEVICES 8 -#define DEFAULT_READ_AHEAD_KB 512 #endif /* CONFIG_H_ */ diff --git a/src/fuse/connection.c b/src/fuse/connection.c index 2fba1c7..3f142c7 100644 --- a/src/fuse/connection.c +++ b/src/fuse/connection.c @@ -1,6 +1,6 @@ #include "connection.h" #include "helper.h" -#include "../config.h" +#include "../clientconfig.h" #include "../shared/protocol.h" #include "../shared/fdsignal.h" #include "../shared/sockhelper.h" diff --git a/src/kernel/blk.c b/src/kernel/blk.c index 91fb8c7..7a2b6e9 100644 --- a/src/kernel/blk.c +++ b/src/kernel/blk.c @@ -18,6 +18,7 @@ * */ +#include "clientconfig.h" #include "blk.h" #include "net.h" #include "sysfs.h" diff --git a/src/kernel/core.c b/src/kernel/core.c index 4b4b093..69a2540 100644 --- a/src/kernel/core.c +++ b/src/kernel/core.c @@ -18,6 +18,7 @@ * */ +#include "clientconfig.h" #include "dnbd3.h" #include "blk.h" diff --git a/src/kernel/net.c b/src/kernel/net.c index 58b4664..b4c2331 100644 --- a/src/kernel/net.c +++ b/src/kernel/net.c @@ -18,6 +18,7 @@ * */ +#include "clientconfig.h" #include "net.h" #include "blk.h" #include "utils.h" diff --git a/src/server/altservers.c b/src/server/altservers.c index 12450aa..4c87344 100644 --- a/src/server/altservers.c +++ b/src/server/altservers.c @@ -3,7 +3,7 @@ #include "helper.h" #include "image.h" #include "../shared/protocol.h" -#include "serverconfig.h" +#include "../serverconfig.h" #include <assert.h> #include <inttypes.h> diff --git a/src/server/globals.h b/src/server/globals.h index cc3b6be..31b7741 100644 --- a/src/server/globals.h +++ b/src/server/globals.h @@ -3,7 +3,7 @@ #include "../types.h" #include "../shared/fdsignal.h" -#include "serverconfig.h" +#include "../serverconfig.h" #include <stdint.h> #include <time.h> #include <pthread.h> diff --git a/src/server/serverconfig.h b/src/serverconfig.h index efb8476..ea772b9 100644 --- a/src/server/serverconfig.h +++ b/src/serverconfig.h @@ -1,7 +1,7 @@ #ifndef _SERVERCONFIG_H_ #define _SERVERCONFIG_H_ -#include "../config.h" +#include "config.h" // +++++ Performance related #define SERVER_MAX_CLIENTS 4000 @@ -34,6 +34,13 @@ // Which is the minimum protocol version the server expects from the client #define MIN_SUPPORTED_CLIENT 2 +// Same for when we're a proxy talking to another server +#define MIN_SUPPORTED_SERVER 2 + +// Length of comment fields (for alt server etc.) +#define COMMENT_LENGTH 120 + +#define RTT_THRESHOLD_FACTOR(us) (((us) * 2) / 3) // 2/3 = current to best must be 33% worse #endif |