From: Yunchuan Wen Date: Fri, 2 Dec 2016 07:04:37 +0000 (+0800) Subject: osd: use append(bufferlist &) to avoid unnecessary copy X-Git-Tag: v12.0.3~297^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=87ff240bed9f6371fa39fc19b782d7a7f4a9aa66;p=ceph.git osd: use append(bufferlist &) to avoid unnecessary copy buffer::list::c_str() will rebuild itself if it isn't contiguous, and append(char *) will do copy from the ptr. Signed-off-by: Yunchuan Wen --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 71846caabf80..0294076c0f7e 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -3801,7 +3801,7 @@ int PrimaryLogPG::do_writesame(OpContext *ctx, OSDOp& osd_op) } while (write_length) { - write_op.indata.append(osd_op.indata.c_str(), op.writesame.data_length); + write_op.indata.append(osd_op.indata); write_length -= op.writesame.data_length; }