From: Piotr Dałek Date: Fri, 5 Feb 2016 11:00:34 +0000 (+0100) Subject: msg/async: delay bufferlist construction X-Git-Tag: v10.1.0~330^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a07aea6da8293be7b590c6695fa6bc3ca655347b;p=ceph.git msg/async: delay bufferlist construction We're using this bl only when removing *some* of data in front of outcoming_bl, so there's no need to construct it each time we empty *entire* outcoming_bl. Though something more efficient than tmp bufferlist and splice is probably better solution. Signed-off-by: Piotr Dałek --- diff --git a/src/msg/async/AsyncConnection.cc b/src/msg/async/AsyncConnection.cc index fffb144d3de..04e37018fba 100644 --- a/src/msg/async/AsyncConnection.cc +++ b/src/msg/async/AsyncConnection.cc @@ -398,8 +398,8 @@ ssize_t AsyncConnection::_try_send(bufferlist &send_bl, bool send, bool more) // trim already sent for outcoming_bl if (sent_bytes) { - bufferlist bl; if (sent_bytes < outcoming_bl.length()) { + bufferlist bl; outcoming_bl.splice(sent_bytes, outcoming_bl.length()-sent_bytes, &bl); bl.swap(outcoming_bl); } else {