Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/ufs/lfs Pull up revisions 1.46-1.47 (via patch, req...



details:   https://anonhg.NetBSD.org/src/rev/e20c9e92a29d
branches:  netbsd-1-5
changeset: 490964:e20c9e92a29d
user:      he <he%NetBSD.org@localhost>
date:      Fri Mar 23 05:26:39 2001 +0000

description:
Pull up revisions 1.46-1.47 (via patch, requested by perseant):
  o Close up accounting holes in LFS' accounting of immediately-
    available-space, number of clean segments, and amount of dirty
    space taken up by metadata (PR#11468, PR#11470, PR#11534).
This one got left out when the rest was pulled up.  Sorry.

diffstat:

 sys/ufs/lfs/lfs_inode.c |  29 ++++++++++++++++++-----------
 1 files changed, 18 insertions(+), 11 deletions(-)

diffs (80 lines):

diff -r f7ad560509d0 -r e20c9e92a29d sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Thu Mar 22 03:58:31 2001 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Fri Mar 23 05:26:39 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.37.2.2 2000/11/01 03:56:53 tv Exp $    */
+/*     $NetBSD: lfs_inode.c,v 1.37.2.3 2001/03/23 05:26:39 he Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -231,6 +231,7 @@
        off_t osize;
        long lastseg;
        size_t bc;
+       int obufsize, odb;
 
        if (length < 0)
                return (EINVAL);
@@ -334,6 +335,8 @@
                        lfs_reserve(fs, ovp, -fsbtodb(fs, 2 * NIADDR + 3));
                        return (error);
                }
+               obufsize = bp->b_bufsize;
+               odb = btodb(bp->b_bcount);
                oip->i_ffs_size = length;
                size = blksize(fs, oip, lbn);
                (void) uvm_vnp_uncache(ovp);
@@ -341,6 +344,11 @@
                        memset((char *)bp->b_data + offset, 0,
                               (u_int)(size - offset));
                allocbuf(bp, size);
+               if (bp->b_flags & B_DELWRI) {
+                       if ((bp->b_flags & (B_LOCKED | B_CALL)) == B_LOCKED)
+                               locked_queue_bytes -= obufsize - bp->b_bufsize;
+                       fs->lfs_avail += odb - btodb(size);
+               }
                (void) VOP_BWRITE(bp);
        }
        uvm_vnp_setsize(ovp, length);
@@ -646,6 +654,11 @@
        if (copy != NULL) {
                FREE(copy, M_TEMP);
        } else {
+               if (bp->b_flags & B_DELWRI) {
+                       LFS_UNLOCK_BUF(bp);
+                       fs->lfs_avail += btodb(bp->b_bcount);
+                       wakeup(&fs->lfs_avail);
+               }
                bp->b_flags |= B_INVAL;
                brelse(bp);
        }
@@ -691,12 +704,9 @@
                if (bp->b_flags & B_DELWRI) {
                        bp->b_flags &= ~B_DELWRI;
                        fs->lfs_avail += btodb(bp->b_bcount);
+                       wakeup(&fs->lfs_avail);
                }
-               if (bp->b_flags & B_LOCKED) {
-                       bp->b_flags &= ~B_LOCKED;
-                       --locked_queue_count;
-                       locked_queue_bytes -= bp->b_bcount;
-               }
+               LFS_UNLOCK_BUF(bp);
                brelse(bp);
        }
 
@@ -718,12 +728,9 @@
                if (bp->b_flags & B_DELWRI) {
                        bp->b_flags &= ~B_DELWRI;
                        fs->lfs_avail += btodb(bp->b_bcount);
+                       wakeup(&fs->lfs_avail);
                }
-               if (bp->b_flags & B_LOCKED) {
-                       bp->b_flags &= ~B_LOCKED;
-                       --locked_queue_count;
-                       locked_queue_bytes -= bp->b_bcount;
-               }
+               LFS_UNLOCK_BUF(bp);
                brelse(bp);
        }
 



Home | Main Index | Thread Index | Old Index