Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs More locked_queue_* and lfs_avail accounting fix...



details:   https://anonhg.NetBSD.org/src/rev/a214fc5d5dcf
branches:  trunk
changeset: 499471:a214fc5d5dcf
user:      perseant <perseant%NetBSD.org@localhost>
date:      Tue Nov 21 00:00:31 2000 +0000

description:
More locked_queue_* and lfs_avail accounting fixes from Jesse Off
<joff%gci-net.com@localhost>.  Remove a specious btodb() in lfs_fragextend, and
count blocks shrunk or removed by VOP_TRUNCATE in lfs_avail.

diffstat:

 sys/ufs/lfs/lfs_balloc.c |   4 ++--
 sys/ufs/lfs/lfs_inode.c  |  17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diffs (84 lines):

diff -r a5c22f519242 -r a214fc5d5dcf sys/ufs/lfs/lfs_balloc.c
--- a/sys/ufs/lfs/lfs_balloc.c  Mon Nov 20 21:18:07 2000 +0000
+++ b/sys/ufs/lfs/lfs_balloc.c  Tue Nov 21 00:00:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_balloc.c,v 1.26 2000/11/17 19:14:41 perseant Exp $ */
+/*     $NetBSD: lfs_balloc.c,v 1.27 2000/11/21 00:00:31 perseant Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -413,7 +413,7 @@
 
        /* Adjust locked-list accounting */
        if (((*bpp)->b_flags & (B_LOCKED | B_CALL)) == B_LOCKED)
-               locked_queue_bytes += btodb((*bpp)->b_bufsize - obufsize);
+               locked_queue_bytes += (*bpp)->b_bufsize - obufsize;
 
        bzero((char *)((*bpp)->b_data) + osize, (u_int)(nsize - osize));
 
diff -r a5c22f519242 -r a214fc5d5dcf sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Mon Nov 20 21:18:07 2000 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Tue Nov 21 00:00:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.46 2000/11/17 19:14:41 perseant Exp $  */
+/*     $NetBSD: lfs_inode.c,v 1.47 2000/11/21 00:00:31 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -229,6 +229,7 @@
        off_t osize;
        long lastseg;
        size_t bc;
+       int obufsize, odb;
 
        if (length < 0)
                return (EINVAL);
@@ -332,6 +333,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);
@@ -339,6 +342,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);
@@ -644,6 +652,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);
        }
@@ -689,6 +702,7 @@
                if (bp->b_flags & B_DELWRI) {
                        bp->b_flags &= ~B_DELWRI;
                        fs->lfs_avail += btodb(bp->b_bcount);
+                       wakeup(&fs->lfs_avail);
                }
                LFS_UNLOCK_BUF(bp);
                brelse(bp);
@@ -712,6 +726,7 @@
                if (bp->b_flags & B_DELWRI) {
                        bp->b_flags &= ~B_DELWRI;
                        fs->lfs_avail += btodb(bp->b_bcount);
+                       wakeup(&fs->lfs_avail);
                }
                LFS_UNLOCK_BUF(bp);
                brelse(bp);



Home | Main Index | Thread Index | Old Index