Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/lfs Get rid of some old unnecessary code that cleare...



details:   https://anonhg.NetBSD.org/src/rev/b1ea40beb836
branches:  trunk
changeset: 499987:b1ea40beb836
user:      perseant <perseant%NetBSD.org@localhost>
date:      Sun Dec 03 05:56:27 2000 +0000

description:
Get rid of some old unnecessary code that cleared B_NEEDCOMMIT from buffers in
lfs_writeseg (possibly after they had been freed).

If MALLOCLOG is defined, make lfs_newbuf and lfs_freebuf pass along the
caller's file and line to _malloc and _free.

diffstat:

 sys/ufs/lfs/lfs_alloc.c   |   2 +-
 sys/ufs/lfs/lfs_bio.c     |  32 +++++++++++++++++++++++++++-----
 sys/ufs/lfs/lfs_extern.h  |  12 ++++++++++--
 sys/ufs/lfs/lfs_inode.c   |   2 +-
 sys/ufs/lfs/lfs_segment.c |   6 +-----
 5 files changed, 40 insertions(+), 14 deletions(-)

diffs (151 lines):

diff -r 0fa065496c81 -r b1ea40beb836 sys/ufs/lfs/lfs_alloc.c
--- a/sys/ufs/lfs/lfs_alloc.c   Sun Dec 03 05:30:31 2000 +0000
+++ b/sys/ufs/lfs/lfs_alloc.c   Sun Dec 03 05:56:27 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_alloc.c,v 1.45 2000/11/27 08:39:55 chs Exp $       */
+/*     $NetBSD: lfs_alloc.c,v 1.46 2000/12/03 05:56:27 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
diff -r 0fa065496c81 -r b1ea40beb836 sys/ufs/lfs/lfs_bio.c
--- a/sys/ufs/lfs/lfs_bio.c     Sun Dec 03 05:30:31 2000 +0000
+++ b/sys/ufs/lfs/lfs_bio.c     Sun Dec 03 05:56:27 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_bio.c,v 1.33 2000/11/27 03:33:57 perseant Exp $    */
+/*     $NetBSD: lfs_bio.c,v 1.34 2000/12/03 05:56:27 perseant Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -482,11 +482,23 @@
 /*
  * Allocate a new buffer header.
  */
+#ifdef MALLOCLOG
+# define DOMALLOC(S, T, F) _malloc((S), (T), (F), file, line)
+struct buf *
+lfs_newbuf_malloclog(vp, daddr, size, file, line)
+       struct vnode *vp;
+       ufs_daddr_t daddr;
+       size_t size;
+       char *file;
+       int line;
+#else
+# define DOMALLOC(S, T, F) _malloc((S), (T), (F))
 struct buf *
 lfs_newbuf(vp, daddr, size)
        struct vnode *vp;
        ufs_daddr_t daddr;
        size_t size;
+#endif
 {
        struct buf *bp;
        size_t nbytes;
@@ -494,10 +506,10 @@
        
        nbytes = roundup(size, DEV_BSIZE);
        
-       bp = malloc(sizeof(struct buf), M_SEGMENT, M_WAITOK);
+       bp = DOMALLOC(sizeof(struct buf), M_SEGMENT, M_WAITOK);
        bzero(bp, sizeof(struct buf));
        if (nbytes)
-               bp->b_data = malloc(nbytes, M_SEGMENT, M_WAITOK);
+               bp->b_data = DOMALLOC(nbytes, M_SEGMENT, M_WAITOK);
        if(nbytes) {
                bzero(bp->b_data, nbytes);
        }
@@ -523,9 +535,19 @@
        return (bp);
 }
 
+#ifdef MALLOCLOG
+# define DOFREE(A, T) _free((A), (T), file, line)
+void
+lfs_freebuf_malloclog(bp, file, line)
+       struct buf *bp;
+       char *file;
+       int line;
+#else
+# define DOFREE(A, T) free((A), (T))
 void
 lfs_freebuf(bp)
        struct buf *bp;
+#endif
 {
        int s;
        
@@ -534,10 +556,10 @@
                brelvp(bp);
        splx(s);
        if (!(bp->b_flags & B_INVAL)) { /* B_INVAL indicates a "fake" buffer */
-               free(bp->b_data, M_SEGMENT);
+               DOFREE(bp->b_data, M_SEGMENT);
                bp->b_data = NULL;
        }
-       free(bp, M_SEGMENT);
+       DOFREE(bp, M_SEGMENT);
 }
 
 /*
diff -r 0fa065496c81 -r b1ea40beb836 sys/ufs/lfs/lfs_extern.h
--- a/sys/ufs/lfs/lfs_extern.h  Sun Dec 03 05:30:31 2000 +0000
+++ b/sys/ufs/lfs/lfs_extern.h  Sun Dec 03 05:56:27 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_extern.h,v 1.23 2000/11/25 02:39:35 perseant Exp $ */
+/*     $NetBSD: lfs_extern.h,v 1.24 2000/12/03 05:56:27 perseant Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -120,7 +120,16 @@
 void lfs_flush_fs __P((struct lfs *, int));
 void lfs_flush __P((struct lfs *, int));
 int lfs_check __P((struct vnode *, ufs_daddr_t, int));
+#ifdef MALLOCLOG
+void lfs_freebuf_malloclog __P((struct buf *, char *, int));
+struct buf *lfs_newbuf_malloclog __P((struct vnode *, ufs_daddr_t, size_t,
+                                     char *, int));
+#define lfs_freebuf(BP) lfs_freebuf_malloclog((BP), __FILE__, __LINE__)
+#define lfs_newbuf(V, A, S) lfs_newbuf_malloclog((V),(A),(S),__FILE__,__LINE__)
+#else
 void lfs_freebuf __P((struct buf *));
+struct buf *lfs_newbuf __P((struct vnode *, ufs_daddr_t, size_t));
+#endif
 void lfs_countlocked __P((int *, long *));
 int lfs_reserve __P((struct lfs *, struct vnode *, int));
 
@@ -157,7 +166,6 @@
 int lfs_match_indir __P((struct lfs *, struct buf *));
 int lfs_match_dindir __P((struct lfs *, struct buf *));
 int lfs_match_tindir __P((struct lfs *, struct buf *));
-struct buf *lfs_newbuf __P((struct vnode *, ufs_daddr_t, size_t));
 void lfs_callback __P((struct buf *));
 void lfs_supercallback __P((struct buf *));
 void lfs_shellsort __P((struct buf **, ufs_daddr_t *, int));
diff -r 0fa065496c81 -r b1ea40beb836 sys/ufs/lfs/lfs_inode.c
--- a/sys/ufs/lfs/lfs_inode.c   Sun Dec 03 05:30:31 2000 +0000
+++ b/sys/ufs/lfs/lfs_inode.c   Sun Dec 03 05:56:27 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_inode.c,v 1.49 2000/11/27 08:39:56 chs Exp $       */
+/*     $NetBSD: lfs_inode.c,v 1.50 2000/12/03 05:56:27 perseant Exp $  */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
diff -r 0fa065496c81 -r b1ea40beb836 sys/ufs/lfs/lfs_segment.c
--- a/sys/ufs/lfs/lfs_segment.c Sun Dec 03 05:30:31 2000 +0000
+++ b/sys/ufs/lfs/lfs_segment.c Sun Dec 03 05:56:27 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lfs_segment.c,v 1.65 2000/11/30 15:59:47 jdolecek Exp $        */
+/*     $NetBSD: lfs_segment.c,v 1.66 2000/12/03 05:56:27 perseant Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -1561,10 +1561,6 @@
                                        reassignbuf(bp, vn);
                                brelse(bp);
                        }
-                       if(bp->b_flags & B_NEEDCOMMIT) { /* XXX */
-                               bp->b_flags &= ~B_NEEDCOMMIT;
-                               wakeup(bp);
-                       }
 
                        bpp++;
 



Home | Main Index | Thread Index | Old Index