ctdb: Introduce buffer.offset to avoid memmove
authorSwen Schillig <swen@vnet.ibm.com>
Mon, 12 Mar 2018 10:00:55 +0000 (11:00 +0100)
committerChristof Schmitt <cs@samba.org>
Fri, 7 Dec 2018 18:56:16 +0000 (19:56 +0100)
commit382705f495dd7f196efc8bb24b9cee3649b44836
treed339afe5a168fd2677a97b7c2ef6ddd3f3ad09a4
parent7b60d72f67231e7675b0fad724edd59a0b3f4444
ctdb: Introduce buffer.offset to avoid memmove

The memmove operation is quite expensive, therefore,
a new buffer attribute "offset" is introduced to support
an optimized buffer processing.
The optimization is to "walk" through the buffer and process
each packet until the buffer is fully processed (empty)
without requiring any memmove.
Only if a packet is in-complete, the buffer content is moved
and the new data is read from the queue.
This way almost all memmove operations are eliminated.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Christof Schmitt <cs@samba.org>
ctdb/common/ctdb_io.c