svn commit: r242256 - head/sys/kern
Andre Oppermann
andre at FreeBSD.org
Sun Oct 28 18:38:52 UTC 2012
Author: andre
Date: Sun Oct 28 18:38:51 2012
New Revision: 242256
URL: http://svn.freebsd.org/changeset/base/242256
Log:
Improve m_cat() by being able to also merge contents from M_EXT
mbuf's by doing proper testing with M_WRITABLE().
In m_collapse() replace an incomplete manual check for M_RDONLY
with the M_WRITABLE() macro that also tests for shared buffers
and other cases that make a particular mbuf immutable.
MFC after: 2 weeks
Modified:
head/sys/kern/uipc_mbuf.c
Modified: head/sys/kern/uipc_mbuf.c
==============================================================================
--- head/sys/kern/uipc_mbuf.c Sun Oct 28 18:33:52 2012 (r242255)
+++ head/sys/kern/uipc_mbuf.c Sun Oct 28 18:38:51 2012 (r242256)
@@ -911,8 +911,8 @@ m_cat(struct mbuf *m, struct mbuf *n)
while (m->m_next)
m = m->m_next;
while (n) {
- if (m->m_flags & M_EXT ||
- m->m_data + m->m_len + n->m_len >= &m->m_dat[MLEN]) {
+ if (!M_WRITABLE(m) ||
+ M_TRAILINGSPACE(m) < n->m_len) {
/* just join the two chains */
m->m_next = n;
return;
@@ -1584,7 +1584,7 @@ again:
n = m->m_next;
if (n == NULL)
break;
- if ((m->m_flags & M_RDONLY) == 0 &&
+ if (M_WRITABLE(m) &&
n->m_len < M_TRAILINGSPACE(m)) {
bcopy(mtod(n, void *), mtod(m, char *) + m->m_len,
n->m_len);
More information about the svn-src-all
mailing list