summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ffs/ffs_vnops.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>1999-06-26 02:47:16 +0000
committermckusick <mckusick@FreeBSD.org>1999-06-26 02:47:16 +0000
commit5b58f2f951911f1075788268f99efccf1dba60eb (patch)
tree3f01ed42f71231eaa6a8cfa08b267634f1923fb1 /sys/ufs/ffs/ffs_vnops.c
parent3213b13650cb2206bbd62b5b1764d148750f63a0 (diff)
downloadFreeBSD-src-5b58f2f951911f1075788268f99efccf1dba60eb.zip
FreeBSD-src-5b58f2f951911f1075788268f99efccf1dba60eb.tar.gz
Convert buffer locking from using the B_BUSY and B_WANTED flags to using
lockmgr locks. This commit should be functionally equivalent to the old semantics. That is, all buffer locking is done with LK_EXCLUSIVE requests. Changes to take advantage of LK_SHARED and LK_RECURSIVE will be done in future commits.
Diffstat (limited to 'sys/ufs/ffs/ffs_vnops.c')
-rw-r--r--sys/ufs/ffs/ffs_vnops.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 97c96fc..29f403a 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vnops.c 8.15 (Berkeley) 5/14/95
- * $Id: ffs_vnops.c,v 1.56 1999/05/14 01:26:05 mckusick Exp $
+ * $Id: ffs_vnops.c,v 1.57 1999/06/18 05:49:46 mckusick Exp $
*/
#include <sys/param.h>
@@ -159,8 +159,9 @@ loop:
* or if it's already scheduled, skip to the next
* buffer
*/
- if ((bp->b_flags & (B_BUSY | B_SCANNED)) ||
- ((skipmeta == 1) && (bp->b_lblkno < 0)))
+ if ((bp->b_flags & B_SCANNED) ||
+ ((skipmeta == 1) && (bp->b_lblkno < 0)) ||
+ BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT))
continue;
if ((bp->b_flags & B_DELWRI) == 0)
panic("ffs_fsync: not dirty");
@@ -181,17 +182,16 @@ loop:
if (passes > 0 || (ap->a_waitfor != MNT_WAIT)) {
if ((bp->b_flags & B_CLUSTEROK) &&
ap->a_waitfor != MNT_WAIT) {
+ BUF_UNLOCK(bp);
(void) vfs_bio_awrite(bp);
} else {
bremfree(bp);
- bp->b_flags |= B_BUSY;
splx(s);
(void) bawrite(bp);
s = splbio();
}
} else {
bremfree(bp);
- bp->b_flags |= B_BUSY;
splx(s);
if ((error = bwrite(bp)) != 0)
return (error);
@@ -203,11 +203,12 @@ loop:
* off the file, then throw it away.
*/
bremfree(bp);
- bp->b_flags |= B_BUSY | B_INVAL | B_NOCACHE;
+ bp->b_flags |= B_INVAL | B_NOCACHE;
splx(s);
brelse(bp);
s = splbio();
} else {
+ BUF_UNLOCK(bp);
vfs_bio_awrite(bp);
}
/*
OpenPOWER on IntegriCloud