From b24b61b32a9fedc5de53427f16b7eb72e27e858d Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Tue, 10 Jun 2008 20:14:38 +0000 Subject: Buffer cache revamp 1) remove multiple size queues, introduced as a stopgap. 2) decouple pages containing data from their mappings 3) only keep buffers mapped when they actually have to be mapped (right now, this is when buffers are B_BUSY) 4) New functions to make a buffer busy, and release the busy flag (buf_acquire and buf_release) 5) Move high/low water marks and statistics counters into a structure 6) Add a sysctl to retrieve buffer cache statistics Tested in several variants and beat upon by bob and art for a year. run accidentally on henning's nfs server for a few months... ok deraadt@, krw@, art@ - who promises to be around to deal with any fallout --- sys/ufs/ext2fs/ext2fs_bmap.c | 3 ++- sys/ufs/ext2fs/ext2fs_inode.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'sys/ufs/ext2fs') diff --git a/sys/ufs/ext2fs/ext2fs_bmap.c b/sys/ufs/ext2fs/ext2fs_bmap.c index dc7acb7d213..5de33f44a8f 100644 --- a/sys/ufs/ext2fs/ext2fs_bmap.c +++ b/sys/ufs/ext2fs/ext2fs_bmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_bmap.c,v 1.15 2007/06/17 20:15:25 jasper Exp $ */ +/* $OpenBSD: ext2fs_bmap.c,v 1.16 2008/06/10 20:14:37 beck Exp $ */ /* $NetBSD: ext2fs_bmap.c,v 1.5 2000/03/30 12:41:11 augustss Exp $ */ /* @@ -190,6 +190,7 @@ ext2fs_bmaparray(struct vnode *vp, int32_t bn, daddr64_t *bnp, bp->b_flags |= B_READ; VOP_STRATEGY(bp); curproc->p_stats->p_ru.ru_inblock++; /* XXX */ + bcstats.pendingreads++; if ((error = biowait(bp)) != 0) { brelse(bp); return (error); diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c index a78632ce518..a974b9f0874 100644 --- a/sys/ufs/ext2fs/ext2fs_inode.c +++ b/sys/ufs/ext2fs/ext2fs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_inode.c,v 1.39 2007/10/29 17:06:20 chl Exp $ */ +/* $OpenBSD: ext2fs_inode.c,v 1.40 2008/06/10 20:14:37 beck Exp $ */ /* $NetBSD: ext2fs_inode.c,v 1.24 2001/06/19 12:59:18 wiz Exp $ */ /* @@ -466,6 +466,8 @@ ext2fs_indirtrunc(struct inode *ip, int32_t lbn, int32_t dbn, int32_t lastbn, in bp = getblk(vp, lbn, (int)fs->e2fs_bsize, 0, 0); if (!(bp->b_flags & (B_DONE | B_DELWRI))) { curproc->p_stats->p_ru.ru_inblock++; /* pay for read */ + bcstats.pendingreads++; + bcstats.numreads++; bp->b_flags |= B_READ; if (bp->b_bcount > bp->b_bufsize) panic("ext2fs_indirtrunc: bad buffer size"); -- cgit v1.2.3