changes to make lfs_vget retrieve the IFILE inode like any other
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sun, 19 Jan 1992 05:28:55 +0000 (21:28 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Sun, 19 Jan 1992 05:28:55 +0000 (21:28 -0800)
inode

SCCS-vsn: sys/ufs/lfs/lfs_subr.c 7.8
SCCS-vsn: sys/ufs/lfs/lfs_vfsops.c 7.72
SCCS-vsn: sys/ufs/lfs/lfs_inode.c 7.52
SCCS-vsn: sys/ufs/lfs/lfs_extern.h 7.8

usr/src/sys/ufs/lfs/lfs_extern.h
usr/src/sys/ufs/lfs/lfs_inode.c
usr/src/sys/ufs/lfs/lfs_subr.c
usr/src/sys/ufs/lfs/lfs_vfsops.c

index 2290aee..ee8d033 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_extern.h        7.7 (Berkeley) %G%
+ *     @(#)lfs_extern.h        7.8 (Berkeley) %G%
  */
 
 struct fid;
  */
 
 struct fid;
@@ -28,7 +28,6 @@ int    lfs_fsync
 DINODE *lfs_ifind __P((struct lfs *, ino_t, void *));
 int     lfs_inactive __P((VNODE *, struct proc *));
 int     lfs_init __P((void));
 DINODE *lfs_ifind __P((struct lfs *, ino_t, void *));
 int     lfs_inactive __P((VNODE *, struct proc *));
 int     lfs_init __P((void));
-daddr_t         lfs_itod __P((struct lfs *, ino_t));
 int     lfs_makeinode __P((int, struct nameidata *, struct inode **));
 int     lfs_mount
             __P((MOUNT *, char *, caddr_t, struct nameidata *, struct proc *));
 int     lfs_makeinode __P((int, struct nameidata *, struct inode **));
 int     lfs_mount
             __P((MOUNT *, char *, caddr_t, struct nameidata *, struct proc *));
index e4329b0..d93f316 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_inode.c 7.51 (Berkeley) %G%
+ *     @(#)lfs_inode.c 7.52 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -34,6 +34,25 @@ lfs_init()
        return (ufs_init());
 }
 
        return (ufs_init());
 }
 
+static daddr_t
+lfs_itod(fs, ino)
+       struct lfs *fs;
+       ino_t ino;
+{
+       BUF *bp;
+       IFILE *ifp;
+       daddr_t iaddr;
+
+       /* Translate an inode number to a disk address. */
+       if (ino == LFS_IFILE_INUM)
+               return (fs->lfs_idaddr);
+
+       LFS_IENTRY(ifp, fs, ino, bp);
+       iaddr = ifp->if_daddr;
+       brelse(bp);
+       return (iaddr);
+}
+
 /*
  * Look up an LFS dinode number to find its incore vnode.  If not already
  * in core, read it in from the specified device.  Return the inode locked.
 /*
  * Look up an LFS dinode number to find its incore vnode.  If not already
  * in core, read it in from the specified device.  Return the inode locked.
index 1aef5cf..8b92329 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_subr.c  7.7 (Berkeley) %G%
+ *     @(#)lfs_subr.c  7.8 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -73,22 +73,3 @@ lfs_ifind(fs, ino, page)
        panic("lfs_ifind: dinode %u not found", ino);
        /* NOTREACHED */
 }
        panic("lfs_ifind: dinode %u not found", ino);
        /* NOTREACHED */
 }
-
-daddr_t
-lfs_itod(fs, ino)
-       struct lfs *fs;
-       ino_t ino;
-{
-       BUF *bp;
-       IFILE *ifp;
-       daddr_t iaddr;
-
-#ifdef VERBOSE
-       printf("lfs_itod %d\n", ino);
-#endif
-       /* Translate an inode number to a disk address. */
-       LFS_IENTRY(ifp, fs, ino, bp);
-       iaddr = ifp->if_daddr;
-       brelse(bp);
-       return (iaddr);
-}
index 50895d5..3f11e88 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)lfs_vfsops.c        7.71 (Berkeley) %G%
+ *     @(#)lfs_vfsops.c        7.72 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -178,11 +178,9 @@ lfs_mountfs(devvp, mp, p)
        extern struct vnode *rootvp;
        register struct lfs *fs;
        register struct ufsmount *ump;
        extern struct vnode *rootvp;
        register struct lfs *fs;
        register struct ufsmount *ump;
-       struct inode *ip;
        struct vnode *vp;
        struct buf *bp;
        struct partinfo dpart;
        struct vnode *vp;
        struct buf *bp;
        struct partinfo dpart;
-       daddr_t seg_addr;
        dev_t dev;
        int error, i, ronly, size;
 
        dev_t dev;
        int error, i, ronly, size;
 
@@ -226,7 +224,6 @@ lfs_mountfs(devvp, mp, p)
 
        /* Set up the I/O information */
        fs->lfs_iocount = 0;
 
        /* Set up the I/O information */
        fs->lfs_iocount = 0;
-       /* XXX NOTUSED: fs->lfs_seglist = NULL; */
 
        /* Set the file system readonly/modify bits. */
        fs = ump->um_lfs;
 
        /* Set the file system readonly/modify bits. */
        fs = ump->um_lfs;
@@ -245,27 +242,20 @@ lfs_mountfs(devvp, mp, p)
        ump->um_devvp = devvp;
        for (i = 0; i < MAXQUOTAS; i++)
                ump->um_quotas[i] = NULLVP;
        ump->um_devvp = devvp;
        for (i = 0; i < MAXQUOTAS; i++)
                ump->um_quotas[i] = NULLVP;
+       devvp->v_specflags |= SI_MOUNTEDON;
 
 
-       /* Read the ifile disk inode and store it in a vnode. */
-       if (error = bread(devvp, fs->lfs_idaddr, fs->lfs_bsize, NOCRED, &bp))
-               goto out;
-       if (error = lfs_vcreate(mp, LFS_IFILE_INUM, &vp))
+       /*
+        * We use the ifile vnode for almost every operation.  Instead of
+        * retrieving it from the hash table each time we retrieve it here,
+        * artificially increment the reference count and keep a pointer
+        * to it in the incore copy of the superblock.
+        */
+       if (error = lfs_vget(mp, LFS_IFILE_INUM, &vp))
                goto out;
                goto out;
-       ip = VTOI(vp);
-       VREF(ip->i_devvp);
-
-       /* The ifile inode is stored in the superblock. */
        fs->lfs_ivnode = vp;
        fs->lfs_ivnode = vp;
+       VREF(vp);
+       vput(vp);
 
 
-       /* Copy the on-disk inode into place. */
-       ip->i_din = *lfs_ifind(fs, LFS_IFILE_INUM, bp->b_un.b_dino);
-       brelse(bp);
-
-       /* Initialize the associated vnode */
-       vp->v_type = IFTOVT(ip->i_mode);
-
-       devvp->v_specflags |= SI_MOUNTEDON;
-       VREF(ip->i_devvp);
 
        return (0);
 out:
 
        return (0);
 out:
@@ -329,13 +319,9 @@ return(0);
 #endif
        if (error = vflush(mp, NULLVP, flags))
                return (error);
 #endif
        if (error = vflush(mp, NULLVP, flags))
                return (error);
-#ifdef NOTLFS                                                  /* LFS */
-       fs = ump->um_fs;
-       ronly = !fs->fs_ronly;
-#else
        fs = ump->um_lfs;
        ronly = !fs->lfs_ronly;
        fs = ump->um_lfs;
        ronly = !fs->lfs_ronly;
-#endif
+       vrele(fs->lfs_ivnode);
  * Get file system statistics.
  */
 lfs_statfs(mp, sbp, p)
  * Get file system statistics.
  */
 lfs_statfs(mp, sbp, p)