summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2003-03-04 00:04:44 +0000
committerJeff Roberson <jeff@FreeBSD.org>2003-03-04 00:04:44 +0000
commit7261f5f68e9349946444ffcabe43a0a23ee5303d (patch)
tree60aed2b4c31a2d4a3c1cc94b83966280f8fc3eae /sys/kern
parentf7271711406addd1ef0e3e3e0b43b0753511b3ab (diff)
Notes
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_bio.c15
-rw-r--r--sys/kern/vfs_cluster.c8
2 files changed, 14 insertions, 9 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 10ad7dc3d8c9..a2807e952b2b 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -680,7 +680,7 @@ breadn(struct vnode * vp, daddr_t blkno, int size,
int i;
int rv = 0, readwait = 0;
- *bpp = bp = getblk(vp, blkno, size, 0, 0);
+ *bpp = bp = getblk(vp, blkno, size, 0, 0, 0);
/* if not found in cache, do some I/O */
if ((bp->b_flags & B_CACHE) == 0) {
@@ -702,7 +702,7 @@ breadn(struct vnode * vp, daddr_t blkno, int size,
for (i = 0; i < cnt; i++, rablkno++, rabsize++) {
if (inmem(vp, *rablkno))
continue;
- rabp = getblk(vp, *rablkno, *rabsize, 0, 0);
+ rabp = getblk(vp, *rablkno, *rabsize, 0, 0, 0);
if ((rabp->b_flags & B_CACHE) == 0) {
if (curthread != PCPU_GET(idlethread))
@@ -2367,7 +2367,8 @@ vfs_setdirty(struct buf *bp)
* prior to issuing the READ. biodone() will *not* clear B_INVAL.
*/
struct buf *
-getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo)
+getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo,
+ int flags)
{
struct buf *bp;
int s;
@@ -2399,13 +2400,17 @@ loop:
VI_LOCK(vp);
if ((bp = gbincore(vp, blkno))) {
+ int lockflags;
/*
* Buffer is in-core. If the buffer is not busy, it must
* be on a queue.
*/
+ lockflags = LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK;
- error = BUF_TIMELOCK(bp,
- LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK,
+ if (flags & GB_LOCK_NOWAIT)
+ lockflags |= LK_NOWAIT;
+
+ error = BUF_TIMELOCK(bp, lockflags,
VI_MTX(vp), "getblk", slpflag, slptimeo);
/*
diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c
index 96e541cf029c..bf944c57bca7 100644
--- a/sys/kern/vfs_cluster.c
+++ b/sys/kern/vfs_cluster.c
@@ -125,7 +125,7 @@ cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp)
/*
* get the requested block
*/
- *bpp = reqbp = bp = getblk(vp, lblkno, size, 0, 0);
+ *bpp = reqbp = bp = getblk(vp, lblkno, size, 0, 0, 0);
origblkno = lblkno;
origtotread = totread;
@@ -243,7 +243,7 @@ single_block_read:
rbp = cluster_rbuild(vp, filesize, lblkno,
blkno, size, ntoread, NULL);
} else {
- rbp = getblk(vp, lblkno, size, 0, 0);
+ rbp = getblk(vp, lblkno, size, 0, 0, 0);
rbp->b_flags |= B_ASYNC | B_RAM;
rbp->b_iocmd = BIO_READ;
rbp->b_blkno = blkno;
@@ -349,7 +349,7 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
tbp = fbp;
tbp->b_iocmd = BIO_READ;
} else {
- tbp = getblk(vp, lbn, size, 0, 0);
+ tbp = getblk(vp, lbn, size, 0, 0, 0);
if (tbp->b_flags & B_CACHE)
return tbp;
tbp->b_flags |= B_ASYNC | B_RAM;
@@ -420,7 +420,7 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp)
break;
}
- tbp = getblk(vp, lbn + i, size, 0, 0);
+ tbp = getblk(vp, lbn + i, size, 0, 0, 0);
/*
* Stop scanning if the buffer is fully valid