summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>1999-04-07 02:41:54 +0000
committerAlan Cox <alc@FreeBSD.org>1999-04-07 02:41:54 +0000
commitb2e2337ba1ba2558fdbedb475102d80b259e422f (patch)
tree155915851b609f2f0c7ba9f97c70efabc7aa0771
parent143b4dcdc7c7b745c89378270449272f4d5f3d53 (diff)
Notes
-rw-r--r--sys/kern/vfs_bio.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 3cc6b9436298..58d463b669ee 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -11,7 +11,7 @@
* 2. Absolutely no warranty of function or purpose is made by the author
* John S. Dyson.
*
- * $Id: vfs_bio.c,v 1.203 1999/03/19 10:17:44 bde Exp $
+ * $Id: vfs_bio.c,v 1.204 1999/04/05 19:38:30 julian Exp $
*/
/*
@@ -1132,6 +1132,29 @@ getnewbuf(struct vnode *vp, daddr_t blkno,
int countawrites = 0;
restart:
+ /*
+ * Calculate whether we are out of buffer space. This state is
+ * recalculated on every restart. If we are out of space, we
+ * have to turn off defragmentation. The outofspace code will
+ * defragment too, but the looping conditionals will be messed up
+ * if both outofspace and defrag are on.
+ */
+
+ outofspace = 0;
+ if (bufspace >= hibufspace) {
+ if ((curproc->p_flag & P_FLSINPROG) == 0 ||
+ bufspace >= maxbufspace
+ ) {
+ outofspace = 1;
+ defrag = 0;
+ }
+ }
+
+ /*
+ * defrag state is semi-persistant. 1 means we are flagged for
+ * defragging. -1 means we actually defragged something.
+ */
+ /* nop */
/*
* Setup for scan. If we do not have enough free buffers,
@@ -1139,6 +1162,9 @@ restart:
*
* If we are in the middle of a flush, we can dip into the
* emergency reserve.
+ *
+ * If we are out of space, we skip trying to scan QUEUE_EMPTY
+ * because those buffers are, well, empty.
*/
if ((curproc->p_flag & P_FLSINPROG) == 0 &&
@@ -1148,7 +1174,9 @@ restart:
nbp = NULL;
} else {
nqindex = QUEUE_EMPTY;
- if ((nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTY])) == NULL) {
+ if (outofspace ||
+ (nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTY])) == NULL
+ ) {
nqindex = QUEUE_AGE;
nbp = TAILQ_FIRST(&bufqueues[QUEUE_AGE]);
if (nbp == NULL) {
@@ -1159,30 +1187,6 @@ restart:
}
/*
- * Calculate whether we are out of buffer space. This state is
- * recalculated on every restart. If we are out of space, we
- * have to turn off defragmentation. The outofspace code will
- * defragment too, but the looping conditionals will be messed up
- * if both outofspace and defrag are on.
- */
-
- outofspace = 0;
- if (bufspace >= hibufspace) {
- if ((curproc->p_flag & P_FLSINPROG) == 0 ||
- bufspace >= maxbufspace
- ) {
- outofspace = 1;
- defrag = 0;
- }
- }
-
- /*
- * defrag state is semi-persistant. 1 means we are flagged for
- * defragging. -1 means we actually defragged something.
- */
- /* nop */
-
- /*
* Run scan, possibly freeing data and/or kva mappings on the fly
* depending.
*/