diff options
author | attilio <attilio@FreeBSD.org> | 2008-03-01 19:47:50 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2008-03-01 19:47:50 +0000 |
commit | 0d873341312bfcbee292129a09cf72ab59e3ef38 (patch) | |
tree | aae2aca960881cff832f160d3cf4e0a5dcfa5d55 /sys/kern/vfs_bio.c | |
parent | 354de8687f8df06279d4389e7437123d99d5ddb9 (diff) | |
download | FreeBSD-src-0d873341312bfcbee292129a09cf72ab59e3ef38.zip FreeBSD-src-0d873341312bfcbee292129a09cf72ab59e3ef38.tar.gz |
- Handle buffer lock waiters count directly in the buffer cache instead
than rely on the lockmgr support [1]:
* bump the waiters only if the interlock is held
* let brelvp() return the waiters count
* rely on brelvp() instead than BUF_LOCKWAITERS() in order to check
for the waiters number
- Remove a namespace pollution introduced recently with lockmgr.h
including lock.h by including lock.h directly in the consumers and
making it mandatory for using lockmgr.
- Modify flags accepted by lockinit():
* introduce LK_NOPROFILE which disables lock profiling for the
specified lockmgr
* introduce LK_QUIET which disables ktr tracing for the specified
lockmgr [2]
* disallow LK_SLEEPFAIL and LK_NOWAIT to be passed there so that it
can only be used on a per-instance basis
- Remove BUF_LOCKWAITERS() and lockwaiters() as they are no longer
used
This patch breaks KPI so __FreBSD_version will be bumped and manpages
updated by further commits. Additively, 'struct buf' changes results in
a disturbed ABI also.
[2] Really, currently there is no ktr tracing in the lockmgr, but it
will be added soon.
[1] Submitted by: kib
Tested by: pho, Andrea Barberio <insomniac at slackware dot it>
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r-- | sys/kern/vfs_bio.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index b789149..cf0ea46 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -557,6 +557,7 @@ bufinit(void) bp->b_qindex = QUEUE_EMPTY; bp->b_vflags = 0; bp->b_xflags = 0; + bp->b_waiters = 0; LIST_INIT(&bp->b_dep); BUF_LOCKINIT(bp); TAILQ_INSERT_TAIL(&bufqueues[QUEUE_EMPTY], bp, b_freelist); @@ -1195,7 +1196,7 @@ brelse(struct buf *bp) if (bp->b_bufsize) allocbuf(bp, 0); if (bp->b_vp) - brelvp(bp); + (void) brelvp(bp); } } @@ -1337,7 +1338,7 @@ brelse(struct buf *bp) if (bp->b_bufsize != 0) allocbuf(bp, 0); if (bp->b_vp != NULL) - brelvp(bp); + (void) brelvp(bp); } if (BUF_LOCKRECURSED(bp)) { @@ -1401,7 +1402,7 @@ brelse(struct buf *bp) if (bp->b_flags & B_DELWRI) bundirty(bp); if (bp->b_vp) - brelvp(bp); + (void) brelvp(bp); } /* @@ -1569,7 +1570,7 @@ vfs_vmio_release(struct buf *bp) bp->b_npages = 0; bp->b_flags &= ~B_VMIO; if (bp->b_vp) - brelvp(bp); + (void) brelvp(bp); } /* @@ -1706,6 +1707,7 @@ getnewbuf(int slpflag, int slptimeo, int size, int maxsize) struct buf *nbp; int defrag = 0; int nqindex; + int waiters = 0; static int flushingbufs; /* @@ -1844,7 +1846,7 @@ restart: vfs_vmio_release(bp); } if (bp->b_vp) - brelvp(bp); + waiters = brelvp(bp); } /* @@ -1913,7 +1915,7 @@ restart: * Notify any waiters for the buffer lock about * identity change by freeing the buffer. */ - if (qindex == QUEUE_CLEAN && BUF_LOCKWAITERS(bp) > 0) { + if (qindex == QUEUE_CLEAN && waiters > 0) { bp->b_flags |= B_INVAL; bfreekva(bp); brelse(bp); |