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.11 (requested by perseant):



details:   https://anonhg.NetBSD.org/src/rev/97628a4252a1
branches:  netbsd-1-4
changeset: 469883:97628a4252a1
user:      he <he%NetBSD.org@localhost>
date:      Fri Dec 17 23:21:03 1999 +0000

description:
Pull up revision 1.11 (requested by perseant):
  Avoid flushing vnodes involved in a dirop, making lfs' promise
  of "no fsck needed, even in the event of a crash" closer to
  reality.

diffstat:

 sys/ufs/lfs/lfs_bio.c |  66 ++++++++++++++++++++++++++++----------------------
 1 files changed, 37 insertions(+), 29 deletions(-)

diffs (107 lines):

diff -r 3f4445166358 -r 97628a4252a1 sys/ufs/lfs/lfs_bio.c
--- a/sys/ufs/lfs/lfs_bio.c     Fri Dec 17 23:20:39 1999 +0000
+++ b/sys/ufs/lfs/lfs_bio.c     Fri Dec 17 23:21:03 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_bio.c,v 1.9.2.2 1999/10/26 20:27:09 he Exp $       */
+/*     $NetBSD: lfs_bio.c,v 1.9.2.3 1999/12/17 23:21:03 he Exp $       */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -267,6 +267,38 @@
        return (0);
 }
 
+void lfs_flush_fs(mp, flags)
+       struct mount *mp;
+       int flags;
+{
+       struct lfs *lfsp;
+
+       lfsp = ((struct ufsmount *)mp->mnt_data)->ufsmount_u.lfs;
+       if((mp->mnt_flag & MNT_RDONLY) == 0 &&
+          lfsp->lfs_dirops==0)
+       {
+               /* disallow dirops during flush */
+               lfsp->lfs_writer++;
+
+               /*
+                * We set the queue to 0 here because we
+                * are about to write all the dirty
+                * buffers we have.  If more come in
+                * while we're writing the segment, they
+                * may not get written, so we want the
+                * count to reflect these new writes
+                * after the segwrite completes.
+                */
+               if(lfs_dostats)
+                       ++lfs_stats.flush_invoked;
+               lfs_segwrite(mp, flags);
+
+               /* XXX KS - allow dirops again */
+               if(--lfsp->lfs_writer==0)
+                       wakeup(&lfsp->lfs_dirops);
+       }
+}
+
 /*
  * XXX
  * This routine flushes buffers out of the B_LOCKED queue when LFS has too
@@ -281,7 +313,6 @@
        int flags;
 {
        register struct mount *mp, *nmp;
-       struct lfs *lfsp;
        
        if(lfs_dostats) 
                ++lfs_stats.write_exceeded;
@@ -296,32 +327,7 @@
                        continue;
                }
                if (strncmp(&mp->mnt_stat.f_fstypename[0], MOUNT_LFS, MFSNAMELEN)==0)
-               {
-                       lfsp = ((struct ufsmount *)mp->mnt_data)->ufsmount_u.lfs;
-                       if((mp->mnt_flag & MNT_RDONLY) == 0 &&
-                          lfsp->lfs_dirops==0)
-                       {
-                               /* disallow dirops during flush */
-                               lfsp->lfs_writer++;
-
-                               /*
-                                * We set the queue to 0 here because we
-                                * are about to write all the dirty
-                                * buffers we have.  If more come in
-                                * while we're writing the segment, they
-                                * may not get written, so we want the
-                                * count to reflect these new writes
-                                * after the segwrite completes.
-                                */
-                               if(lfs_dostats)
-                                       ++lfs_stats.flush_invoked;
-                               lfs_segwrite(mp, flags);
-
-                               /* XXX KS - allow dirops again */
-                               if(--lfsp->lfs_writer==0)
-                                       wakeup(&lfsp->lfs_dirops);
-                       }
-               }
+                       lfs_flush_fs(mp, flags);
                simple_lock(&mountlist_slock);
                nmp = mp->mnt_list.cqe_next;
                vfs_unbusy(mp);
@@ -357,13 +363,15 @@
 
        if (locked_queue_count > LFS_MAX_BUFS
            || locked_queue_bytes > LFS_MAX_BYTES
-           || fs->lfs_dirvcount > LFS_MAXDIROP)
+           || fs->lfs_dirvcount > LFS_MAXDIROP
+           || fs->lfs_diropwait > 0)
        {
                ++fs->lfs_writer;
                lfs_flush(fs, flags);
                if(--fs->lfs_writer==0)
                        wakeup(&fs->lfs_dirops);
        }
+
        while  (locked_queue_count > LFS_WAIT_BUFS
                || locked_queue_bytes > LFS_WAIT_BYTES)
        {



Home | Main Index | Thread Index | Old Index