summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/ufs/mfs/mfs_vfsops.c5
-rw-r--r--sys/ufs/mfs/mfs_vnops.c11
-rw-r--r--sys/ufs/mfs/mfsnode.h5
3 files changed, 17 insertions, 4 deletions
diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c
index 29a941d5b94..8ecee1a38d9 100644
--- a/sys/ufs/mfs/mfs_vfsops.c
+++ b/sys/ufs/mfs/mfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfs_vfsops.c,v 1.43 2012/09/10 11:11:00 jsing Exp $ */
+/* $OpenBSD: mfs_vfsops.c,v 1.44 2012/12/29 14:54:11 beck Exp $ */
/* $NetBSD: mfs_vfsops.c,v 1.10 1996/02/09 22:31:28 christos Exp $ */
/*
@@ -138,6 +138,7 @@ mfs_mount(struct mount *mp, const char *path, void *data,
mfsp->mfs_size = args.size;
mfsp->mfs_vnode = devvp;
mfsp->mfs_pid = p->p_pid;
+ mfsp->mfs_numbufs = 0;
mfsp->mfs_buflist = (struct buf *)0;
if ((error = ffs_mountfs(devvp, mp, p)) != 0) {
mfsp->mfs_buflist = (struct buf *)-1;
@@ -185,9 +186,11 @@ mfs_start(struct mount *mp, int flags, struct proc *p)
break;
}
mfsp->mfs_buflist = bp->b_actf;
+ mfsp->mfs_numbufs--;
splx(s);
mfs_doio(mfsp, bp);
wakeup((caddr_t)bp);
+ wakeup(&mfsp->mfs_numbufs);
}
if (bp == (struct buf *)-1)
break;
diff --git a/sys/ufs/mfs/mfs_vnops.c b/sys/ufs/mfs/mfs_vnops.c
index 62c2c8130c1..2d19f1658a3 100644
--- a/sys/ufs/mfs/mfs_vnops.c
+++ b/sys/ufs/mfs/mfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfs_vnops.c,v 1.42 2011/07/04 20:35:35 deraadt Exp $ */
+/* $OpenBSD: mfs_vnops.c,v 1.43 2012/12/29 14:54:11 beck Exp $ */
/* $NetBSD: mfs_vnops.c,v 1.8 1996/03/17 02:16:32 christos Exp $ */
/*
@@ -40,6 +40,7 @@
#include <sys/buf.h>
#include <sys/vnode.h>
#include <sys/malloc.h>
+#include <sys/mount.h>
#include <sys/specdev.h>
#include <machine/vmparam.h>
@@ -132,8 +133,13 @@ mfs_strategy(void *v)
struct mfsnode *mfsp;
struct vnode *vp;
struct proc *p = curproc;
+ int bufmax;
int s;
+ /* Constrain queue to a sensible value. */
+ bufmax = MIN(256, bcstats.kvaslots / 16);
+ bufmax = MIN(bufmax, bcstats.numbufs / 16);
+
if (!vfinddev(bp->b_dev, VBLK, &vp) || vp->v_usecount == 0)
panic("mfs_strategy: bad dev");
@@ -142,8 +148,11 @@ mfs_strategy(void *v)
mfs_doio(mfsp, bp);
} else {
s = splbio();
+ while (mfsp->mfs_numbufs > bufmax)
+ tsleep(&mfsp->mfs_numbufs, PRIBIO + 1, "mfsbufs", 0);
bp->b_actf = mfsp->mfs_buflist;
mfsp->mfs_buflist = bp;
+ mfsp->mfs_numbufs++;
splx(s);
wakeup((caddr_t)vp);
}
diff --git a/sys/ufs/mfs/mfsnode.h b/sys/ufs/mfs/mfsnode.h
index 0b55f07007e..0c5d89a1a76 100644
--- a/sys/ufs/mfs/mfsnode.h
+++ b/sys/ufs/mfs/mfsnode.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfsnode.h,v 1.12 2008/04/24 17:39:45 thib Exp $ */
+/* $OpenBSD: mfsnode.h,v 1.13 2012/12/29 14:54:11 beck Exp $ */
/* $NetBSD: mfsnode.h,v 1.3 1996/02/09 22:31:31 christos Exp $ */
/*
@@ -42,7 +42,8 @@ struct mfsnode {
long mfs_size; /* size of memory file system */
pid_t mfs_pid; /* supporting process pid */
struct buf *mfs_buflist; /* list of I/O requests */
- long mfs_spare[4];
+ long mfs_numbufs; /* # of bufs on I/O request list */
+ long mfs_spare[3];
};
/*