Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Initial integration of the Unified Buffer Cache project.



details:   https://anonhg.NetBSD.org/src/rev/4ed5325b32f2
branches:  trunk
changeset: 499698:4ed5325b32f2
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Nov 27 08:39:39 2000 +0000

description:
Initial integration of the Unified Buffer Cache project.

diffstat:

 sys/adosfs/advnops.c              |    31 +-
 sys/arch/atari/dev/md_root.c      |     3 +-
 sys/coda/coda_subr.c              |    12 +-
 sys/coda/coda_vnops.c             |    10 +-
 sys/conf/files                    |     3 +-
 sys/dev/vnd.c                     |    24 +-
 sys/filecorefs/filecore_vfsops.c  |     5 +-
 sys/filecorefs/filecore_vnops.c   |    30 +-
 sys/isofs/cd9660/cd9660_vfsops.c  |     4 +-
 sys/isofs/cd9660/cd9660_vnops.c   |    32 +-
 sys/kern/exec_subr.c              |     3 +-
 sys/kern/init_main.c              |     8 +-
 sys/kern/kern_exec.c              |     3 +-
 sys/kern/kern_physio.c            |     5 +-
 sys/kern/vfs_bio.c                |    89 +-
 sys/kern/vfs_subr.c               |   134 ++-
 sys/kern/vfs_syscalls.c           |    11 +-
 sys/kern/vfs_vnops.c              |    15 +-
 sys/kern/vnode_if.src             |    47 +-
 sys/miscfs/genfs/genfs.h          |     5 +-
 sys/miscfs/genfs/genfs_vnops.c    |   661 +++++++++++++++-
 sys/miscfs/genfs/layer_subr.c     |     3 +-
 sys/miscfs/procfs/procfs_subr.c   |     3 +-
 sys/miscfs/syncfs/sync_subr.c     |    33 +-
 sys/msdosfs/msdosfs_denode.c      |     5 +-
 sys/msdosfs/msdosfs_fat.c         |    51 +-
 sys/msdosfs/msdosfs_vfsops.c      |     5 +-
 sys/msdosfs/msdosfs_vnops.c       |   188 +--
 sys/nfs/nfs.h                     |    18 +-
 sys/nfs/nfs_bio.c                 |  1056 ++++++++++++++++---------
 sys/nfs/nfs_node.c                |    33 +-
 sys/nfs/nfs_serv.c                |    12 +-
 sys/nfs/nfs_subs.c                |    88 +-
 sys/nfs/nfs_syscalls.c            |     7 +-
 sys/nfs/nfs_var.h                 |    26 +-
 sys/nfs/nfs_vfsops.c              |     4 +-
 sys/nfs/nfs_vnops.c               |   171 +---
 sys/nfs/nfsnode.h                 |     8 +-
 sys/sys/buf.h                     |    15 +-
 sys/sys/mount.h                   |     4 +-
 sys/sys/param.h                   |    13 +-
 sys/sys/vnode.h                   |    22 +-
 sys/ufs/ext2fs/ext2fs_balloc.c    |   268 +++++-
 sys/ufs/ext2fs/ext2fs_extern.h    |     5 +-
 sys/ufs/ext2fs/ext2fs_inode.c     |    67 +-
 sys/ufs/ext2fs/ext2fs_readwrite.c |   107 ++-
 sys/ufs/ext2fs/ext2fs_vfsops.c    |     7 +-
 sys/ufs/ext2fs/ext2fs_vnops.c     |    15 +-
 sys/ufs/ffs/ffs_alloc.c           |   100 +-
 sys/ufs/ffs/ffs_balloc.c          |   221 ++++-
 sys/ufs/ffs/ffs_extern.h          |     6 +-
 sys/ufs/ffs/ffs_inode.c           |   130 +-
 sys/ufs/ffs/ffs_softdep.c         |   347 ++++++++-
 sys/ufs/ffs/ffs_vfsops.c          |     9 +-
 sys/ufs/ffs/ffs_vnops.c           |   102 +-
 sys/ufs/lfs/lfs_alloc.c           |     3 +-
 sys/ufs/lfs/lfs_inode.c           |     4 +-
 sys/ufs/lfs/lfs_segment.c         |     8 +-
 sys/ufs/mfs/mfs_vnops.c           |     4 +-
 sys/ufs/ufs/ufs_bmap.c            |    20 +-
 sys/ufs/ufs/ufs_extern.h          |     3 +-
 sys/ufs/ufs/ufs_inode.c           |   146 +++-
 sys/ufs/ufs/ufs_readwrite.c       |   139 ++-
 sys/ufs/ufs/ufs_vnops.c           |     5 +-
 sys/ufs/ufs/ufsmount.h            |     3 +-
 sys/uvm/uvm.h                     |    13 +-
 sys/uvm/uvm_bio.c                 |   549 +++++++++++++
 sys/uvm/uvm_extern.h              |    44 +-
 sys/uvm/uvm_fault.c               |   181 +--
 sys/uvm/uvm_map.c                 |    18 +-
 sys/uvm/uvm_map_i.h               |    26 +-
 sys/uvm/uvm_mmap.c                |    58 +-
 sys/uvm/uvm_page.c                |   154 ++-
 sys/uvm/uvm_page.h                |    74 +-
 sys/uvm/uvm_pager.c               |   282 +++++-
 sys/uvm/uvm_pager.h               |    33 +-
 sys/uvm/uvm_pdaemon.c             |   470 +++++-----
 sys/uvm/uvm_swap.c                |   267 +-----
 sys/uvm/uvm_vnode.c               |  1548 +++++++-----------------------------
 sys/uvm/uvm_vnode.h               |    52 +-
 80 files changed, 4957 insertions(+), 3431 deletions(-)

diffs (truncated from 13682 to 300 lines):

diff -r 5d6a28543384 -r 4ed5325b32f2 sys/adosfs/advnops.c
--- a/sys/adosfs/advnops.c      Mon Nov 27 08:19:50 2000 +0000
+++ b/sys/adosfs/advnops.c      Mon Nov 27 08:39:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: advnops.c,v 1.54 2000/08/03 00:54:23 thorpej Exp $     */
+/*     $NetBSD: advnops.c,v 1.55 2000/11/27 08:39:39 chs Exp $ */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -143,7 +143,9 @@
        { &vop_truncate_desc, adosfs_truncate },        /* truncate */
        { &vop_update_desc, adosfs_update },            /* update */
        { &vop_bwrite_desc, adosfs_bwrite },            /* bwrite */
-       { (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
+       { &vop_getpages_desc, genfs_getpages },         /* getpages */
+       { &vop_size_desc, genfs_size },                 /* size */
+       { NULL, NULL }
 };
 
 struct vnodeopv_desc adosfs_vnodeop_opv_desc =
@@ -226,6 +228,7 @@
                int a_ioflag;
                struct ucred *a_cred;
        } */ *sp = v;
+       struct vnode *vp = sp->a_vp;
        struct adosfsmount *amp;
        struct anode *ap;
        struct uio *uio;
@@ -265,6 +268,28 @@
        /*
         * taken from ufs_read()
         */
+
+       if (vp->v_type == VREG) {
+               error = 0;
+               while (uio->uio_resid > 0) {
+                       void *win;
+                       vsize_t bytelen = min(ap->fsize - uio->uio_offset,
+                                             uio->uio_resid);
+
+                       if (bytelen == 0) {
+                               break;
+                       }
+                       win = ubc_alloc(&vp->v_uvm.u_obj, uio->uio_offset,
+                                       &bytelen, UBC_READ);
+                       error = uiomove(win, bytelen, uio);
+                       ubc_release(win, 0);
+                       if (error) {
+                               break;
+                       }
+               }
+               goto out;
+       }
+
        do {
                /*
                 * we are only supporting ADosFFS currently
@@ -326,6 +351,8 @@
                                amp->bsize - amp->dbsize, (int)n, uio);
                brelse(bp);
        } while (error == 0 && uio->uio_resid > 0 && n != 0);
+
+out:
 reterr:
 #ifdef ADOSFS_DIAGNOSTIC
        printf(" %d)", error);
diff -r 5d6a28543384 -r 4ed5325b32f2 sys/arch/atari/dev/md_root.c
--- a/sys/arch/atari/dev/md_root.c      Mon Nov 27 08:19:50 2000 +0000
+++ b/sys/arch/atari/dev/md_root.c      Mon Nov 27 08:39:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: md_root.c,v 1.14 2000/01/21 23:29:02 thorpej Exp $     */
+/*     $NetBSD: md_root.c,v 1.15 2000/11/27 08:39:40 chs Exp $ */
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -159,7 +159,6 @@
         * Initialize our buffer header:
         */
        memset(&buf, 0, sizeof(buf));
-       buf.b_rcred = buf.b_wcred = proc->p_ucred;
        buf.b_vnbufs.le_next = NOLIST;
        buf.b_flags = B_BUSY;
        buf.b_dev   = ld_dev;
diff -r 5d6a28543384 -r 4ed5325b32f2 sys/coda/coda_subr.c
--- a/sys/coda/coda_subr.c      Mon Nov 27 08:19:50 2000 +0000
+++ b/sys/coda/coda_subr.c      Mon Nov 27 08:39:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: coda_subr.c,v 1.9 2000/03/30 11:24:16 augustss Exp $   */
+/*     $NetBSD: coda_subr.c,v 1.10 2000/11/27 08:39:40 chs Exp $       */
 
 /*
  * 
@@ -227,7 +227,7 @@
 #endif
                                count++;
                                CODADEBUG(CODA_FLUSH, 
-                                        myprintf(("Live cnode fid %lx.%lx.%lx flags %d count %ld\n",
+                                        myprintf(("Live cnode fid %lx.%lx.%lx flags %d count %d\n",
                                                   (cp->c_fid).Volume,
                                                   (cp->c_fid).Vnode,
                                                   (cp->c_fid).Unique, 
@@ -277,7 +277,7 @@
        for (cp = coda_cache[hash];
             cp != NULL;
             cp = CNODE_NEXT(cp)) {  
-           myprintf(("Live cnode fid %lx.%lx.%lx count %ld\n",
+           myprintf(("Live cnode fid %lx.%lx.%lx count %d\n",
                      (cp->c_fid).Volume,(cp->c_fid).Vnode,
                      (cp->c_fid).Unique, CTOV(cp)->v_usecount));
        }
@@ -424,7 +424,7 @@
              if (CTOV(cp)->v_flag & VTEXT)
                  error = coda_vmflush(cp);
              CODADEBUG(CODA_ZAPFILE, myprintf(("zapfile: fid = (%lx.%lx.%lx), 
-                                              refcnt = %ld, error = %d\n",
+                                              refcnt = %d, error = %d\n",
                                              cp->c_fid.Volume, 
                                              cp->c_fid.Vnode, 
                                              cp->c_fid.Unique, 
@@ -452,7 +452,7 @@
              coda_nc_zapParentfid(&out->coda_zapdir.CodaFid, IS_DOWNCALL);     
              
              CODADEBUG(CODA_ZAPDIR, myprintf(("zapdir: fid = (%lx.%lx.%lx), 
-                                          refcnt = %ld\n",cp->c_fid.Volume, 
+                                          refcnt = %d\n",cp->c_fid.Volume, 
                                             cp->c_fid.Vnode, 
                                             cp->c_fid.Unique, 
                                             CTOV(cp)->v_usecount - 1)););
@@ -486,7 +486,7 @@
                  
                  error = coda_vmflush(cp);
              }
-             CODADEBUG(CODA_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %ld, error = %d\n",
+             CODADEBUG(CODA_PURGEFID, myprintf(("purgefid: fid = (%lx.%lx.%lx), refcnt = %d, error = %d\n",
                                             cp->c_fid.Volume, cp->c_fid.Vnode,
                                             cp->c_fid.Unique, 
                                            CTOV(cp)->v_usecount - 1, error)););
diff -r 5d6a28543384 -r 4ed5325b32f2 sys/coda/coda_vnops.c
--- a/sys/coda/coda_vnops.c     Mon Nov 27 08:19:50 2000 +0000
+++ b/sys/coda/coda_vnops.c     Mon Nov 27 08:39:39 2000 +0000
@@ -6,7 +6,7 @@
 rmdir
 symlink
 */
-/*     $NetBSD: coda_vnops.c,v 1.21 2000/09/19 22:00:01 fvdl Exp $     */
+/*     $NetBSD: coda_vnops.c,v 1.22 2000/11/27 08:39:40 chs Exp $      */
 
 /*
  * 
@@ -453,7 +453,7 @@
     }
 
     /* Have UFS handle the call. */
-    CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %ld\n",
+    CODADEBUG(CODA_RDWR, myprintf(("indirect rdwr: fid = (%lx.%lx.%lx), refcnt = %d\n",
                              cp->c_fid.Volume, cp->c_fid.Vnode, 
                              cp->c_fid.Unique, CTOV(cp)->v_usecount)); )
 
@@ -873,9 +873,9 @@
 
     if (IS_UNMOUNTING(cp)) {
 #ifdef DEBUG
-       printf("coda_inactive: IS_UNMOUNTING use %ld: vp %p, cp %p\n", vp->v_usecount, vp, cp);
+       printf("coda_inactive: IS_UNMOUNTING use %d: vp %p, cp %p\n", vp->v_usecount, vp, cp);
        if (cp->c_ovp != NULL)
-           printf("coda_inactive: cp->ovp != NULL use %ld: vp %p, cp %p\n",
+           printf("coda_inactive: cp->ovp != NULL use %d: vp %p, cp %p\n",
                   vp->v_usecount, vp, cp);
 #endif
        lockmgr(&vp->v_lock, LK_RELEASE, &vp->v_interlock);
@@ -1727,7 +1727,7 @@
        }
        
        /* Have UFS handle the call. */
-       CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %ld\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); )
+       CODADEBUG(CODA_READDIR, myprintf(("indirect readdir: fid = (%lx.%lx.%lx), refcnt = %d\n",cp->c_fid.Volume, cp->c_fid.Vnode, cp->c_fid.Unique, vp->v_usecount)); )
        error = VOP_READDIR(cp->c_ovp, uiop, cred, eofflag, cookies,
                               ncookies);
        if (error)
diff -r 5d6a28543384 -r 4ed5325b32f2 sys/conf/files
--- a/sys/conf/files    Mon Nov 27 08:19:50 2000 +0000
+++ b/sys/conf/files    Mon Nov 27 08:39:39 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files,v 1.404 2000/11/26 17:44:02 ad Exp $
+#      $NetBSD: files,v 1.405 2000/11/27 08:39:41 chs Exp $
 
 #      @(#)files.newconf       7.5 (Berkeley) 5/10/93
 
@@ -1060,6 +1060,7 @@
 file uvm/uvm_amap.c
 file uvm/uvm_anon.c
 file uvm/uvm_aobj.c
+file uvm/uvm_bio.c
 file uvm/uvm_device.c
 file uvm/uvm_fault.c
 file uvm/uvm_glue.c
diff -r 5d6a28543384 -r 4ed5325b32f2 sys/dev/vnd.c
--- a/sys/dev/vnd.c     Mon Nov 27 08:19:50 2000 +0000
+++ b/sys/dev/vnd.c     Mon Nov 27 08:39:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.68 2000/09/12 08:03:24 enami Exp $   */
+/*     $NetBSD: vnd.c,v 1.69 2000/11/27 08:39:41 chs Exp $     */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -445,29 +445,7 @@
                nbp->vb_buf.b_proc = bp->b_proc;
                nbp->vb_buf.b_iodone = vndiodone;
                nbp->vb_buf.b_vp = NULLVP;
-               nbp->vb_buf.b_rcred = vnd->sc_cred;     /* XXX crdup? */
-               nbp->vb_buf.b_wcred = vnd->sc_cred;     /* XXX crdup? */
                LIST_INIT(&nbp->vb_buf.b_dep);
-               if (bp->b_dirtyend == 0) {
-                       nbp->vb_buf.b_dirtyoff = 0;
-                       nbp->vb_buf.b_dirtyend = sz;
-               } else {
-                       nbp->vb_buf.b_dirtyoff =
-                           max(0, bp->b_dirtyoff - (bp->b_bcount - resid));
-                       nbp->vb_buf.b_dirtyend =
-                           min(sz,
-                               max(0, bp->b_dirtyend - (bp->b_bcount-resid)));
-               }
-               if (bp->b_validend == 0) {
-                       nbp->vb_buf.b_validoff = 0;
-                       nbp->vb_buf.b_validend = sz;
-               } else {
-                       nbp->vb_buf.b_validoff =
-                           max(0, bp->b_validoff - (bp->b_bcount - resid));
-                       nbp->vb_buf.b_validend =
-                           min(sz,
-                               max(0, bp->b_validend - (bp->b_bcount-resid)));
-               }
 
                nbp->vb_xfer = vnx;
 
diff -r 5d6a28543384 -r 4ed5325b32f2 sys/filecorefs/filecore_vfsops.c
--- a/sys/filecorefs/filecore_vfsops.c  Mon Nov 27 08:19:50 2000 +0000
+++ b/sys/filecorefs/filecore_vfsops.c  Mon Nov 27 08:39:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_vfsops.c,v 1.11 2000/03/16 18:08:22 jdolecek Exp $    */
+/*     $NetBSD: filecore_vfsops.c,v 1.12 2000/11/27 08:39:41 chs Exp $ */
 
 /*-
  * Copyright (c) 1998 Andrew McMurry
@@ -324,6 +324,9 @@
        mp->mnt_stat.f_fsid.val[1] = makefstype(MOUNT_FILECORE);
        mp->mnt_maxsymlinklen = 0;
        mp->mnt_flag |= MNT_LOCAL;
+       mp->mnt_dev_bshift = fcdr->log2secsize;
+       mp->mnt_fs_bshift = fcmp->log2bsize;
+
        fcmp->fc_mountp = mp;
        fcmp->fc_dev = dev;
        fcmp->fc_devvp = devvp;
diff -r 5d6a28543384 -r 4ed5325b32f2 sys/filecorefs/filecore_vnops.c
--- a/sys/filecorefs/filecore_vnops.c   Mon Nov 27 08:19:50 2000 +0000
+++ b/sys/filecorefs/filecore_vnops.c   Mon Nov 27 08:39:39 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_vnops.c,v 1.9 2000/08/03 03:38:39 thorpej Exp $       */
+/*     $NetBSD: filecore_vnops.c,v 1.10 2000/11/27 08:39:42 chs Exp $  */
 
 /*-
  * Copyright (c) 1998 Andrew McMurry
@@ -162,6 +162,28 @@
                return (EINVAL);
        ip->i_flag |= IN_ACCESS;
        fcmp = ip->i_mnt;
+
+       if (vp->v_type == VREG) {
+               error = 0;
+               while (uio->uio_resid > 0) {
+                       void *win;
+                       vsize_t bytelen = min(ip->i_size - uio->uio_offset,
+                                             uio->uio_resid);
+
+                       if (bytelen == 0) {
+                               break;
+                       }
+                       win = ubc_alloc(&vp->v_uvm.u_obj, uio->uio_offset,
+                                       &bytelen, UBC_READ);
+                       error = uiomove(win, bytelen, uio);
+                       ubc_release(win, 0);
+                       if (error) {
+                               break;
+                       }
+               }
+               goto out;
+       }
+
        do {
                lbn = lblkno(fcmp, uio->uio_offset);
                on = blkoff(fcmp, uio->uio_offset);
@@ -213,6 +235,8 @@
 #endif
                brelse(bp);
        } while (error == 0 && uio->uio_resid > 0 && n != 0);
+
+out:
        return (error);
 }



Home | Main Index | Thread Index | Old Index