]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-dedup-tool: --add-chunk-ref -> --chunk-get-ref (and -put-ref)
authorSage Weil <sage@newdream.net>
Wed, 20 May 2020 18:35:05 +0000 (13:35 -0500)
committerSage Weil <sage@newdream.net>
Wed, 27 May 2020 15:44:31 +0000 (10:44 -0500)
Signed-off-by: Sage Weil <sage@newdream.net>
qa/workunits/rados/test_dedup_tool.sh
src/tools/ceph_dedup_tool.cc

index c1a9888d0a75e17e4860aa3298d1004e238f1119..b49b939790a0a767b61fe87ffe20b95662d58da8 100755 (executable)
@@ -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
index fb459dbecb28b66363a754975bb71a63eb0f0152..c0fdbabab2fe0551eade29abe104ac4ffddeff16 100644 (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);