kernel -- nfsserver: Allow for some reordering of RPCs before decaying seqcount.
authorVenkatesh Srinivas <me@endeavour.zapto.org>
Sat, 31 Dec 2011 05:27:01 +0000 (00:27 -0500)
committerVenkatesh Srinivas <me@endeavour.zapto.org>
Sat, 31 Dec 2011 05:27:01 +0000 (00:27 -0500)
Before decaying sequential heuristic, allow a limited amount of RPC reordering.
After that, decay by half for each out-of-order RPC rather than immediately
dropping to 1.

From FreeBSD r228185.

sys/vfs/nfs/nfs_serv.c

index feaa0fc..a1cc65b 100644 (file)
 #define nfsdbprintf(info)
 #endif
 
+#define MAX_REORDERED_RPC      (16)
 #define MAX_COMMIT_COUNT       (1024 * 1024)
 
 #define NUM_HEURISTIC          1031
@@ -190,8 +191,11 @@ nfsrv_sequential_heuristic(struct uio *uio, struct vnode *vp, int writeop)
                nh->nh_seqcount += howmany(uio->uio_resid, 16384);
                if (nh->nh_seqcount > IO_SEQMAX)
                        nh->nh_seqcount = IO_SEQMAX;
+       } else if (qabs(uio->uio_offset - nh->nh_nextoff) <= MAX_REORDERED_RPC *
+               imax(vp->v_mount->mnt_stat.f_iosize, uio->uio_resid)) {
+                   /* Probably a reordered RPC, leave seqcount alone. */
        } else if (nh->nh_seqcount > 1) {
-               nh->nh_seqcount = 1;
+               nh->nh_seqcount /= 2;
        } else {
                nh->nh_seqcount = 0;
        }