Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/sys/ufs/lfs Pull up revision 1.10 (requested by perseant):



details:   https://anonhg.NetBSD.org/src/rev/e71b551cd96b
branches:  netbsd-1-4
changeset: 470102:e71b551cd96b
user:      he <he%NetBSD.org@localhost>
date:      Thu Jan 20 21:11:21 2000 +0000

description:
Pull up revision 1.10 (requested by perseant):
  Files removed (through unlink, rmdir) are now really removed, though the
  removal is postponed until the dirop is complete to ensure validity of
  the filesystem through a crash.  Use a separate per-fs lock, instead of
  ufs_hashlock, to protect the inode free list.  Change calling semantics
  of lfs_ifind, to give better error reporting:  If fed a struct buf, it
  can report the block number of the offending inode block as well as the
  inode number.

diffstat:

 sys/ufs/lfs/lfs_subr.c |  42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diffs (59 lines):

diff -r a1b5f6f607d6 -r e71b551cd96b sys/ufs/lfs/lfs_subr.c
--- a/sys/ufs/lfs/lfs_subr.c    Thu Jan 20 21:10:57 2000 +0000
+++ b/sys/ufs/lfs/lfs_subr.c    Thu Jan 20 21:11:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_subr.c,v 1.9 1999/03/25 21:39:18 perseant Exp $    */
+/*     $NetBSD: lfs_subr.c,v 1.9.2.1 2000/01/20 21:11:21 he Exp $      */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -177,9 +177,49 @@
        struct segment *sp;
        unsigned long sync, ckp;
        int s;
+       struct vnode *vp;
+       struct mount *mp;
+       extern int lfs_dirvcount;
        
        if (fs->lfs_seglock == 1) {
 
+               mp = fs->lfs_ivnode->v_mount;
+               /*
+                * Go through and unmark all DIROP vnodes, possibly
+                * calling VOP_INACTIVE (through vrele).  This is
+                * delayed until now in order not to accidentally
+                * write a DIROP node through lfs_flush.
+                */
+#ifndef LFS_NO_BACKVP_HACK
+       /* BEGIN HACK */
+#define        VN_OFFSET       (((caddr_t)&vp->v_mntvnodes.le_next) - (caddr_t)vp)
+#define        BACK_VP(VP)     ((struct vnode *)(((caddr_t)VP->v_mntvnodes.le_prev) - VN_OFFSET))
+#define        BEG_OF_VLIST    ((struct vnode *)(((caddr_t)&mp->mnt_vnodelist.lh_first) - VN_OFFSET))
+       
+               /* Find last vnode. */
+       loop:   for (vp = mp->mnt_vnodelist.lh_first;
+                    vp && vp->v_mntvnodes.le_next != NULL;
+                    vp = vp->v_mntvnodes.le_next);
+               for (; vp && vp != BEG_OF_VLIST; vp = BACK_VP(vp)) {
+#else
+       loop:
+               for (vp = mp->mnt_vnodelist.lh_first;
+                    vp != NULL;
+                    vp = vp->v_mntvnodes.le_next) {
+#endif
+                       if (vp->v_mount != mp)
+                               goto loop;
+                       if (vp->v_type == VNON)
+                               continue;
+                       if(vp->v_flag & VDIROP) {
+                               /* No vref, it has one from before */
+                               --lfs_dirvcount;
+                               vp->v_flag &= ~VDIROP;
+                               wakeup(&lfs_dirvcount);
+                               vrele(vp);
+                       }
+               }
+
                sp = fs->lfs_sp;
                sync = sp->seg_flags & SEGM_SYNC;
                ckp = sp->seg_flags & SEGM_CKP;



Home | Main Index | Thread Index | Old Index