CHUNK_OID=$(echo -n "There hi" | sha1sum)
POOL_ID=$(ceph osd pool ls detail | grep $POOL | awk '{print$2}')
- $DEDUP_TOOL --op add-chunk-ref --chunk-pool $CHUNK_POOL --object $CHUNK_OID --target-ref bar --target-ref-pool-id $POOL_ID
+ $DEDUP_TOOL --op get-chunk-ref --chunk-pool $CHUNK_POOL --object $CHUNK_OID --target-ref bar --target-ref-pool-id $POOL_ID
RESULT=$($DEDUP_TOOL --op get-chunk-ref --chunk-pool $CHUNK_POOL --object $CHUNK_OID)
$DEDUP_TOOL --op chunk-scrub --chunk-pool $CHUNK_POOL
goto out;
}
- if (op_name == "add-chunk-ref") {
+ if (op_name == "chunk-get-ref" ||
+ op_name == "chunk-put-ref") {
string target_object_name;
uint64_t pool_id;
i = opts.find("object");
hobject_t oid(sobject_t(target_object_name, CEPH_NOSNAP), "", hash, pool_id, "");
ObjectWriteOperation op;
- cls_cas_chunk_get_ref(op, oid);
+ if (op_name == "chunk-get-ref") {
+ cls_cas_chunk_get_ref(op, oid);
+ } else {
+ cls_cas_chunk_put_ref(op, oid);
+ }
ret = chunk_io_ctx.operate(object_name, &op);
if (ret < 0) {
cerr << " operate fail : " << cpp_strerror(ret) << std::endl;
return estimate_dedup_ratio(opts, args);
} else if (op_name == "chunk-scrub") {
return chunk_scrub_common(opts, args);
- } else if (op_name == "add-chunk-ref") {
+ } else if (op_name == "chunk-get-ref" ||
+ op_name == "chunk-put-ref") {
return chunk_scrub_common(opts, args);
} else if (op_name == "get-chunk-ref") {
return chunk_scrub_common(opts, args);