Rework cache flushing logic--this version should work much better.
[bluesky.git] / nfs3 / nfs3.c
index b479107..ec5c736 100644 (file)
@@ -328,6 +328,8 @@ void nfsproc3_read_3_svc(read3args *argp, RPCRequest *req)
     memset(&result, 0, sizeof(result));
     char buf[NFS_MAXSIZE];
 
+    bluesky_flushd_invoke_conditional(fs);
+
     BlueSkyInode *inode = lookup_fh(req, &argp->file);
     if (inode == NULL) {
         result.status = NFS3ERR_STALE;
@@ -372,6 +374,8 @@ void nfsproc3_write_3_svc(write3args *argp, RPCRequest *req)
     struct wcc_data wcc;
     memset(&wcc, 0, sizeof(wcc));
 
+    bluesky_flushd_invoke_conditional(fs);
+
     BlueSkyInode *inode = lookup_fh(req, &argp->file);
     if (inode == NULL) {
         result.status = NFS3ERR_STALE;
@@ -380,6 +384,7 @@ void nfsproc3_write_3_svc(write3args *argp, RPCRequest *req)
         return;
     }
 
+#if 0
     /* FIXME: Hack to throttle writes when there is too much dirty data still
      * to be written out. */
     while (g_atomic_int_get(&fs->cache_dirty) > 4096
@@ -392,6 +397,7 @@ void nfsproc3_write_3_svc(write3args *argp, RPCRequest *req)
         delay.tv_nsec = 0;
         nanosleep(&delay, NULL);
     }
+#endif
 
     g_mutex_lock(inode->lock);