From: myoungwon oh Date: Mon, 19 Mar 2018 07:20:18 +0000 (+0900) Subject: cls/refcount: add chunk_refcount_client() X-Git-Tag: v13.1.0~257^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5d67bb97f77a96efed49cbac557495451cfb3247;p=ceph.git cls/refcount: add chunk_refcount_client() Signed-off-by: Myoungwon Oh --- diff --git a/src/cls/refcount/cls_refcount_client.cc b/src/cls/refcount/cls_refcount_client.cc index 14da2ff2b316..d3e1aeecb470 100644 --- a/src/cls/refcount/cls_refcount_client.cc +++ b/src/cls/refcount/cls_refcount_client.cc @@ -58,3 +58,50 @@ int cls_refcount_read(librados::IoCtx& io_ctx, string& oid, list *refs, return r; } + +void cls_chunk_refcount_get(librados::ObjectWriteOperation& op, const hobject_t& soid) +{ + bufferlist in; + cls_chunk_refcount_get_op call; + call.source = soid; + encode(call, in); + op.exec("refcount", "chunk_get", in); +} + +void cls_chunk_refcount_put(librados::ObjectWriteOperation& op, const hobject_t& soid) +{ + bufferlist in; + cls_chunk_refcount_put_op call; + call.source = soid; + encode(call, in); + op.exec("refcount", "chunk_put", in); +} + +void cls_chunk_refcount_set(librados::ObjectWriteOperation& op, set& refs) +{ + bufferlist in; + cls_chunk_refcount_set_op call; + call.refs = refs; + encode(call, in); + op.exec("refcount", "chunk_set", in); +} + +int cls_chunk_refcount_read(librados::IoCtx& io_ctx, string& oid, set *refs) +{ + bufferlist in, out; + int r = io_ctx.exec(oid, "refcount", "chunk_read", in, out); + if (r < 0) + return r; + + cls_chunk_refcount_read_ret ret; + try { + bufferlist::iterator iter = out.begin(); + decode(ret, iter); + } catch (buffer::error& err) { + return -EIO; + } + + *refs = ret.refs; + + return r; +}