Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Fix block counting during file truncation, if no...



details:   https://anonhg.NetBSD.org/src/rev/5c37224b471b
branches:  trunk
changeset: 471807:5c37224b471b
user:      perseant <perseant%NetBSD.org@localhost>
date:      Mon Apr 12 00:30:08 1999 +0000

description:
Fix block counting during file truncation, if not truncating to zero.

diffstat:

 sys/ufs/lfs/lfs_inode.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (22 lines):

diff -r 9fdc07aaaa2e -r 5c37224b471b sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Mon Apr 12 00:29:51 1999 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Mon Apr 12 00:30:08 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.23 1999/04/12 00:25:13 perseant Exp $  */
+/*     $NetBSD: lfs_inode.c,v 1.24 1999/04/12 00:30:08 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -408,6 +408,12 @@
        a_released = 0;
        i_released = 0;
        for (bp = vp->v_dirtyblkhd.lh_first; bp; bp = bp->b_vnbufs.le_next) {
+
+               /* XXX KS - Don't miscount if we're not truncating to zero. */
+               if(length>0 && !(bp->b_lblkno >= 0 && bp->b_lblkno > lastblock)
+                  && !(bp->b_lblkno < 0 && bp->b_lblkno < -lastblock-NIADDR))
+                       continue;
+
                if (bp->b_flags & B_LOCKED) {
                        a_released += numfrags(fs, bp->b_bcount);
                        /*



Home | Main Index | Thread Index | Old Index