diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-27 05:27:13 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-11-27 05:27:13 +0000 |
commit | 8a1845e49f56720cbfccd4c7f5f80ba5b980fdf4 (patch) | |
tree | d4a522dc41cdc79ba48fe761e94663b795da8cc0 /sys/kern | |
parent | 0d68e9b5af14f4bfa04d22dbebab5972ac647b26 (diff) |
Merge in the unified buffer cache code as found in NetBSD 2001/03/10. The
code is written mostly by Chuck Silvers <chuq@chuq.com>/<chs@netbsd.org>.
Tested for the past few weeks by many developers, should be in a pretty stable
state, but will require optimizations and additional cleanups.
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/exec_subr.c | 3 | ||||
-rw-r--r-- | sys/kern/init_main.c | 4 | ||||
-rw-r--r-- | sys/kern/kern_exec.c | 3 | ||||
-rw-r--r-- | sys/kern/vfs_bio.c | 44 | ||||
-rw-r--r-- | sys/kern/vfs_default.c | 683 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 88 | ||||
-rw-r--r-- | sys/kern/vfs_sync.c | 17 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 13 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 31 | ||||
-rw-r--r-- | sys/kern/vnode_if.c | 140 | ||||
-rw-r--r-- | sys/kern/vnode_if.src | 47 |
11 files changed, 997 insertions, 76 deletions
diff --git a/sys/kern/exec_subr.c b/sys/kern/exec_subr.c index 770a29f8adc..e79db64dcae 100644 --- a/sys/kern/exec_subr.c +++ b/sys/kern/exec_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_subr.c,v 1.14 2001/11/07 01:18:01 art Exp $ */ +/* $OpenBSD: exec_subr.c,v 1.15 2001/11/27 05:27:11 art Exp $ */ /* $NetBSD: exec_subr.c,v 1.9 1994/12/04 03:10:42 mycroft Exp $ */ /* @@ -167,6 +167,7 @@ vmcmd_map_pagedvn(p, cmd) uobj = uvn_attach((void *) cmd->ev_vp, VM_PROT_READ|VM_PROT_EXECUTE); if (uobj == NULL) return(ENOMEM); + VREF(cmd->ev_vp); /* * do the map diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index c909a23141b..f807a181062 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.84 2001/11/10 18:42:31 art Exp $ */ +/* $OpenBSD: init_main.c,v 1.85 2001/11/27 05:27:11 art Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -217,6 +217,8 @@ main(framep) cpu_configure(); + ubc_init(); /* Initialize the unified buffer cache */ + /* Initialize sysctls (must be done before any processes run) */ sysctl_init(); diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 2d12034b386..9f621da43d2 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exec.c,v 1.60 2001/11/12 01:26:09 art Exp $ */ +/* $OpenBSD: kern_exec.c,v 1.61 2001/11/27 05:27:11 art Exp $ */ /* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */ /*- @@ -150,6 +150,7 @@ check_exec(p, epp) goto bad1; /* now we have the file, get the exec header */ + uvn_attach(vp, VM_PROT_READ); error = vn_rdwr(UIO_READ, vp, epp->ep_hdr, epp->ep_hdrlen, 0, UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p); if (error) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 71674e95236..6f361c989c0 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.51 2001/11/15 23:25:37 art Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.52 2001/11/27 05:27:11 art Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /*- @@ -406,7 +406,6 @@ bwrite(bp) /* Initiate disk write. Make sure the appropriate party is charged. */ bp->b_vp->v_numoutput++; splx(s); - SET(bp->b_flags, B_WRITEINPROG); VOP_STRATEGY(bp); if (async) @@ -466,7 +465,6 @@ bdwrite(bp) } /* Otherwise, the "write" is done, so mark and release the buffer. */ - CLR(bp->b_flags, B_NEEDCOMMIT); SET(bp->b_flags, B_DONE); brelse(bp); } @@ -588,6 +586,7 @@ brelse(bp) /* Unlock the buffer. */ CLR(bp->b_flags, (B_AGE | B_ASYNC | B_BUSY | B_NOCACHE | B_DEFERRED)); + SET(bp->b_flags, B_CACHE); /* Allow disk interrupts. */ splx(s); @@ -651,44 +650,30 @@ getblk(vp, blkno, size, slpflag, slptimeo) daddr_t blkno; int size, slpflag, slptimeo; { - struct bufhashhdr *bh; struct buf *bp, *nbp = NULL; int s, err; - /* - * XXX - * The following is an inlined version of 'incore()', but with - * the 'invalid' test moved to after the 'busy' test. It's - * necessary because there are some cases in which the NFS - * code sets B_INVAL prior to writing data to the server, but - * in which the buffers actually contain valid data. In this - * case, we can't allow the system to allocate a new buffer for - * the block until the write is finished. - */ - bh = BUFHASH(vp, blkno); start: - bp = bh->lh_first; - for (; bp != NULL; bp = bp->b_hash.le_next) { - if (bp->b_lblkno != blkno || bp->b_vp != vp) - continue; - + bp = incore(vp, blkno); + if (bp != NULL) { s = splbio(); if (ISSET(bp->b_flags, B_BUSY)) { SET(bp->b_flags, B_WANTED); err = tsleep(bp, slpflag | (PRIBIO + 1), "getblk", slptimeo); splx(s); - if (err) + if (err) { + if (nbp != NULL) { + SET(nbp->b_flags, B_AGE); + brelse(nbp); + } return (NULL); + } goto start; } - if (!ISSET(bp->b_flags, B_INVAL)) { - SET(bp->b_flags, (B_BUSY | B_CACHE)); - bremfree(bp); - splx(s); - break; - } + SET(bp->b_flags, (B_BUSY | B_CACHE)); + bremfree(bp); splx(s); } @@ -697,7 +682,7 @@ start: goto start; } bp = nbp; - binshash(bp, bh); + binshash(bp, BUFHASH(vp, blkno)); bp->b_blkno = bp->b_lblkno = blkno; s = splbio(); bgetvp(vp, bp); @@ -900,8 +885,6 @@ start: bp->b_error = 0; bp->b_resid = 0; bp->b_bcount = 0; - bp->b_dirtyoff = bp->b_dirtyend = 0; - bp->b_validoff = bp->b_validend = 0; bremhash(bp); *bpp = bp; @@ -1022,7 +1005,6 @@ biodone(bp) buf_complete(bp); if (!ISSET(bp->b_flags, B_READ)) { - CLR(bp->b_flags, B_WRITEINPROG); vwakeup(bp->b_vp); } diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 8f426b3a3f5..61f6d0217e9 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1,10 +1,9 @@ -/* $OpenBSD: vfs_default.c,v 1.7 2001/06/25 03:28:03 csapuntz Exp $ */ - +/* $OpenBSD: vfs_default.c,v 1.8 2001/11/27 05:27:12 art Exp $ */ /* * Portions of this code are: * - * Copyright (c) 1989, 1993 + * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed @@ -49,9 +48,11 @@ #include <sys/vnode.h> #include <sys/namei.h> #include <sys/malloc.h> +#include <sys/pool.h> #include <sys/event.h> #include <miscfs/specfs/specdev.h> +#include <uvm/uvm.h> extern struct simplelock spechash_slock; @@ -310,3 +311,679 @@ lease_check(void *v) { return (0); } + +/* + * generic VM getpages routine. + * Return PG_BUSY pages for the given range, + * reading from backing store if necessary. + */ + +int +genfs_getpages(v) + void *v; +{ + struct vop_getpages_args /* { + struct vnode *a_vp; + voff_t a_offset; + vm_page_t *a_m; + int *a_count; + int a_centeridx; + vm_prot_t a_access_type; + int a_advice; + int a_flags; + } */ *ap = v; + + off_t newsize, diskeof, memeof; + off_t offset, origoffset, startoffset, endoffset, raoffset; + daddr_t lbn, blkno; + int s, i, error, npages, orignpages, npgs, run, ridx, pidx, pcount; + int fs_bshift, fs_bsize, dev_bshift, dev_bsize; + int flags = ap->a_flags; + size_t bytes, iobytes, tailbytes, totalbytes, skipbytes; + vaddr_t kva; + struct buf *bp, *mbp; + struct vnode *vp = ap->a_vp; + struct uvm_object *uobj = &vp->v_uvm.u_obj; + struct vm_page *pgs[16]; /* XXXUBC 16 */ + struct ucred *cred = curproc->p_ucred; /* XXXUBC curproc */ + boolean_t async = (flags & PGO_SYNCIO) == 0; + boolean_t write = (ap->a_access_type & VM_PROT_WRITE) != 0; + boolean_t sawhole = FALSE; + struct proc *p = curproc; + UVMHIST_FUNC("genfs_getpages"); UVMHIST_CALLED(ubchist); + + UVMHIST_LOG(ubchist, "vp %p off 0x%x/%x count %d", + vp, ap->a_offset >> 32, ap->a_offset, *ap->a_count); + + /* XXXUBC temp limit */ + if (*ap->a_count > 16) { + return EINVAL; + } + + error = 0; + origoffset = ap->a_offset; + orignpages = *ap->a_count; + error = VOP_SIZE(vp, vp->v_uvm.u_size, &diskeof); + if (error) { + return error; + } + if (flags & PGO_PASTEOF) { + newsize = MAX(vp->v_uvm.u_size, + origoffset + (orignpages << PAGE_SHIFT)); + error = VOP_SIZE(vp, newsize, &memeof); + if (error) { + return error; + } + } else { + memeof = diskeof; + } + KASSERT(ap->a_centeridx >= 0 || ap->a_centeridx <= orignpages); + KASSERT((origoffset & (PAGE_SIZE - 1)) == 0 && origoffset >= 0); + KASSERT(orignpages > 0); + + /* + * Bounds-check the request. + */ + + if (origoffset + (ap->a_centeridx << PAGE_SHIFT) >= memeof) { + if ((flags & PGO_LOCKED) == 0) { + simple_unlock(&uobj->vmobjlock); + } + UVMHIST_LOG(ubchist, "off 0x%x count %d goes past EOF 0x%x", + origoffset, *ap->a_count, memeof,0); + return EINVAL; + } + + /* + * For PGO_LOCKED requests, just return whatever's in memory. + */ + + if (flags & PGO_LOCKED) { + uvn_findpages(uobj, origoffset, ap->a_count, ap->a_m, + UFP_NOWAIT|UFP_NOALLOC|UFP_NORDONLY); + + return ap->a_m[ap->a_centeridx] == NULL ? EBUSY : 0; + } + + /* vnode is VOP_LOCKed, uobj is locked */ + + if (write && (vp->v_bioflag & VBIOONSYNCLIST) == 0) { + vn_syncer_add_to_worklist(vp, syncdelay); + } + + /* + * find the requested pages and make some simple checks. + * leave space in the page array for a whole block. + */ + + fs_bshift = vp->v_mount->mnt_fs_bshift; + fs_bsize = 1 << fs_bshift; + dev_bshift = vp->v_mount->mnt_dev_bshift; + dev_bsize = 1 << dev_bshift; + KASSERT((diskeof & (dev_bsize - 1)) == 0); + KASSERT((memeof & (dev_bsize - 1)) == 0); + + orignpages = MIN(orignpages, + round_page(memeof - origoffset) >> PAGE_SHIFT); + npages = orignpages; + startoffset = origoffset & ~(fs_bsize - 1); + endoffset = round_page((origoffset + (npages << PAGE_SHIFT) + + fs_bsize - 1) & ~(fs_bsize - 1)); + endoffset = MIN(endoffset, round_page(memeof)); + ridx = (origoffset - startoffset) >> PAGE_SHIFT; + + memset(pgs, 0, sizeof(pgs)); + uvn_findpages(uobj, origoffset, &npages, &pgs[ridx], UFP_ALL); + + /* + * if PGO_OVERWRITE is set, don't bother reading the pages. + * PGO_OVERWRITE also means that the caller guarantees + * that the pages already have backing store allocated. + */ + + if (flags & PGO_OVERWRITE) { + UVMHIST_LOG(ubchist, "PGO_OVERWRITE",0,0,0,0); + + for (i = 0; i < npages; i++) { + struct vm_page *pg = pgs[ridx + i]; + + if (pg->flags & PG_FAKE) { + uvm_pagezero(pg); + pg->flags &= ~(PG_FAKE); + } + pg->flags &= ~(PG_RDONLY); + } + npages += ridx; + goto out; + } + + /* + * if the pages are already resident, just return them. + */ + + for (i = 0; i < npages; i++) { + struct vm_page *pg = pgs[ridx + i]; + + if ((pg->flags & PG_FAKE) || + (write && (pg->flags & PG_RDONLY))) { + break; + } + } + if (i == npages) { + UVMHIST_LOG(ubchist, "returning cached pages", 0,0,0,0); + raoffset = origoffset + (orignpages << PAGE_SHIFT); + npages += ridx; + goto raout; + } + + /* + * the page wasn't resident and we're not overwriting, + * so we're going to have to do some i/o. + * find any additional pages needed to cover the expanded range. + */ + + if (startoffset != origoffset) { + + /* + * XXXUBC we need to avoid deadlocks caused by locking + * additional pages at lower offsets than pages we + * already have locked. for now, unlock them all and + * start over. + */ + + for (i = 0; i < npages; i++) { + struct vm_page *pg = pgs[ridx + i]; + + if (pg->flags & PG_FAKE) { + pg->flags |= PG_RELEASED; + } + } + uvm_page_unbusy(&pgs[ridx], npages); + memset(pgs, 0, sizeof(pgs)); + + UVMHIST_LOG(ubchist, "reset npages start 0x%x end 0x%x", + startoffset, endoffset, 0,0); + npages = (endoffset - startoffset) >> PAGE_SHIFT; + npgs = npages; + uvn_findpages(uobj, startoffset, &npgs, pgs, UFP_ALL); + } + simple_unlock(&uobj->vmobjlock); + + /* + * read the desired page(s). + */ + + totalbytes = npages << PAGE_SHIFT; + bytes = MIN(totalbytes, MAX(diskeof - startoffset, 0)); + tailbytes = totalbytes - bytes; + skipbytes = 0; + + kva = uvm_pagermapin(pgs, npages, UVMPAGER_MAPIN_WAITOK | + UVMPAGER_MAPIN_READ); + + s = splbio(); + mbp = pool_get(&bufpool, PR_WAITOK); + splx(s); + mbp->b_bufsize = totalbytes; + mbp->b_data = (void *)kva; + mbp->b_resid = mbp->b_bcount = bytes; + mbp->b_flags = B_BUSY|B_READ| (async ? B_CALL : 0); + mbp->b_iodone = uvm_aio_biodone; + mbp->b_vp = vp; + LIST_INIT(&mbp->b_dep); + + /* + * if EOF is in the middle of the range, zero the part past EOF. + */ + + if (tailbytes > 0) { + memset((void *)(kva + bytes), 0, tailbytes); + } + + /* + * now loop over the pages, reading as needed. + */ + + if (write) { + lockmgr(&vp->v_glock, LK_EXCLUSIVE, NULL, p); + } else { + lockmgr(&vp->v_glock, LK_SHARED, NULL, p); + } + + bp = NULL; + for (offset = startoffset; + bytes > 0; + offset += iobytes, bytes -= iobytes) { + + /* + * skip pages which don't need to be read. + */ + + pidx = (offset - startoffset) >> PAGE_SHIFT; + while ((pgs[pidx]->flags & PG_FAKE) == 0) { + size_t b; + + KASSERT((offset & (PAGE_SIZE - 1)) == 0); + b = MIN(PAGE_SIZE, bytes); + offset += b; + bytes -= b; + skipbytes += b; + pidx++; + UVMHIST_LOG(ubchist, "skipping, new offset 0x%x", + offset, 0,0,0); + if (bytes == 0) { + goto loopdone; + } + } + + /* + * bmap the file to find out the blkno to read from and + * how much we can read in one i/o. if bmap returns an error, + * skip the rest of the top-level i/o. + */ + + lbn = offset >> fs_bshift; + error = VOP_BMAP(vp, lbn, NULL, &blkno, &run); + if (error) { + UVMHIST_LOG(ubchist, "VOP_BMAP lbn 0x%x -> %d\n", + lbn, error,0,0); + skipbytes += bytes; + goto loopdone; + } + + /* + * see how many pages can be read with this i/o. + * reduce the i/o size if necessary to avoid + * overwriting pages with valid data. + */ + + iobytes = MIN((((off_t)lbn + 1 + run) << fs_bshift) - offset, + bytes); + if (offset + iobytes > round_page(offset)) { + pcount = 1; + while (pidx + pcount < npages && + pgs[pidx + pcount]->flags & PG_FAKE) { + pcount++; + } + iobytes = MIN(iobytes, (pcount << PAGE_SHIFT) - + (offset - trunc_page(offset))); + } + + /* + * if this block isn't allocated, zero it instead of reading it. + * if this is a read access, mark the pages we zeroed PG_RDONLY. + */ + + if (blkno < 0) { + UVMHIST_LOG(ubchist, "lbn 0x%x -> HOLE", lbn,0,0,0); + + sawhole = TRUE; + memset((char *)kva + (offset - startoffset), 0, + iobytes); + skipbytes += iobytes; + + if (!write) { + int holepages = + (round_page(offset + iobytes) - + trunc_page(offset)) >> PAGE_SHIFT; + for (i = 0; i < holepages; i++) { + pgs[pidx + i]->flags |= PG_RDONLY; + } + } + continue; + } + + /* + * allocate a sub-buf for this piece of the i/o + * (or just use mbp if there's only 1 piece), + * and start it going. + */ + + if (offset == startoffset && iobytes == bytes) { + bp = mbp; + } else { + s = splbio(); + bp = pool_get(&bufpool, PR_WAITOK); + splx(s); + bp->b_data = (char *)kva + offset - startoffset; + bp->b_resid = bp->b_bcount = iobytes; + bp->b_flags = B_BUSY|B_READ|B_CALL; + bp->b_iodone = uvm_aio_biodone1; + bp->b_vp = vp; + LIST_INIT(&bp->b_dep); + } + bp->b_lblkno = 0; + bp->b_private = mbp; + + /* adjust physical blkno for partial blocks */ + bp->b_blkno = blkno + ((offset - ((off_t)lbn << fs_bshift)) >> + dev_bshift); + + UVMHIST_LOG(ubchist, "bp %p offset 0x%x bcount 0x%x blkno 0x%x", + bp, offset, iobytes, bp->b_blkno); + + VOP_STRATEGY(bp); + } + +loopdone: + if (skipbytes) { + s = splbio(); + if (error) { + mbp->b_flags |= B_ERROR; + mbp->b_error = error; + } + mbp->b_resid -= skipbytes; + if (mbp->b_resid == 0) { + biodone(mbp); + } + splx(s); + } + + if (async) { + UVMHIST_LOG(ubchist, "returning PEND",0,0,0,0); + lockmgr(&vp->v_glock, LK_RELEASE, NULL, p); + return EINPROGRESS; + } + if (bp != NULL) { + error = biowait(mbp); + } + s = splbio(); + pool_put(&bufpool, mbp); + splx(s); + uvm_pagermapout(kva, npages); + raoffset = startoffset + totalbytes; + + /* + * if this we encountered a hole then we have to do a little more work. + * for read faults, we marked the page PG_RDONLY so that future + * write accesses to the page will fault again. + * for write faults, we must make sure that the backing store for + * the page is completely allocated while the pages are locked. + */ + + if (error == 0 && sawhole && write) { + error = VOP_BALLOCN(vp, startoffset, npages << PAGE_SHIFT, + cred, 0); + if (error) { + UVMHIST_LOG(ubchist, "balloc lbn 0x%x -> %d", + lbn, error,0,0); + lockmgr(&vp->v_glock, LK_RELEASE, NULL, p); + simple_lock(&uobj->vmobjlock); + goto out; + } + } + lockmgr(&vp->v_glock, LK_RELEASE, NULL, p); + simple_lock(&uobj->vmobjlock); + + /* + * see if we want to start any readahead. + * XXXUBC for now, just read the next 128k on 64k boundaries. + * this is pretty nonsensical, but it is 50% faster than reading + * just the next 64k. + */ + +raout: + if (!error && !async && !write && ((int)raoffset & 0xffff) == 0 && + PAGE_SHIFT <= 16) { + int racount; + + racount = 1 << (16 - PAGE_SHIFT); + (void) VOP_GETPAGES(vp, raoffset, NULL, &racount, 0, + VM_PROT_READ, 0, 0); + simple_lock(&uobj->vmobjlock); + + racount = 1 << (16 - PAGE_SHIFT); + (void) VOP_GETPAGES(vp, raoffset + 0x10000, NULL, &racount, 0, + VM_PROT_READ, 0, 0); + simple_lock(&uobj->vmobjlock); + } + + /* + * we're almost done! release the pages... + * for errors, we free the pages. + * otherwise we activate them and mark them as valid and clean. + * also, unbusy pages that were not actually requested. + */ + +out: + if (error) { + uvm_lock_pageq(); + for (i = 0; i < npages; i++) { + if (pgs[i] == NULL) { + continue; + } + UVMHIST_LOG(ubchist, "examining pg %p flags 0x%x", + pgs[i], pgs[i]->flags, 0,0); + if (pgs[i]->flags & PG_WANTED) { + wakeup(pgs[i]); + } + if (pgs[i]->flags & PG_RELEASED) { + uvm_unlock_pageq(); + (uobj->pgops->pgo_releasepg)(pgs[i], NULL); + uvm_lock_pageq(); + continue; + } + if (pgs[i]->flags & PG_FAKE) { + uvm_pagefree(pgs[i]); + continue; + } + uvm_pageactivate(pgs[i]); + pgs[i]->flags &= ~(PG_WANTED|PG_BUSY); + UVM_PAGE_OWN(pgs[i], NULL); + } + uvm_unlock_pageq(); + simple_unlock(&uobj->vmobjlock); + UVMHIST_LOG(ubchist, "returning error %d", error,0,0,0); + return error; + } + + UVMHIST_LOG(ubchist, "succeeding, npages %d", npages,0,0,0); + uvm_lock_pageq(); + for (i = 0; i < npages; i++) { + if (pgs[i] == NULL) { + continue; + } + UVMHIST_LOG(ubchist, "examining pg %p flags 0x%x", + pgs[i], pgs[i]->flags, 0,0); + if (pgs[i]->flags & PG_FAKE) { + UVMHIST_LOG(ubchist, "unfaking pg %p offset 0x%x", + pgs[i], pgs[i]->offset,0,0); + pgs[i]->flags &= ~(PG_FAKE); + pmap_clear_modify(pgs[i]); + pmap_clear_reference(pgs[i]); + } + if (write) { + pgs[i]->flags &= ~(PG_RDONLY); + } + if (i < ridx || i >= ridx + orignpages || async) { + UVMHIST_LOG(ubchist, "unbusy pg %p offset 0x%x", + pgs[i], pgs[i]->offset,0,0); + if (pgs[i]->flags & PG_WANTED) { + wakeup(pgs[i]); + } + if (pgs[i]->flags & PG_RELEASED) { + uvm_unlock_pageq(); + (uobj->pgops->pgo_releasepg)(pgs[i], NULL); + uvm_lock_pageq(); + continue; + } + uvm_pageactivate(pgs[i]); + pgs[i]->flags &= ~(PG_WANTED|PG_BUSY); + UVM_PAGE_OWN(pgs[i], NULL); + } + } + uvm_unlock_pageq(); + simple_unlock(&uobj->vmobjlock); + if (ap->a_m != NULL) { + memcpy(ap->a_m, &pgs[ridx], + orignpages * sizeof(struct vm_page *)); + } + return 0; +} + +/* + * generic VM putpages routine. + * Write the given range of pages to backing store. + */ + +int +genfs_putpages(v) + void *v; +{ + struct vop_putpages_args /* { + struct vnode *a_vp; + struct vm_page **a_m; + int a_count; + int a_flags; + int *a_rtvals; + } */ *ap = v; + + int s, error, npages, run; + int fs_bshift, dev_bshift, dev_bsize; + vaddr_t kva; + off_t eof, offset, startoffset; + size_t bytes, iobytes, skipbytes; + daddr_t lbn, blkno; + struct vm_page *pg; + struct buf *mbp, *bp; + struct vnode *vp = ap->a_vp; + boolean_t async = (ap->a_flags & PGO_SYNCIO) == 0; + UVMHIST_FUNC("genfs_putpages"); UVMHIST_CALLED(ubchist); + UVMHIST_LOG(ubchist, "vp %p offset 0x%x count %d", + vp, ap->a_m[0]->offset, ap->a_count, 0); + + simple_unlock(&vp->v_uvm.u_obj.vmobjlock); + + error = VOP_SIZE(vp, vp->v_uvm.u_size, &eof); + if (error) { + return error; + } + + error = 0; + npages = ap->a_count; + fs_bshift = vp->v_mount->mnt_fs_bshift; + dev_bshift = vp->v_mount->mnt_dev_bshift; + dev_bsize = 1 << dev_bshift; + KASSERT((eof & (dev_bsize - 1)) == 0); + + pg = ap->a_m[0]; + startoffset = pg->offset; + bytes = MIN(npages << PAGE_SHIFT, eof - startoffset); + skipbytes = 0; + KASSERT(bytes != 0); + + kva = uvm_pagermapin(ap->a_m, npages, UVMPAGER_MAPIN_WAITOK); + + s = splbio(); + vp->v_numoutput += 2; + mbp = pool_get(&bufpool, PR_WAITOK); + UVMHIST_LOG(ubchist, "vp %p mbp %p num now %d bytes 0x%x", + vp, mbp, vp->v_numoutput, bytes); + splx(s); + mbp->b_bufsize = npages << PAGE_SHIFT; + mbp->b_data = (void *)kva; + mbp->b_resid = mbp->b_bcount = bytes; + mbp->b_flags = B_BUSY|B_WRITE|B_AGE | + (async ? B_CALL : 0) | + (curproc == uvm.pagedaemon_proc ? B_PDAEMON : 0); + mbp->b_iodone = uvm_aio_biodone; + mbp->b_vp = vp; + LIST_INIT(&mbp->b_dep); + + bp = NULL; + for (offset = startoffset; + bytes > 0; + offset += iobytes, bytes -= iobytes) { + lbn = offset >> fs_bshift; + error = VOP_BMAP(vp, lbn, NULL, &blkno, &run); + if (error) { + UVMHIST_LOG(ubchist, "VOP_BMAP() -> %d", error,0,0,0); + skipbytes += bytes; + bytes = 0; + break; + } + + iobytes = MIN((((off_t)lbn + 1 + run) << fs_bshift) - offset, + bytes); + if (blkno == (daddr_t)-1) { + skipbytes += iobytes; + continue; + } + + /* if it's really one i/o, don't make a second buf */ + if (offset == startoffset && iobytes == bytes) { + bp = mbp; + } else { + s = splbio(); + vp->v_numoutput++; + bp = pool_get(&bufpool, PR_WAITOK); + UVMHIST_LOG(ubchist, "vp %p bp %p num now %d", + vp, bp, vp->v_numoutput, 0); + splx(s); + bp->b_data = (char *)kva + + (vaddr_t)(offset - pg->offset); + bp->b_resid = bp->b_bcount = iobytes; + bp->b_flags = B_BUSY|B_WRITE|B_CALL|B_ASYNC; + bp->b_iodone = uvm_aio_biodone1; + bp->b_vp = vp; + LIST_INIT(&bp->b_dep); + } + bp->b_lblkno = 0; + bp->b_private = mbp; + + /* adjust physical blkno for partial blocks */ + bp->b_blkno = blkno + ((offset - ((off_t)lbn << fs_bshift)) >> + dev_bshift); + UVMHIST_LOG(ubchist, "vp %p offset 0x%x bcount 0x%x blkno 0x%x", + vp, offset, bp->b_bcount, bp->b_blkno); + VOP_STRATEGY(bp); + } + if (skipbytes) { + UVMHIST_LOG(ubchist, "skipbytes %d", skipbytes, 0,0,0); + s = splbio(); + mbp->b_resid -= skipbytes; + if (error) { + mbp->b_flags |= B_ERROR; + mbp->b_error = error; + } + if (mbp->b_resid == 0) { + biodone(mbp); + } + splx(s); + } + if (async) { + UVMHIST_LOG(ubchist, "returning PEND", 0,0,0,0); + return EINPROGRESS; + } + if (bp != NULL) { + UVMHIST_LOG(ubchist, "waiting for mbp %p", mbp,0,0,0); + error = biowait(mbp); + } + if (bioops.io_pageiodone) { + (*bioops.io_pageiodone)(mbp); + } + s = splbio(); + if (mbp->b_vp) + vwakeup(mbp->b_vp); + pool_put(&bufpool, mbp); + splx(s); + uvm_pagermapout(kva, npages); + UVMHIST_LOG(ubchist, "returning, error %d", error,0,0,0); + return error; +} + +int +genfs_size(v) + void *v; +{ + struct vop_size_args /* { + struct vnode *a_vp; + off_t a_size; + off_t *a_eobp; + } */ *ap = v; + int bsize; + + bsize = 1 << ap->a_vp->v_mount->mnt_fs_bshift; + *ap->a_eobp = (ap->a_size + bsize - 1) & ~(bsize - 1); + return 0; +} diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index e4efaff930f..7f668a7edde 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.72 2001/11/21 21:13:34 csapuntz Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.73 2001/11/27 05:27:12 art Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -377,6 +377,8 @@ getnewvnode(tag, mp, vops, vpp) int (**vops) __P((void *)); struct vnode **vpp; { + extern struct uvm_pagerops uvm_vnodeops; + struct uvm_object *uobj; struct proc *p = curproc; /* XXX */ struct freelst *listhd; static int toggle; @@ -410,7 +412,7 @@ getnewvnode(tag, mp, vops, vpp) splx(s); simple_unlock(&vnode_free_list_slock); vp = pool_get(&vnode_pool, PR_WAITOK); - bzero((char *)vp, sizeof *vp); + bzero(vp, sizeof *vp); numvnodes++; } else { for (vp = TAILQ_FIRST(listhd); vp != NULLVP; @@ -423,7 +425,7 @@ getnewvnode(tag, mp, vops, vpp) * the first NCPUS items on the free list are * locked, so this is close enough to being empty. */ - if (vp == NULLVP) { + if (vp == NULL) { splx(s); simple_unlock(&vnode_free_list_slock); tablefull("vnode"); @@ -458,6 +460,7 @@ getnewvnode(tag, mp, vops, vpp) vp->v_socket = 0; } vp->v_type = VNON; + lockinit(&vp->v_glock, PVFS, "glock", 0, 0); cache_purge(vp); vp->v_tag = tag; vp->v_op = vops; @@ -466,6 +469,16 @@ getnewvnode(tag, mp, vops, vpp) vp->v_usecount = 1; vp->v_data = 0; simple_lock_init(&vp->v_uvm.u_obj.vmobjlock); + + /* + * initialize uvm_object within vnode. + */ + + uobj = &vp->v_uvm.u_obj; + uobj->pgops = &uvm_vnodeops; + TAILQ_INIT(&uobj->memq); + vp->v_uvm.u_size = VSIZENOTSET; + return (0); } @@ -669,6 +682,10 @@ vget(vp, flags, p) flags |= LK_INTERLOCK; } if (vp->v_flag & VXLOCK) { + if (flags & LK_NOWAIT) { + simple_unlock(&vp->v_interlock); + return (EBUSY); + } vp->v_flag |= VXWANT; simple_unlock(&vp->v_interlock); tsleep((caddr_t)vp, PINOD, "vget", 0); @@ -787,6 +804,11 @@ vput(vp) #endif vputonfreelist(vp); + if (vp->v_flag & VTEXT) { + uvmexp.vtextpages -= vp->v_uvm.u_obj.uo_npages; + uvmexp.vnodepages += vp->v_uvm.u_obj.uo_npages; + } + vp->v_flag &= ~VTEXT; simple_unlock(&vp->v_interlock); VOP_INACTIVE(vp, p); @@ -827,6 +849,11 @@ vrele(vp) #endif vputonfreelist(vp); + if (vp->v_flag & VTEXT) { + uvmexp.vtextpages -= vp->v_uvm.u_obj.uo_npages; + uvmexp.vnodepages += vp->v_uvm.u_obj.uo_npages; + } + vp->v_flag &= ~VTEXT; if (vn_lock(vp, LK_EXCLUSIVE|LK_INTERLOCK, p) == 0) VOP_INACTIVE(vp, p); } @@ -1009,6 +1036,12 @@ vclean(vp, flags, p) if (vp->v_flag & VXLOCK) panic("vclean: deadlock"); vp->v_flag |= VXLOCK; + if (vp->v_flag & VTEXT) { + uvmexp.vtextpages -= vp->v_uvm.u_obj.uo_npages; + uvmexp.vnodepages += vp->v_uvm.u_obj.uo_npages; + } + vp->v_flag &= ~VTEXT; + /* * Even if the count is zero, the VOP_INACTIVE routine may still * have the object locked while it cleans it out. The VOP_LOCK @@ -1019,11 +1052,7 @@ vclean(vp, flags, p) VOP_LOCK(vp, LK_DRAIN | LK_INTERLOCK, p); /* - * clean out any VM data associated with the vnode. - */ - uvm_vnp_terminate(vp); - /* - * Clean out any buffers associated with the vnode. + * Clean out any cached data associated with the vnode. */ if (flags & DOCLOSE) vinvalbuf(vp, V_SAVE, NOCRED, p, 0, 0); @@ -1968,9 +1997,22 @@ vinvalbuf(vp, flags, cred, p, slpflag, slptimeo) struct proc *p; int slpflag, slptimeo; { - register struct buf *bp; + struct uvm_object *uobj = &vp->v_uvm.u_obj; + struct buf *bp; struct buf *nbp, *blist; - int s, error; + int s, error, rv; + int flushflags = PGO_ALLPAGES|PGO_FREE|PGO_SYNCIO| + (flags & V_SAVE ? PGO_CLEANIT : 0); + + /* XXXUBC this doesn't look at flags or slp* */ + if (vp->v_type == VREG) { + simple_lock(&uobj->vmobjlock); + rv = (uobj->pgops->pgo_flush)(uobj, 0, 0, flushflags); + simple_unlock(&uobj->vmobjlock); + if (!rv) { + return EIO; + } + } if (flags & V_SAVE) { s = splbio(); @@ -2040,12 +2082,21 @@ loop: void vflushbuf(vp, sync) - register struct vnode *vp; + struct vnode *vp; int sync; { - register struct buf *bp, *nbp; + struct uvm_object *uobj = &vp->v_uvm.u_obj; + struct buf *bp, *nbp; int s; + if (vp->v_type == VREG) { + int flags = PGO_CLEANIT|PGO_ALLPAGES| (sync ? PGO_SYNCIO : 0); + + simple_lock(&uobj->vmobjlock); + (uobj->pgops->pgo_flush)(uobj, 0, 0, flags); + simple_unlock(&uobj->vmobjlock); + } + loop: s = splbio(); for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = nbp) { @@ -2112,23 +2163,25 @@ bgetvp(vp, bp) */ void brelvp(bp) - register struct buf *bp; + struct buf *bp; { struct vnode *vp; - if ((vp = bp->b_vp) == (struct vnode *) 0) + if ((vp = bp->b_vp) == NULL) panic("brelvp: NULL"); + /* * Delete from old vnode list, if on one. */ if (bp->b_vnbufs.le_next != NOLIST) bufremvn(bp); - if ((vp->v_bioflag & VBIOONSYNCLIST) && + if (TAILQ_EMPTY(&vp->v_uvm.u_obj.memq) && + (vp->v_bioflag & VBIOONSYNCLIST) && LIST_FIRST(&vp->v_dirtyblkhd) == NULL) { vp->v_bioflag &= ~VBIOONSYNCLIST; LIST_REMOVE(vp, v_synclist); } - bp->b_vp = (struct vnode *) 0; + bp->b_vp = NULL; simple_lock(&vp->v_interlock); #ifdef DIAGNOSTIC @@ -2205,7 +2258,8 @@ reassignbuf(bp) */ if ((bp->b_flags & B_DELWRI) == 0) { listheadp = &vp->v_cleanblkhd; - if ((vp->v_bioflag & VBIOONSYNCLIST) && + if (TAILQ_EMPTY(&vp->v_uvm.u_obj.memq) && + (vp->v_bioflag & VBIOONSYNCLIST) && LIST_FIRST(&vp->v_dirtyblkhd) == NULL) { vp->v_bioflag &= ~VBIOONSYNCLIST; LIST_REMOVE(vp, v_synclist); diff --git a/sys/kern/vfs_sync.c b/sys/kern/vfs_sync.c index 4b07d0f373a..0adeb2f3065 100644 --- a/sys/kern/vfs_sync.c +++ b/sys/kern/vfs_sync.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_sync.c,v 1.20 2001/11/15 06:38:48 art Exp $ */ +/* $OpenBSD: vfs_sync.c,v 1.21 2001/11/27 05:27:12 art Exp $ */ /* * Portions of this code are: @@ -176,15 +176,12 @@ sched_sync(p) VOP_UNLOCK(vp, 0, p); s = splbio(); if (LIST_FIRST(slp) == vp) { - /* - * Note: disk vps can remain on the - * worklist too with no dirty blocks, but - * since sync_fsync() moves it to a different - * slot we are safe. - */ - if (LIST_FIRST(&vp->v_dirtyblkhd) == NULL && - vp->v_type != VBLK) - panic("sched_sync: fsync failed"); +#ifdef DIAGNOSTIC + if (!(vp->v_bioflag & VBIOONSYNCLIST)) { + vprint("vnode", vp); + panic("sched_fsync: on synclist, but no flag"); + } +#endif /* * Put us back on the worklist. The worklist * routine will remove us from our current diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 284fad0fbda..5433711decd 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.82 2001/11/06 19:53:20 miod Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.83 2001/11/27 05:27:12 art Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -493,7 +493,6 @@ sys_sync(p, v, retval) if ((mp->mnt_flag & MNT_RDONLY) == 0) { asyncflag = mp->mnt_flag & MNT_ASYNC; mp->mnt_flag &= ~MNT_ASYNC; - uvm_vnp_sync(mp); VFS_SYNC(mp, MNT_NOWAIT, p->p_ucred, p); if (asyncflag) mp->mnt_flag |= MNT_ASYNC; @@ -1064,6 +1063,13 @@ sys_fhopen(p, v, retval) } if ((error = VOP_OPEN(vp, flags, cred, p)) != 0) goto bad; + + if (vp->v_type == VREG && + uvn_attach(vp, flags & FWRITE ? VM_PROT_WRITE : 0) == NULL) { + error = EIO; + goto bad; + } + if (flags & FWRITE) vp->v_writecount++; @@ -1475,8 +1481,6 @@ sys_unlink(p, v, retval) goto out; } - (void)uvm_vnp_uncache(vp); - VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE); VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); error = VOP_REMOVE(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd); @@ -2338,7 +2342,6 @@ out: if (fromnd.ni_dvp != tdvp) VOP_LEASE(fromnd.ni_dvp, p, p->p_ucred, LEASE_WRITE); if (tvp) { - (void)uvm_vnp_uncache(tvp); VOP_LEASE(tvp, p, p->p_ucred, LEASE_WRITE); } error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd, diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index ee5eb0baee2..491db1172fa 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.35 2001/11/15 06:22:30 art Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.36 2001/11/27 05:27:12 art Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -165,6 +165,11 @@ vn_open(ndp, fmode, cmode) } if ((error = VOP_OPEN(vp, fmode, cred, p)) != 0) goto bad; + if (vp->v_type == VREG && + uvn_attach(vp, fmode & FWRITE ? VM_PROT_WRITE : 0) == NULL) { + error = EIO; + goto bad; + } if (fmode & FWRITE) vp->v_writecount++; return (0); @@ -197,11 +202,10 @@ vn_writechk(vp) } } /* - * If there's shared text associated with - * the vnode, try to free it up once. If - * we fail, we can't allow writing. + * If the vnode is in use as a process's text, + * we can't allow writing. */ - if ((vp->v_flag & VTEXT) && !uvm_vnp_uncache(vp)) + if (vp->v_flag & VTEXT) return (ETXTBSY); return (0); @@ -214,6 +218,23 @@ void vn_marktext(vp) struct vnode *vp; { + if ((vp->v_flag & VTEXT) == 0) { + uvmexp.vnodepages -= vp->v_uvm.u_obj.uo_npages; + uvmexp.vtextpages += vp->v_uvm.u_obj.uo_npages; +#if 0 + /* + * Doesn't help much because the pager is borked and ubc_flush is + * slow. + */ +#ifdef PMAP_PREFER + /* + * Get rid of any cached reads from this vnode. + * exec can't respect PMAP_PREFER when mapping the text. + */ + ubc_flush(&vp->v_uvm.u_obj, 0, 0); +#endif +#endif + } vp->v_flag |= VTEXT; } diff --git a/sys/kern/vnode_if.c b/sys/kern/vnode_if.c index 1f30d85c507..d2a3d8298bf 100644 --- a/sys/kern/vnode_if.c +++ b/sys/kern/vnode_if.c @@ -3,7 +3,7 @@ * (Modifications made here may easily be lost!) * * Created from the file: - * OpenBSD: vnode_if.src,v 1.11 2001/06/23 02:21:05 csapuntz Exp + * OpenBSD: vnode_if.src,v 1.13 2001/07/26 20:24:47 millert Exp * by the script: * OpenBSD: vnode_if.sh,v 1.8 2001/02/26 17:34:18 art Exp */ @@ -1230,6 +1230,140 @@ int VOP_WHITEOUT(dvp, cnp, flags) return (VCALL(dvp, VOFFSET(vop_whiteout), &a)); } +int vop_ballocn_vp_offsets[] = { + VOPARG_OFFSETOF(struct vop_ballocn_args,a_vp), + VDESC_NO_OFFSET +}; +struct vnodeop_desc vop_ballocn_desc = { + 0, + "vop_ballocn", + 0, + vop_ballocn_vp_offsets, + VDESC_NO_OFFSET, + VOPARG_OFFSETOF(struct vop_ballocn_args, a_cred), + VDESC_NO_OFFSET, + VDESC_NO_OFFSET, + NULL, +}; + +int VOP_BALLOCN(vp, offset, length, cred, flags) + struct vnode *vp; + off_t offset; + off_t length; + struct ucred *cred; + int flags; +{ + struct vop_ballocn_args a; + a.a_desc = VDESC(vop_ballocn); + a.a_vp = vp; + a.a_offset = offset; + a.a_length = length; + a.a_cred = cred; + a.a_flags = flags; + return (VCALL(vp, VOFFSET(vop_ballocn), &a)); +} + +int vop_getpages_vp_offsets[] = { + VOPARG_OFFSETOF(struct vop_getpages_args,a_vp), + VDESC_NO_OFFSET +}; +struct vnodeop_desc vop_getpages_desc = { + 0, + "vop_getpages", + 0, + vop_getpages_vp_offsets, + VDESC_NO_OFFSET, + VDESC_NO_OFFSET, + VDESC_NO_OFFSET, + VDESC_NO_OFFSET, + NULL, +}; + +int VOP_GETPAGES(vp, offset, m, count, centeridx, access_type, advice, flags) + struct vnode *vp; + voff_t offset; + vm_page_t *m; + int *count; + int centeridx; + vm_prot_t access_type; + int advice; + int flags; +{ + struct vop_getpages_args a; + a.a_desc = VDESC(vop_getpages); + a.a_vp = vp; + a.a_offset = offset; + a.a_m = m; + a.a_count = count; + a.a_centeridx = centeridx; + a.a_access_type = access_type; + a.a_advice = advice; + a.a_flags = flags; + return (VCALL(vp, VOFFSET(vop_getpages), &a)); +} + +int vop_putpages_vp_offsets[] = { + VOPARG_OFFSETOF(struct vop_putpages_args,a_vp), + VDESC_NO_OFFSET +}; +struct vnodeop_desc vop_putpages_desc = { + 0, + "vop_putpages", + 0, + vop_putpages_vp_offsets, + VDESC_NO_OFFSET, + VDESC_NO_OFFSET, + VDESC_NO_OFFSET, + VDESC_NO_OFFSET, + NULL, +}; + +int VOP_PUTPAGES(vp, m, count, flags, rtvals) + struct vnode *vp; + vm_page_t *m; + int count; + int flags; + int *rtvals; +{ + struct vop_putpages_args a; + a.a_desc = VDESC(vop_putpages); + a.a_vp = vp; + a.a_m = m; + a.a_count = count; + a.a_flags = flags; + a.a_rtvals = rtvals; + return (VCALL(vp, VOFFSET(vop_putpages), &a)); +} + +int vop_size_vp_offsets[] = { + VOPARG_OFFSETOF(struct vop_size_args,a_vp), + VDESC_NO_OFFSET +}; +struct vnodeop_desc vop_size_desc = { + 0, + "vop_size", + 0, + vop_size_vp_offsets, + VDESC_NO_OFFSET, + VDESC_NO_OFFSET, + VDESC_NO_OFFSET, + VDESC_NO_OFFSET, + NULL, +}; + +int VOP_SIZE(vp, size, eobp) + struct vnode *vp; + off_t size; + off_t *eobp; +{ + struct vop_size_args a; + a.a_desc = VDESC(vop_size); + a.a_vp = vp; + a.a_size = size; + a.a_eobp = eobp; + return (VCALL(vp, VOFFSET(vop_size), &a)); +} + /* Special cases: */ int vop_strategy_vp_offsets[] = { @@ -1323,6 +1457,10 @@ struct vnodeop_desc *vfs_op_descs[] = { &vop_advlock_desc, &vop_reallocblks_desc, &vop_whiteout_desc, + &vop_ballocn_desc, + &vop_getpages_desc, + &vop_putpages_desc, + &vop_size_desc, NULL }; diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index fdf8e6e4015..1af0f56e276 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -1,4 +1,4 @@ -# $OpenBSD: vnode_if.src,v 1.13 2001/07/26 20:24:47 millert Exp $ +# $OpenBSD: vnode_if.src,v 1.14 2001/11/27 05:27:12 art Exp $ # $NetBSD: vnode_if.src,v 1.10 1996/05/11 18:26:27 mycroft Exp $ # # Copyright (c) 1992, 1993 @@ -467,3 +467,48 @@ vop_whiteout { #vop_bwrite { # IN struct buf *bp; #}; + +# +#% ballocn vp L L L +# +vop_ballocn { + IN struct vnode *vp; + IN off_t offset; + IN off_t length; + IN struct ucred *cred; + IN int flags; +}; + +# +#% getpages vp L L L +# +vop_getpages { + IN struct vnode *vp; + IN voff_t offset; + IN vm_page_t *m; + IN int *count; + IN int centeridx; + IN vm_prot_t access_type; + IN int advice; + IN int flags; +}; + +# +#% putpages vp L L L +# +vop_putpages { + IN struct vnode *vp; + IN vm_page_t *m; + IN int count; + IN int flags; + IN int *rtvals; +}; + +# +#% size vp = = = +# +vop_size { + IN struct vnode *vp; + IN off_t size; + OUT off_t *eobp; +}; |