--- sys/sys/file.h.orig 2008-11-27 21:46:47.000000000 +0000 +++ sys/sys/file.h 2008-11-27 21:50:10.000000000 +0000 @@ -133,11 +133,11 @@ int f_msgcount; /* (f) references from message queue */ /* DTYPE_VNODE specific fields */ - int f_seqcount; /* + int f_seqcount[2]; /* * count of sequential accesses -- cleared * by most seek operations. */ - off_t f_nextoff; /* + off_t f_nextoff[2]; /* * offset of next expected read or write */ void *f_label; /* Place-holder for struct label pointer. */ --- sys/kern/vfs_vnops.c.orig 2008-11-27 21:47:19.000000000 +0000 +++ sys/kern/vfs_vnops.c 2008-11-27 21:48:59.000000000 +0000 @@ -302,30 +302,30 @@ */ static __inline int -sequential_heuristic(struct uio *uio, struct file *fp) +sequential_heuristic(struct uio *uio, struct file *fp, int idx) { - if ((uio->uio_offset == 0 && fp->f_seqcount > 0) || - uio->uio_offset == fp->f_nextoff) { + if ((uio->uio_offset == 0 && fp->f_seqcount[idx] > 0) || + uio->uio_offset == fp->f_nextoff[idx]) { /* * XXX we assume that the filesystem block size is * the default. Not true, but still gives us a pretty * good indicator of how sequential the read operations * are. */ - fp->f_seqcount += (uio->uio_resid + BKVASIZE - 1) / BKVASIZE; - if (fp->f_seqcount > IO_SEQMAX) - fp->f_seqcount = IO_SEQMAX; - return(fp->f_seqcount << IO_SEQSHIFT); + fp->f_seqcount[idx] += (uio->uio_resid + BKVASIZE - 1) / BKVASIZE; + if (fp->f_seqcount[idx] > IO_SEQMAX) + fp->f_seqcount[idx] = IO_SEQMAX; + return(fp->f_seqcount[idx] << IO_SEQSHIFT); } /* * Not sequential, quick draw-down of seqcount */ - if (fp->f_seqcount > 1) - fp->f_seqcount = 1; + if (fp->f_seqcount[idx] > 1) + fp->f_seqcount[idx] = 1; else - fp->f_seqcount = 0; + fp->f_seqcount[idx] = 0; return(0); } @@ -517,7 +517,7 @@ } else vn_lock(vp, LK_SHARED | LK_RETRY, td); - ioflag |= sequential_heuristic(uio, fp); + ioflag |= sequential_heuristic(uio, fp, 0); #ifdef MAC error = mac_check_vnode_read(active_cred, fp->f_cred, vp); @@ -532,7 +532,7 @@ fp->f_vnread_flags = 0; FILE_UNLOCK(fp); } - fp->f_nextoff = uio->uio_offset; + fp->f_nextoff[0] = uio->uio_offset; VOP_UNLOCK(vp, 0, td); VFS_UNLOCK_GIANT(vfslocked); return (error); @@ -578,7 +578,7 @@ vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); if ((flags & FOF_OFFSET) == 0) uio->uio_offset = fp->f_offset; - ioflag |= sequential_heuristic(uio, fp); + ioflag |= sequential_heuristic(uio, fp, 1); #ifdef MAC error = mac_check_vnode_write(active_cred, fp->f_cred, vp); if (error == 0) @@ -586,7 +586,7 @@ error = VOP_WRITE(vp, uio, ioflag, fp->f_cred); if ((flags & FOF_OFFSET) == 0) fp->f_offset = uio->uio_offset; - fp->f_nextoff = uio->uio_offset; + fp->f_nextoff[1] = uio->uio_offset; VOP_UNLOCK(vp, 0, td); if (vp->v_type != VCHR) vn_finished_write(mp); --- sys/kern/vfs_syscalls.c.orig 2008-11-27 21:47:07.000000000 +0000 +++ sys/kern/vfs_syscalls.c 2008-11-27 21:49:18.000000000 +0000 @@ -1076,7 +1076,7 @@ if (fp->f_data == NULL) fp->f_data = vp; fp->f_flag = flags & FMASK; - fp->f_seqcount = 1; + fp->f_seqcount[0] = fp->f_seqcount[1] = 1; fp->f_type = (vp->v_type == VFIFO ? DTYPE_FIFO : DTYPE_VNODE); if (fp->f_ops == &badfileops) fp->f_ops = &vnops; --- sys/fs/devfs/devfs_vnops.c.orig 2008-11-27 21:47:45.000000000 +0000 +++ sys/fs/devfs/devfs_vnops.c 2008-11-27 21:49:42.000000000 +0000 @@ -1005,7 +1005,7 @@ if ((flags & FOF_OFFSET) == 0) fp->f_offset = uio->uio_offset; - fp->f_nextoff = uio->uio_offset; + fp->f_nextoff[0] = uio->uio_offset; return (error); } @@ -1437,7 +1437,7 @@ if ((flags & FOF_OFFSET) == 0) fp->f_offset = uio->uio_offset; - fp->f_nextoff = uio->uio_offset; + fp->f_nextoff[1] = uio->uio_offset; return (error); }