From ddb3658e4a9d9efb7a8628fee483e5371c426d12 Mon Sep 17 00:00:00 2001 From: fredrik Date: Tue, 22 May 2007 00:28:08 +0000 Subject: [PATCH] Added cli.hashwritedelay. git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@1040 959494ce-11ee-0310-bf91-de5d638817bd --- daemon/client.c | 12 +++++++++++- daemon/fnet-dc.c | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/daemon/client.c b/daemon/client.c index 6aa1887..c077453 100644 --- a/daemon/client.c +++ b/daemon/client.c @@ -74,6 +74,15 @@ static struct configvar myvars[] = /** The filename to use for the hash cache (see the FILES section * for more information). */ {CONF_VAR_STRING, "hashcache", {.str = L"dc-hashcache"}}, + /** Writes of the hash cache and file lists are delayed for an + * amount of time, in order to minimize the time spent on I/O wait + * while hashing many small files. This variable sets the amount + * of time, in seconds. */ + {CONF_VAR_INT, "hashwritedelay", {.num = 300}}, + /** The amount of time, in seconds, to wait before automatically + * rescanning the shared directories for changes. Set to zero (the + * default) to disable automatic rescanning. */ + {CONF_VAR_INT, "rescandelay", {.num = 0}}, {CONF_VAR_END} }; @@ -94,6 +103,7 @@ static struct timer *hashwritetimer = NULL; * job. */ static pid_t hashjob = -1; struct sharecache *shareroot = NULL; +static time_t lastscan = 0; unsigned long long sharesize = 0; GCBCHAIN(sharechangecb, unsigned long long); @@ -347,7 +357,7 @@ static void writehashcache(int now) if(!now) { if(hashwritetimer == NULL) - hashwritetimer = timercallback(ntime() + 300, (void (*)(int, void *))hashtimercb, NULL); + hashwritetimer = timercallback(ntime() + confgetint("cli", "hashwritedelay"), (void (*)(int, void *))hashtimercb, NULL); return; } if(hashwritetimer != NULL) diff --git a/daemon/fnet-dc.c b/daemon/fnet-dc.c index 1d0b0f5..7cbb32e 100644 --- a/daemon/fnet-dc.c +++ b/daemon/fnet-dc.c @@ -3531,7 +3531,7 @@ static void updatelists(int now) if(!now) { if(listwritetimer == NULL) - listwritetimer = timercallback(ntime() + 300, listtimercb, NULL); + listwritetimer = timercallback(ntime() + confgetint("cli", "hashwritedelay"), listtimercb, NULL); return; } if(listwritetimer != NULL) -- 2.11.0