Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Nov 2000 13:19:33 +0000
From:      David Malone <dwmalone@maths.tcd.ie>
To:        Bosko Milekic <bmilekic@dsuper.net>
Cc:        freebsd-net@freebsd.org
Subject:   Re: M_RDONLY: review & comment 
Message-ID:   <200011121319.aa19357@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Fri, 10 Nov 2000 00:54:09 EST." <Pine.BSF.4.21.0011100039040.92343-100000@jehovah.technokratis.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
This is an application of the M_WRITABLE macro I've been testing
at home (we're also testing a cruder version in RELENG_4 in college).
What this does is allows sbcompress to compress into external
storage if it is writable.

This can be of great help if you have lots of small packets arriving
via an interface which always uses an mbuf cluster for every packet
(the fxp driver is one example I think). We were frequently running
out of clusters before using this patch.

The limit of copying at most MCLBYTES/4 comes from BSDi, which seems
to have had a similar patch in place for some time. If Bosko or someone
can review this I'd like to commit it.

	David.

Index: uipc_socket2.c
===================================================================
RCS file: /cvs/FreeBSD-CVS/src/sys/kern/uipc_socket2.c,v
retrieving revision 1.65
diff -u -r1.65 uipc_socket2.c
--- uipc_socket2.c	2000/09/05 22:10:24	1.65
+++ uipc_socket2.c	2000/10/15 18:55:58
@@ -718,8 +718,10 @@
 			m = m_free(m);
 			continue;
 		}
-		if (n && (n->m_flags & (M_EXT | M_EOR)) == 0 &&
-		    (n->m_data + n->m_len + m->m_len) < &n->m_dat[MLEN] &&
+		if (n && (n->m_flags & M_EOR) == 0 &&
+		    M_WRITABLE(n) &&
+		    (m)->m_len <= MCLBYTES / 4 &&
+		    (m)->m_len <= M_TRAILINGSPACE(n) &&
 		    n->m_type == m->m_type) {
 			bcopy(mtod(m, caddr_t), mtod(n, caddr_t) + n->m_len,
 			    (unsigned)m->m_len);


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi? <200011121319.aa19357>