summaryrefslogtreecommitdiffstats
path: root/xlators/performance/nl-cache/src/nl-cache.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2020-09-03 11:17:07 +0300
committerAmar Tumballi <amar@kadalu.io>2020-09-07 12:56:45 +0000
commitc696144b3690f7ed8cf04a8b51ca601f45e427ad (patch)
tree5b8e2e145e0cde67fa35901feec77922e447e83c /xlators/performance/nl-cache/src/nl-cache.c
parenta1c89afd79a1ed08e37a4b5d17911ae29488eb8c (diff)
xlators: prefer libglusterfs time API
Prefer timespec_now_realtime() and gf_time() over clock_gettime() and time(), use gf_tvdiff() and gf_tsdiff() where appropriate, drop unused time_elapsed() and leftovers in 'struct posix_private'. Change-Id: Ie1f0229df5b03d0862193ce2b7fb91d27b0981b6 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Updates: #1002
Diffstat (limited to 'xlators/performance/nl-cache/src/nl-cache.c')
-rw-r--r--xlators/performance/nl-cache/src/nl-cache.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/xlators/performance/nl-cache/src/nl-cache.c b/xlators/performance/nl-cache/src/nl-cache.c
index cd0e1d195fd..33a7c471663 100644
--- a/xlators/performance/nl-cache/src/nl-cache.c
+++ b/xlators/performance/nl-cache/src/nl-cache.c
@@ -520,15 +520,13 @@ int
nlc_notify(xlator_t *this, int event, void *data, ...)
{
int ret = 0;
- time_t now = 0;
switch (event) {
case GF_EVENT_CHILD_DOWN:
case GF_EVENT_SOME_DESCENDENT_DOWN:
case GF_EVENT_CHILD_UP:
case GF_EVENT_SOME_DESCENDENT_UP:
- time(&now);
- nlc_update_child_down_time(this, &now);
+ nlc_update_child_down_time(this, gf_time());
/* TODO: nlc_clear_all_cache (this); else
lru prune will lazily clear it*/
break;
@@ -731,7 +729,7 @@ nlc_init(xlator_t *this)
GF_ATOMIC_INIT(conf->nlc_counter.nlc_invals, 0);
INIT_LIST_HEAD(&conf->lru);
- time(&conf->last_child_down);
+ conf->last_child_down = gf_time();
conf->timer_wheel = glusterfs_ctx_tw_get(this->ctx);
if (!conf->timer_wheel) {