From 4b5f18e1b26bfa6dc8110d835ca2cd918ce56fe8 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 28 Jan 2019 12:41:41 -0500 Subject: [PATCH] rgw: read ops use make_throttle() with optional_yield Signed-off-by: Casey Bodley --- src/rgw/rgw_op.cc | 6 +++--- src/rgw/rgw_rados.cc | 9 +++++---- src/rgw/rgw_rados.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 813ee552e17..51ec087d344 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1458,7 +1458,7 @@ int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket, perfcounter->inc(l_rgw_get_b, cur_end - cur_ofs); filter->fixup_range(cur_ofs, cur_end); - op_ret = read_op.iterate(cur_ofs, cur_end, filter); + op_ret = read_op.iterate(cur_ofs, cur_end, filter, s->yield); if (op_ret >= 0) op_ret = filter->flush(); return op_ret; @@ -2106,7 +2106,7 @@ void RGWGetObj::execute() ofs_x = ofs; end_x = end; filter->fixup_range(ofs_x, end_x); - op_ret = read_op.iterate(ofs_x, end_x, filter); + op_ret = read_op.iterate(ofs_x, end_x, filter, s->yield); if (op_ret >= 0) op_ret = filter->flush(); @@ -3512,7 +3512,7 @@ int RGWPutObj::get_data(const off_t fst, const off_t lst, bufferlist& bl) return ret; filter->fixup_range(new_ofs, new_end); - ret = read_op.iterate(new_ofs, new_end, filter); + ret = read_op.iterate(new_ofs, new_end, filter, s->yield); if (ret >= 0) ret = filter->flush(); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index bd665b9ba60..dc51b2a2032 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4519,7 +4519,7 @@ int RGWRados::copy_obj_to_remote_dest(RGWObjState *astate, return ret; } - ret = read_op.iterate(0, astate->size - 1, out_stream_req->get_out_cb()); + ret = read_op.iterate(0, astate->size - 1, out_stream_req->get_out_cb(), null_yield); if (ret < 0) { delete out_stream_req; return ret; @@ -6818,7 +6818,8 @@ int RGWRados::get_obj_iterate_cb(const rgw_raw_obj& read_obj, off_t obj_ofs, return d->flush(std::move(completed)); } -int RGWRados::Object::Read::iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb) +int RGWRados::Object::Read::iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb, + optional_yield y) { RGWRados *store = source->get_store(); CephContext *cct = store->ctx(); @@ -6826,8 +6827,8 @@ int RGWRados::Object::Read::iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb) const uint64_t chunk_size = cct->_conf->rgw_get_obj_max_req_size; const uint64_t window_size = cct->_conf->rgw_get_obj_window_size; - rgw::BlockingAioThrottle aio(window_size); - get_obj_data data(store, cb, &aio, ofs); + auto aio = rgw::make_throttle(window_size, y); + get_obj_data data(store, cb, &*aio, ofs); int r = store->iterate_obj(obj_ctx, source->get_bucket_info(), state.obj, ofs, end, chunk_size, _get_obj_iterate_cb, &data); diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index c080bc444eb..5fdedf38714 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1576,7 +1576,7 @@ public: int prepare(); static int range_to_ofs(uint64_t obj_size, int64_t &ofs, int64_t &end); int read(int64_t ofs, int64_t end, bufferlist& bl); - int iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb); + int iterate(int64_t ofs, int64_t end, RGWGetDataCB *cb, optional_yield y); int get_attr(const char *name, bufferlist& dest); }; -- 2.39.5