From e0bfe940a4f8e64630391fc46202f351ae28d387 Mon Sep 17 00:00:00 2001 From: Kip Macy Date: Wed, 4 Apr 2007 04:08:57 +0000 Subject: [PATCH] m_extadd does not appear to do the right thing for the case of clusters allocated from UMA - add m_cljset to correspond to m_cljget MFC after: 3 days --- sys/sys/mbuf.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index a4d7f41dc0d5..2f19a61c7747 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -533,6 +533,45 @@ m_cljget(struct mbuf *m, int how, int size) return (uma_zalloc_arg(zone, m, how)); } +static __inline void +m_cljset(struct mbuf *m, void *cl, int type) +{ + uma_zone_t zone; + int size; + + switch (type) { + case EXT_CLUSTER: + size = MCLBYTES; + zone = zone_clust; + break; +#if MJUMPAGESIZE != MCLBYTES + case EXT_JUMBOP: + size = MJUMPAGESIZE; + zone = zone_jumbop; + break; +#endif + case EXT_JUMBO9: + size = MJUM9BYTES; + zone = zone_jumbo9; + break; + case EXT_JUMBO16: + size = MJUM16BYTES; + zone = zone_jumbo16; + break; + default: + panic("unknown cluster type"); + break; + } + + m->m_data = m->m_ext.ext_buf = cl; + m->m_ext.ext_free = m->m_ext.ext_args = NULL; + m->m_ext.ext_size = size; + m->m_ext.ext_type = type; + m->m_ext.ref_cnt = uma_find_refcnt(zone, cl); + m->m_flags |= M_EXT; + +} + static __inline void m_chtype(struct mbuf *m, short new_type) {