Subject: locked buffer tracking
To: None <tech-kern@netbsd.org>
From: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
List: tech-kern
Date: 09/05/2003 23:28:17
hi,

LFS keeps track of total size of B_LOCKED buffer (locked_queue_bytes)
so that it doesn't take too much buffer cache pages.
however, currently it loses when getblk() resizes one of them.

while the problem will be fixed with following patch,
i don't think it's so optimal.

i think that B_LOCKED buffer count/bytes tracking and buffer pinning codes
should be moved to some filesystem-independent place from the inside of LFS.

any comments/ideas?

YAMAMOTO Takashi


Index: vfs_bio.c
===================================================================
--- vfs_bio.c	(revision 302)
+++ vfs_bio.c	(revision 303)
@@ -747,7 +747,15 @@ start:
 	simple_unlock(&bp->b_interlock);
 	simple_unlock(&bqueue_slock);
 	splx(s);
-	allocbuf(bp, size);
+	/*
+	 * LFS can't track total size of B_LOCKED buffer (locked_queue_bytes)
+	 * if we re-size buffers here.
+	 */
+	if (ISSET(bp->b_flags, B_LOCKED)) {
+		KASSERT(bp->b_bufsize >= size);
+	} else {
+		allocbuf(bp, size);
+	}
 	return (bp);
 }