+ brelse(bp);
+
+ /* Extend IFILE so that the next lfs_valloc will succeed. */
+ if (fs->lfs_free == LFS_UNUSED_INUM) {
+ vp = fs->lfs_ivnode;
+ ip = VTOI(vp);
+ blkno = lblkno(fs, ip->i_size);
+printf("Extending ifile: blkno = %d\n", blkno);
+ bp = getblk(vp, blkno, fs->lfs_bsize);
+ if (!bp) {
+ uprintf("\n%s: no inodes left\n", fs->lfs_fsmnt);
+ log(LOG_ERR, "uid %d on %s: out of inodes\n",
+ cred->cr_uid, fs->lfs_fsmnt);
+ return (ENOSPC);
+ }
+ i = (blkno - fs->lfs_segtabsz - fs->lfs_cleansz) *
+ fs->lfs_ifpb;
+printf("Extending ifile: first inum = %d\n", i);
+ fs->lfs_free = i;
+ max = i + fs->lfs_ifpb;
+printf("Extending ifile: max inum = %d\n", max);
+ for (ifp = (struct ifile *)bp->b_un.b_words; i < max; ++ifp) {
+ ifp->if_version = 1;
+ ifp->if_daddr = LFS_UNUSED_DADDR;
+ ifp->if_nextfree = ++i;
+ }
+ ifp--;
+ ifp->if_nextfree = LFS_UNUSED_INUM;
+
+ ++ip->i_blocks; /* XXX This may not be right. */
+ ip->i_size += fs->lfs_bsize;
+printf("Extending ifile: blocks = %d size = %d\n", ip->i_blocks, ip->i_size);
+ vnode_pager_setsize(vp, ip->i_size);
+ vnode_pager_uncache(vp);
+ LFS_UBWRITE(bp);
+ }