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
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)lfs_extern.h 7.7 (Berkeley) %G%
+ * @(#)lfs_extern.h 7.8 (Berkeley) %G%
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 *));
*
* %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>
+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.
*
* %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>
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);
-}
*
* %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>
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 vnode *vp;
struct buf *bp;
struct partinfo dpart;
struct vnode *vp;
struct buf *bp;
struct partinfo dpart;
dev_t dev;
int error, i, ronly, size;
dev_t dev;
int error, i, ronly, size;
/* 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;
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))
- ip = VTOI(vp);
- VREF(ip->i_devvp);
-
- /* The ifile inode is stored in the superblock. */
- /* 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);
#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;
* Get file system statistics.
*/
lfs_statfs(mp, sbp, p)
* Get file system statistics.
*/
lfs_statfs(mp, sbp, p)