ceph-dedup-tool: --add-chunk-ref -> --chunk-get-ref (and -put-ref)

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2020-05-20 13:35:05 -05:00
parent b831bb2b71
commit a92fa51b9b
2 changed files with 10 additions and 4 deletions

View File

@ -134,7 +134,7 @@ function test_dedup_chunk_scrub()
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

View File

@ -750,7 +750,8 @@ int chunk_scrub_common(const std::map < std::string, std::string > &opts,
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");
@ -785,7 +786,11 @@ int chunk_scrub_common(const std::map < std::string, std::string > &opts,
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;
@ -921,7 +926,8 @@ int main(int argc, const char **argv)
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);