+ ip->i_lockf = 0;
+ ip->i_diroff = 0;
+ ip->i_mode = 0;
+ ip->i_size = 0;
+ ip->i_blocks = 0;
+ ++ump->um_lfs->lfs_uinodes;
+ return (0);
+}
+
+/* Free an inode. */
+/* ARGUSED */
+int
+lfs_vfree(ap)
+ struct vop_vfree_args /* {
+ struct vnode *a_pvp;
+ ino_t a_ino;
+ int a_mode;
+ } */ *ap;
+{
+ SEGUSE *sup;
+ struct buf *bp;
+ struct ifile *ifp;
+ struct inode *ip;
+ struct lfs *fs;
+ daddr_t old_iaddr;
+ ino_t ino;
+ int error;
+
+ /* Get the inode number and file system. */
+ ip = VTOI(ap->a_pvp);
+ fs = ip->i_lfs;
+ ino = ip->i_number;
+ if (ip->i_flag & IMOD) {
+ --fs->lfs_uinodes;
+ ip->i_flag &= ~(IMOD | IACC | IUPD | ICHG);
+ }
+ /*
+ * Set the ifile's inode entry to unused, increment its version number
+ * and link it into the free chain.
+ */
+ LFS_IENTRY(ifp, fs, ino, bp);
+ old_iaddr = ifp->if_daddr;
+ ifp->if_daddr = LFS_UNUSED_DADDR;
+ ++ifp->if_version;
+ ifp->if_nextfree = fs->lfs_free;
+ fs->lfs_free = ino;
+ (void) VOP_BWRITE(bp);
+
+ if (old_iaddr != LFS_UNUSED_DADDR) {
+ LFS_SEGENTRY(sup, fs, datosn(fs, old_iaddr), bp);
+#ifdef DIAGNOSTIC
+ if (sup->su_nbytes < sizeof(struct dinode))
+ panic("lfs_vfree: negative byte count (segment %d)\n",
+ datosn(fs, old_iaddr));
+#endif
+ sup->su_nbytes -= sizeof(struct dinode);
+ (void) VOP_BWRITE(bp);
+ }
+
+ /* Set superblock modified bit and decrement file count. */
+ fs->lfs_fmod = 1;
+ --fs->lfs_nfiles;