diff options
author | attilio <attilio@FreeBSD.org> | 2008-01-19 17:36:23 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2008-01-19 17:36:23 +0000 |
commit | caa2ca048b3049232f35da2c8dc2e7b2cb199d71 (patch) | |
tree | deeb8f52e2572015da8df31f2b2f73a4def65428 /sys/nfsclient | |
parent | a45d8c6482b786edcfd7a9ec4556ff8c4e2fe2e4 (diff) | |
download | FreeBSD-src-caa2ca048b3049232f35da2c8dc2e7b2cb199d71.zip FreeBSD-src-caa2ca048b3049232f35da2c8dc2e7b2cb199d71.tar.gz |
- Introduce the function lockmgr_recursed() which returns true if the
lockmgr lkp, when held in exclusive mode, is recursed
- Introduce the function BUF_RECURSED() which does the same for bufobj
locks based on the top of lockmgr_recursed()
- Introduce the function BUF_ISLOCKED() which works like the counterpart
VOP_ISLOCKED(9), showing the state of lockmgr linked with the bufobj
BUF_RECURSED() and BUF_ISLOCKED() entirely replace the usage of bogus
BUF_REFCNT() in a more explicative and SMP-compliant way.
This allows us to axe out BUF_REFCNT() and leaving the function
lockcount() totally unused in our stock kernel. Further commits will
axe lockcount() as well as part of lockmgr() cleanup.
KPI results, obviously, broken so further commits will update manpages
and freebsd version.
Tested by: kris (on UFS and NFS)
Diffstat (limited to 'sys/nfsclient')
-rw-r--r-- | sys/nfsclient/nfs_subs.c | 2 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/sys/nfsclient/nfs_subs.c b/sys/nfsclient/nfs_subs.c index 4bbf0b0..881b1a1 100644 --- a/sys/nfsclient/nfs_subs.c +++ b/sys/nfsclient/nfs_subs.c @@ -918,7 +918,7 @@ nfs_clearcommit(struct mount *mp) } MNT_IUNLOCK(mp); TAILQ_FOREACH_SAFE(bp, &vp->v_bufobj.bo_dirty.bv_hd, b_bobufs, nbp) { - if (BUF_REFCNT(bp) == 0 && + if (!BUF_ISLOCKED(bp) && (bp->b_flags & (B_DELWRI | B_NEEDCOMMIT)) == (B_DELWRI | B_NEEDCOMMIT)) bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK); diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 1a27e82..6e9e431 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -2692,8 +2692,9 @@ nfs_strategy(struct vop_strategy_args *ap) struct buf *bp = ap->a_bp; struct ucred *cr; - KASSERT(!(bp->b_flags & B_DONE), ("nfs_strategy: buffer %p unexpectedly marked B_DONE", bp)); - KASSERT(BUF_REFCNT(bp) > 0, ("nfs_strategy: buffer %p not locked", bp)); + KASSERT(!(bp->b_flags & B_DONE), + ("nfs_strategy: buffer %p unexpectedly marked B_DONE", bp)); + KASSERT(BUF_ISLOCKED(bp), ("nfs_strategy: buffer %p not locked", bp)); if (bp->b_iocmd == BIO_READ) cr = bp->b_rcred; @@ -2771,7 +2772,7 @@ again: bveccount = 0; VI_LOCK(vp); TAILQ_FOREACH_SAFE(bp, &vp->v_bufobj.bo_dirty.bv_hd, b_bobufs, nbp) { - if (BUF_REFCNT(bp) == 0 && + if (!BUF_ISLOCKED(bp) && (bp->b_flags & (B_DELWRI | B_NEEDCOMMIT)) == (B_DELWRI | B_NEEDCOMMIT)) bveccount++; @@ -3087,7 +3088,7 @@ nfs_writebp(struct buf *bp, int force __unused, struct thread *td) off_t off; #endif - if (BUF_REFCNT(bp) == 0) + if (!BUF_ISLOCKED(bp)) panic("bwrite: buffer is not locked???"); if (bp->b_flags & B_INVAL) { |