Index: kern/uipc_mbuf.c =================================================================== RCS file: /cvs/src/sys/kern/uipc_mbuf.c,v retrieving revision 1.70 diff -u -p -r1.70 uipc_mbuf.c --- kern/uipc_mbuf.c 27 May 2004 04:55:28 -0000 1.70 +++ kern/uipc_mbuf.c 21 Oct 2005 06:50:30 -0000 @@ -194,6 +194,34 @@ m_getclr(nowait, type) return (m); } +#ifdef POOL_DIAGNOSTIC +struct mbuf * +_m_free(m, file, line) + struct mbuf *m; + const char *file; + long line; +{ + register struct mbuf *n; + + _MFREE(m, n, file, line); + return (n); +} + +void +_m_freem(m, file, line) + register struct mbuf *m; + const char *file; + long line; +{ + register struct mbuf *n; + + if (m == NULL) + return; + do { + _MFREE(m, n, file, line); + } while ((m = n) != NULL); +} +#else struct mbuf * m_free(m) struct mbuf *m; @@ -216,6 +244,7 @@ m_freem(m) MFREE(m, n); } while ((m = n) != NULL); } +#endif /* * Mbuffer utility routines. Index: sys/mbuf.h =================================================================== RCS file: /cvs/src/sys/sys/mbuf.h,v retrieving revision 1.83 diff -u -p -r1.83 mbuf.h --- sys/mbuf.h 17 Oct 2005 08:43:34 -0000 1.83 +++ sys/mbuf.h 21 Oct 2005 06:47:17 -0000 @@ -335,11 +335,11 @@ struct mbuf *_sk_mgethdr(int, int); MCLINITREFERENCE(m); \ } while (/* CONSTCOND */ 0) -#define _MEXTREMOVE(m) do { \ +#define _MEXTREMOVE(m, f, l) do { \ if (MCLISREFERENCED(m)) { \ _MCLDEREFERENCE(m); \ } else if ((m)->m_flags & M_CLUSTER) { \ - pool_put(&mclpool, (m)->m_ext.ext_buf); \ + _pool_put(&mclpool, (m)->m_ext.ext_buf, (f), (l)); \ } else if ((m)->m_ext.ext_free) { \ (*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \ (m)->m_ext.ext_size, (m)->m_ext.ext_arg); \ @@ -351,7 +351,7 @@ struct mbuf *_sk_mgethdr(int, int); } while (/* CONSTCOND */ 0) #define MEXTREMOVE(m) \ - MBUFLOCK(_MEXTREMOVE((m));) + MBUFLOCK(_MEXTREMOVE((m), __FILE__, __LINE__);) /* * Reset the data pointer on an mbuf. @@ -378,17 +378,18 @@ void _sk_mclget(struct mbuf *, int); * Free a single mbuf and associated external storage. * Place the successor, if any, in n. */ -#define MFREE(m, n) \ +#define _MFREE(m, n, f, l) \ MBUFLOCK( \ mbstat.m_mtypes[(m)->m_type]--; \ if ((m)->m_flags & M_PKTHDR) \ m_tag_delete_chain((m), NULL); \ if ((m)->m_flags & M_EXT) { \ - _MEXTREMOVE((m)); \ + _MEXTREMOVE((m), (f), (l)); \ } \ (n) = (m)->m_next; \ - pool_put(&mbpool, (m)); \ + _pool_put(&mbpool, (m), (f), (l)); \ ) +#define MFREE(m, n) _MFREE(m, n, __FILE__, __LINE__) /* * Move just m_pkthdr from from to to, @@ -535,7 +536,15 @@ extern struct pool mclpool; void mbinit(void); struct mbuf *m_copym2(struct mbuf *, int, int, int); struct mbuf *m_copym(struct mbuf *, int, int, int); +#ifdef POOL_DIAGNOSTIC +struct mbuf *_m_free(struct mbuf *, const char *, long); +void _m_freem(struct mbuf *, const char *, long); +#define m_free(m) _m_free(m, __FILE__, __LINE__) +#define m_freem(m) _m_freem(m, __FILE__, __LINE__) +#else struct mbuf *m_free(struct mbuf *); +void m_freem(struct mbuf *); +#endif struct mbuf *m_get(int, int); struct mbuf *m_getclr(int, int); struct mbuf *m_gethdr(int, int); @@ -549,7 +558,6 @@ struct mbuf *m_getptr(struct mbuf *, in void m_adj(struct mbuf *, int); int m_clalloc(int, int); void m_copyback(struct mbuf *, int, int, const void *); -void m_freem(struct mbuf *); void m_reclaim(void *, int); void m_copydata(struct mbuf *, int, int, caddr_t); void m_cat(struct mbuf *, struct mbuf *); Index: sys/pool.h =================================================================== RCS file: /cvs/src/sys/sys/pool.h,v retrieving revision 1.18 diff -u -p -r1.18 pool.h --- sys/pool.h 29 Jul 2004 09:18:17 -0000 1.18 +++ sys/pool.h 21 Oct 2005 06:46:19 -0000 @@ -219,6 +219,8 @@ int _pool_reclaim(struct pool *, const #define pool_get(h, f) _pool_get((h), (f), __FILE__, __LINE__) #define pool_put(h, v) _pool_put((h), (v), __FILE__, __LINE__) #define pool_reclaim(h) _pool_reclaim((h), __FILE__, __LINE__) +#else /* !POOL_DIAGNOSTIC */ +#define _pool_put(h, v, f, l) pool_put((h), (v)) #endif /* POOL_DIAGNOSTIC */ int pool_prime(struct pool *, int);