summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/nsr-server
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2014-02-03 08:28:43 -0800
committerGerrit Code Review <review@dev.gluster.org>2014-02-03 08:28:43 -0800
commit5839c70ea79e9afeada2f103703e45eb25e59094 (patch)
tree56d9f0c7725c824c107006030cad905c01a16d82 /xlators/cluster/nsr-server
parente1bfa08e63d3be4d76b0a72f11cd9129d75b04dd (diff)
parent0d969dd883d11c1b2be678c270fe1e5a7026ecbe (diff)
Merge "nsr-server: add periodic fsync (as syncop)"
Diffstat (limited to 'xlators/cluster/nsr-server')
-rw-r--r--xlators/cluster/nsr-server/src/nsr.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/xlators/cluster/nsr-server/src/nsr.c b/xlators/cluster/nsr-server/src/nsr.c
index b4618bb62..75412a8f5 100644
--- a/xlators/cluster/nsr-server/src/nsr.c
+++ b/xlators/cluster/nsr-server/src/nsr.c
@@ -20,7 +20,7 @@
#include "api/src/glfs-internal.h"
#include "run.h"
#include "common-utils.h"
-
+#include "syncop.h"
#include "etcd-api.h"
#include "nsr-internal.h"
@@ -318,6 +318,7 @@ nsr_flush_thread (void *ctx)
struct list_head dirty_fds;
nsr_fd_ctx_t *fd_ctx;
nsr_fd_ctx_t *fd_tmp;
+ int ret;
for (;;) {
/*
@@ -351,6 +352,13 @@ nsr_flush_thread (void *ctx)
UNLOCK(&priv->dirty_lock);
list_for_each_entry_safe (fd_ctx, fd_tmp, &dirty_fds, fd_list) {
+ ret = syncop_fsync(FIRST_CHILD(this),fd_ctx->fd,0);
+ if (ret) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "failed to fsync %p (%d)",
+ fd_ctx->fd, -ret);
+ }
+
LOCK(&fd_ctx->fd->lock);
nsr_flush_fd(this,fd_ctx);
list_del_init(&fd_ctx->fd_list);