From 4049e47a0cfc1eef6efd502590b68ba7234589d3 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 29 Sep 2016 14:07:14 -0700 Subject: [PATCH] rgw: multipart copy part, chunked read Don't read the entire range from source object, read it in parts. Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_op.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index a844fc9bbbc..37f419197b0 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -2730,7 +2730,7 @@ int RGWPutObj::get_data(const off_t fst, const off_t lst, bufferlist& bl) return ret; } - bl_aux.copy(0, bl_aux.length(), bl); + bl.claim_append(bl_aux); return ret; } @@ -2839,7 +2839,8 @@ void RGWPutObj::execute() if (!copy_source) { len = get_data(data_in); } else { - op_ret = get_data(fst, lst, data_in); + uint64_t cur_lst = min(fst + s->cct->_conf->rgw_max_chunk_size - 1, lst); + op_ret = get_data(fst, cur_lst, data_in); if (op_ret < 0) goto done; len = data_in.length(); -- 2.47.3