NFS cache writeback is now invoked periodically by a timer.
[bluesky.git] / nfs3 / rpc.c
index 7b73840..a7d108c 100644 (file)
@@ -471,7 +471,6 @@ nfs_program_3(RPCRequest *req)
     req->xdr_result = _xdr_result;
     result = (*local)((char *)req->args, req);
 
-    bluesky_flushd_invoke(fs);
     bluesky_debug_dump(fs);
 
     return;
@@ -483,10 +482,22 @@ nfs_program_3(RPCRequest *req)
 static GMainContext *main_context;
 static GMainLoop *main_loop;
 
+static gboolean async_flushd(gpointer data)
+{
+    bluesky_flushd_invoke(fs);
+    return TRUE;
+}
+
 static async_rpc_init()
 {
     main_context = g_main_context_new();
     main_loop = g_main_loop_new(main_context, FALSE);
+
+    /* Arrange to have the cache writeback code run every five seconds. */
+    GSource *source = g_timeout_source_new_seconds(5);
+    g_source_set_callback(source, async_flushd, NULL, NULL);
+    g_source_attach(source, main_context);
+    g_source_unref(source);
 }
 
 struct rpc_call_header {