Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Make sure that the wakeup occurs for vnodes that...



details:   https://anonhg.NetBSD.org/src/rev/b9ea3c403c3a
branches:  trunk
changeset: 471805:b9ea3c403c3a
user:      perseant <perseant%NetBSD.org@localhost>
date:      Mon Apr 12 00:25:13 1999 +0000

description:
Make sure that the wakeup occurs for vnodes that lfs_update might be sleeping
on (nodes which are not marked IN_MODIFIED/IN_CLEANING, but which have dirty
buffers), by marking them with the appropriate flag if dirtybuffers were added
while the write was in progress.

diffstat:

 sys/ufs/lfs/lfs_inode.c   |   5 ++++-
 sys/ufs/lfs/lfs_segment.c |  31 +++++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 3 deletions(-)

diffs (73 lines):

diff -r 1daa55087ca1 -r b9ea3c403c3a sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Mon Apr 12 00:24:17 1999 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Mon Apr 12 00:25:13 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.22 1999/04/01 23:28:09 perseant Exp $  */
+/*     $NetBSD: lfs_inode.c,v 1.23 1999/04/12 00:25:13 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -141,6 +141,9 @@
         * for our inode completes, if we are called with LFS_SYNC set.
         */
        while((ap->a_waitfor & LFS_SYNC) && WRITEINPROG(vp)) {
+#ifdef DEBUG_LFS
+               printf("lfs_update: sleeping on inode %d\n",ip->i_number);
+#endif
                tsleep(vp, (PRIBIO+1), "lfs_update", 0);
        }
        mod = ip->i_flag & IN_MODIFIED;
diff -r 1daa55087ca1 -r b9ea3c403c3a sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Mon Apr 12 00:24:17 1999 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Mon Apr 12 00:25:13 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.25 1999/04/12 00:11:01 perseant Exp $        */
+/*     $NetBSD: lfs_segment.c,v 1.26 1999/04/12 00:25:13 perseant Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -1077,6 +1077,7 @@
        struct vnode *devvp;
        char *p;
        struct vnode *vn;
+       struct inode *ip;
 #if defined(DEBUG) && defined(LFS_PROPELLER)
        static int propeller;
        char propstring[4] = "-\\|/";
@@ -1258,9 +1259,35 @@
                                bp->b_flags &= ~B_NEEDCOMMIT;
                                wakeup(bp);
                        }
+
+                       bpp++;
+
+                       /*
+                        * If this is the last block for this vnode, but
+                        * there are other blocks on its dirty list,
+                        * set IN_MODIFIED/IN_CLEANING depending on what
+                        * sort of block.  Only do this for our mount point,
+                        * not for, e.g., inode blocks that are attached to
+                        * the devvp.
+                        */
+                       if(i>1 && vn && *bpp && (*bpp)->b_vp != vn
+                          && (*bpp)->b_vp && (bp=vn->v_dirtyblkhd.lh_first)!=NULL &&
+                          vn->v_mount == fs->lfs_ivnode->v_mount)
+                       {
+                               ip = VTOI(vn);
+#ifdef DEBUG_LFS
+                               printf("lfs_writeseg: marking ino %d\n",ip->i_number);
+#endif
+                               if(!(ip->i_flag & (IN_CLEANING|IN_MODIFIED))) {
+                                       fs->lfs_uinodes++;
+                                       if(bp->b_flags & B_CALL)
+                                               ip->i_flag |= IN_CLEANING;
+                                       else
+                                               ip->i_flag |= IN_MODIFIED;
+                               }
+                       }
                        /* if(vn->v_dirtyblkhd.lh_first == NULL) */
                                wakeup(vn);
-                       bpp++;
                }
                ++cbp->b_vp->v_numoutput;
                splx(s);



Home | Main Index | Thread Index | Old Index