diff options
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/ufs/lfs/lfs_alloc.c | 16 | ||||
| -rw-r--r-- | sys/ufs/lfs/lfs_segment.c | 5 | ||||
| -rw-r--r-- | sys/ufs/lfs/lfs_syscalls.c | 14 | ||||
| -rw-r--r-- | sys/ufs/lfs/lfs_vfsops.c | 30 |
4 files changed, 15 insertions, 50 deletions
diff --git a/sys/ufs/lfs/lfs_alloc.c b/sys/ufs/lfs/lfs_alloc.c index 8ec93fd0a33..216041d8e33 100644 --- a/sys/ufs/lfs/lfs_alloc.c +++ b/sys/ufs/lfs/lfs_alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_alloc.c,v 1.27 1999/11/09 02:21:05 perseant Exp $ */ +/* $NetBSD: lfs_alloc.c,v 1.28 1999/11/12 16:56:48 perseant Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -152,18 +152,10 @@ lfs_valloc(v) fs->lfs_free = ifp->if_nextfree; #ifdef LFS_DEBUG_NEXTFREE ifp->if_nextfree = 0; -#endif - /* - * If a vflush is called before the dirop that created us is written, - * and then the system crashes, we could be in limbo (allocated but - * not connected), and stay that way forever. To detect this - * condition easily, we set if_daddr=UNASSIGNED, and walk the free - * list at fs mount time (or roll-forward time). Any inodes with - * if_daddr==UNASSIGNED have never been written to disk, and will - * be silently restored to the free list. - */ - ifp->if_daddr = UNASSIGNED; VOP_BWRITE(bp); +#else + brelse(bp); +#endif /* Extend IFILE so that the next lfs_valloc will succeed. */ if (fs->lfs_free == LFS_UNUSED_INUM) { diff --git a/sys/ufs/lfs/lfs_segment.c b/sys/ufs/lfs/lfs_segment.c index d2ef989f715..83352fe1428 100644 --- a/sys/ufs/lfs/lfs_segment.c +++ b/sys/ufs/lfs/lfs_segment.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_segment.c,v 1.33 1999/11/09 02:21:06 perseant Exp $ */ +/* $NetBSD: lfs_segment.c,v 1.34 1999/11/12 16:56:48 perseant Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -772,7 +772,8 @@ lfs_writeinode(fs, sp, ip) * No need to update segment usage if there was no former inode address * or if the last inode address is in the current partial segment. */ - if (daddr>0 && !(daddr >= fs->lfs_lastpseg && daddr <= bp->b_blkno)) { + if (daddr != LFS_UNUSED_DADDR && + !(daddr >= fs->lfs_lastpseg && daddr <= bp->b_blkno)) { LFS_SEGENTRY(sup, fs, datosn(fs, daddr), bp); #ifdef DIAGNOSTIC if (sup->su_nbytes < DINODE_SIZE) { diff --git a/sys/ufs/lfs/lfs_syscalls.c b/sys/ufs/lfs/lfs_syscalls.c index b15377b31b9..f929a0480f4 100644 --- a/sys/ufs/lfs/lfs_syscalls.c +++ b/sys/ufs/lfs/lfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_syscalls.c,v 1.34 1999/11/09 02:21:06 perseant Exp $ */ +/* $NetBSD: lfs_syscalls.c,v 1.35 1999/11/12 16:56:48 perseant Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -248,7 +248,7 @@ sys_lfs_markv(p, v, retval) * Finish the old file, if there was one. The presence * of a usable vnode in vp is signaled by a valid v_daddr. */ - if(v_daddr > 0) { + if(v_daddr != LFS_UNUSED_DADDR) { #ifdef DEBUG_LFS if(ip->i_flag & (IN_MODIFIED|IN_CLEANING)) iwritten++; @@ -279,7 +279,8 @@ sys_lfs_markv(p, v, retval) { continue; } - if (v_daddr <= 0 && blkp->bi_daddr != LFS_FORCE_WRITE) + if (v_daddr == LFS_UNUSED_DADDR + && blkp->bi_daddr != LFS_FORCE_WRITE) { continue; } @@ -398,14 +399,13 @@ sys_lfs_markv(p, v, retval) } splx(s); } - if (blkp->bi_lbn >= 0 && vp != fs->lfs_ivnode) { - /* True data blocks: we can use fake blocks */ + if (blkp->bi_lbn >= 0) { /* Data Block */ + /* XXX KS - should we use incore here, or just always use getblk()? */ bp = lfs_fakebuf(vp, blkp->bi_lbn, blkp->bi_size, blkp->bi_bp); /* Pretend we used bread() to get it */ bp->b_blkno = blkp->bi_daddr; - } else { - /* Metadata: indir block or ifile data */ + } else { /* Indirect block */ bp = getblk(vp, blkp->bi_lbn, blkp->bi_size, 0, 0); if (!(bp->b_flags & (B_DONE|B_DELWRI))) { /* B_CACHE */ /* diff --git a/sys/ufs/lfs/lfs_vfsops.c b/sys/ufs/lfs/lfs_vfsops.c index c433801f280..5ce4c7c348d 100644 --- a/sys/ufs/lfs/lfs_vfsops.c +++ b/sys/ufs/lfs/lfs_vfsops.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vfsops.c,v 1.42 1999/11/09 02:21:06 perseant Exp $ */ +/* $NetBSD: lfs_vfsops.c,v 1.43 1999/11/12 16:56:48 perseant Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -311,8 +311,6 @@ lfs_mount(mp, path, data, ndp, p) return (0); } -extern struct lock ufs_hashlock; - /* * Common code for mount and mountroot * LFS specific @@ -334,8 +332,6 @@ lfs_mountfs(devvp, mp, p) int error, i, ronly, size; struct ucred *cred; SEGUSE *sup; - IFILE *ifp; - ino_t ino, maxino; cred = p ? p->p_ucred : NOCRED; /* @@ -465,30 +461,6 @@ lfs_mountfs(devvp, mp, p) sup->su_flags |= SEGUSE_DIRTY | SEGUSE_ACTIVE; (void) VOP_BWRITE(bp); - /* - * Look for unreferenced inodes, that can be created if the Ifile - * is written but inodes are not, because of an intervening crash. - * We recognize these by if_daddr==UNASSIGNED. - */ - lockmgr(&ufs_hashlock, LK_EXCLUSIVE, 0); - maxino = ((VTOI(fs->lfs_ivnode)->i_ffs_size >> fs->lfs_bshift) - - fs->lfs_segtabsz - fs->lfs_cleansz) * INOPB(fs); - for(ino=LFS_FIRST_INUM; ino < maxino; ++ino) { - LFS_IENTRY(ifp, fs, ino, bp); - if(ifp->if_daddr == UNASSIGNED) { -#ifdef DEBUG - printf("lfs_mountfs: linking unref ino %d back into the free list\n", ino); -#endif - ifp->if_daddr = LFS_UNUSED_DADDR; - ++ifp->if_version; - ifp->if_nextfree = fs->lfs_free; - fs->lfs_free = ino; - (void) VOP_BWRITE(bp); - } else - brelse(bp); - } - lockmgr(&ufs_hashlock, LK_RELEASE, 0); - return (0); out: if (bp) |
