From 87ff240bed9f6371fa39fc19b782d7a7f4a9aa66 Mon Sep 17 00:00:00 2001 From: Yunchuan Wen Date: Fri, 2 Dec 2016 15:04:37 +0800 Subject: [PATCH] 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 --- src/osd/PrimaryLogPG.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.47.3