Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/kern Pull up revision 1.76 (requested by chs):



details:   https://anonhg.NetBSD.org/src/rev/1de234d496cd
branches:  netbsd-1-5
changeset: 491048:1de234d496cd
user:      he <he%NetBSD.org@localhost>
date:      Sun Apr 01 17:06:00 2001 +0000

description:
Pull up revision 1.76 (requested by chs):
  In bwrite(), when deciding whether to convert sync writes into delayed
  writes, examine the correct block device.  Fixes PR#12484.

diffstat:

 sys/kern/vfs_bio.c |  29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diffs (58 lines):

diff -r 455f0b4a5a75 -r 1de234d496cd sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c        Sun Apr 01 17:01:28 2001 +0000
+++ b/sys/kern/vfs_bio.c        Sun Apr 01 17:06:00 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_bio.c,v 1.67 2000/04/12 11:33:43 fvdl Exp $        */
+/*     $NetBSD: vfs_bio.c,v 1.67.4.1 2001/04/01 17:06:00 he Exp $      */
 
 /*-
  * Copyright (c) 1994 Christopher G. Demetriou
@@ -324,6 +324,16 @@
        struct vnode *vp;
        struct mount *mp;
 
+       vp = bp->b_vp;
+       if (vp != NULL) {
+               if (vp->v_type == VBLK)
+                       mp = vp->v_specmountpoint;
+               else
+                       mp = vp->v_mount;
+       } else {
+               mp = NULL;
+       }
+
        /*
         * Remember buffer type, to switch on it later.  If the write was
         * synchronous, but the file system was mounted with MNT_ASYNC,
@@ -332,8 +342,7 @@
         * to async, not sync writes (which is safe, but ugly).
         */
        sync = !ISSET(bp->b_flags, B_ASYNC);
-       if (sync && bp->b_vp && bp->b_vp->v_mount &&
-           ISSET(bp->b_vp->v_mount->mnt_flag, MNT_ASYNC)) {
+       if (sync && mp != NULL && ISSET(mp->mnt_flag, MNT_ASYNC)) {
                bdwrite(bp);
                return (0);
        }
@@ -343,17 +352,11 @@
         * Writes to block devices are charged to their associated
         * filesystem (if any).
         */
-       if ((vp = bp->b_vp) != NULL) {
-               if (vp->v_type == VBLK)
-                       mp = vp->v_specmountpoint;
+       if (mp != NULL) {
+               if (sync)
+                       mp->mnt_stat.f_syncwrites++;
                else
-                       mp = vp->v_mount;
-               if (mp != NULL) {
-                       if (sync)
-                               mp->mnt_stat.f_syncwrites++;
-                       else
-                               mp->mnt_stat.f_asyncwrites++;
-               }
+                       mp->mnt_stat.f_asyncwrites++;
        }
 
        wasdelayed = ISSET(bp->b_flags, B_DELWRI);



Home | Main Index | Thread Index | Old Index