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/gnu/fs/xfs | |
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/gnu/fs/xfs')
-rw-r--r-- | sys/gnu/fs/xfs/FreeBSD/xfs_buf.c | 6 | ||||
-rw-r--r-- | sys/gnu/fs/xfs/FreeBSD/xfs_buf.h | 3 |
2 files changed, 4 insertions, 5 deletions
diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c b/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c index 30aafc4..65030df 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c @@ -86,7 +86,7 @@ xfs_buf_get_empty(size_t size, xfs_buftarg_t *target) bp->b_bufsize = size; bp->b_bcount = size; - KASSERT(BUF_REFCNT(bp) == 1, + KASSERT(BUF_ISLOCKED(bp), ("xfs_buf_get_empty: bp %p not locked",bp)); xfs_buf_set_target(bp, target); @@ -103,7 +103,7 @@ xfs_buf_get_noaddr(size_t len, xfs_buftarg_t *target) bp = geteblk(len); if (bp != NULL) { - KASSERT(BUF_REFCNT(bp) == 1, + KASSERT(BUF_ISLOCKED(bp), ("xfs_buf_get_empty: bp %p not locked",bp)); xfs_buf_set_target(bp, target); @@ -163,7 +163,7 @@ XFS_bwrite(xfs_buf_t *bp) if ((bp->b_flags & B_ASYNC) == 0) { error = bufwait(bp); #if 0 - if (BUF_REFCNT(bp) > 1) + if (BUF_LOCKRECURSED(bp)) BUF_UNLOCK(bp); else brelse(bp); diff --git a/sys/gnu/fs/xfs/FreeBSD/xfs_buf.h b/sys/gnu/fs/xfs/FreeBSD/xfs_buf.h index c27a14c..34e579d 100644 --- a/sys/gnu/fs/xfs/FreeBSD/xfs_buf.h +++ b/sys/gnu/fs/xfs/FreeBSD/xfs_buf.h @@ -160,7 +160,6 @@ xfs_buf_get_error(struct buf *bp) #define XFS_BUF_HOLD(x) ((void)0) #define XFS_BUF_UNHOLD(x) ((void)0) -#define XFS_BUF_ISHOLD(x) BUF_REFCNT(x) #define XFS_BUF_READ(x) ((x)->b_iocmd = BIO_READ) #define XFS_BUF_UNREAD(x) ((x)->b_iocmd = 0) @@ -234,7 +233,7 @@ xfs_buf_offset(xfs_buf_t *bp, size_t offset) #define XFS_BUF_SET_VTYPE(bp, type) #define XFS_BUF_SET_REF(bp, ref) -#define XFS_BUF_VALUSEMA(bp) (BUF_REFCNT(bp)? 0 : 1) +#define XFS_BUF_VALUSEMA(bp) (BUF_ISLOCKED(bp) ? 0 : 1) #define XFS_BUF_CPSEMA(bp) \ (BUF_LOCK(bp, LK_EXCLUSIVE|LK_CANRECURSE | LK_SLEEPFAIL, NULL) == 0) |