]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add refcount_manifest() for the object that has manifest
authormyoungwon oh <omwmw@sk.com>
Fri, 12 Jan 2018 08:24:51 +0000 (17:24 +0900)
committermyoungwon oh <omwmw@sk.com>
Fri, 13 Apr 2018 17:34:48 +0000 (02:34 +0900)
Signed-off-by: Myoungwon Oh <omwmw@sk.com>
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index a82fb1075449e1d36d26caaf805c64ea1d6fcf56..049b978d5346112eed850bfc0111bf08fc20efa9 100644 (file)
@@ -51,6 +51,7 @@
 #include "json_spirit/json_spirit_reader.h"
 #include "include/assert.h"  // json_spirit clobbers it
 #include "include/rados/rados_types.hpp"
+#include "cls/refcount/cls_refcount_ops.h"
 
 #ifdef WITH_LTTNG
 #include "tracing/osd.h"
@@ -3392,6 +3393,35 @@ void PrimaryLogPG::do_proxy_chunked_op(OpRequestRef op, const hobject_t& missing
   } 
 }
 
+void PrimaryLogPG::refcount_manifest(ObjectContextRef obc, object_locator_t oloc, hobject_t soid,
+                                     SnapContext snapc, bool get, Context *cb, uint64_t offset)
+{
+  unsigned flags = CEPH_OSD_FLAG_IGNORE_CACHE | CEPH_OSD_FLAG_IGNORE_OVERLAY |
+                   CEPH_OSD_FLAG_RWORDERED;                      
+
+  dout(10) << __func__ << " Start refcount for " << soid << dendl;
+    
+  ObjectOperation obj_op;
+  bufferlist in;
+  if (get) {             
+    cls_chunk_refcount_get_op call;
+    call.source = obc->obs.oi.soid;
+    ::encode(call, in);                             
+    obj_op.call("refcount", "chunk_get", in);         
+  } else {                    
+    cls_chunk_refcount_put_op call;                
+    call.source = obc->obs.oi.soid;
+    ::encode(call, in);          
+    obj_op.call("refcount", "chunk_put", in);         
+  }                                                     
+  
+  unsigned n = info.pgid.hash_to_shard(osd->m_objecter_finishers);
+  osd->objecter->mutate(
+    soid.oid, oloc, obj_op, snapc,
+    ceph::real_clock::from_ceph_timespec(obc->obs.oi.mtime),
+    flags, new C_OnFinisher(cb, osd->objecter_finishers[n]));
+}  
+
 void PrimaryLogPG::do_proxy_chunked_read(OpRequestRef op, ObjectContextRef obc, int op_index,
                                         uint64_t chunk_index, uint64_t req_offset, uint64_t req_length,
                                         uint64_t req_total_len, bool write_ordered)
index e26a4b5033b4653d75e9bff8a416eaac72f19e70..67240b1af7079c8a715cf34be7c2249d3b24696e 100644 (file)
@@ -1405,6 +1405,8 @@ protected:
                             uint64_t last_offset);
   void handle_manifest_flush(hobject_t oid, ceph_tid_t tid, int r,
                             uint64_t offset, uint64_t last_offset);
+  void refcount_manifest(ObjectContextRef obc, object_locator_t oloc, hobject_t soid,
+                        SnapContext snapc, bool get, Context *cb, uint64_t offset);
 
   friend struct C_ProxyChunkRead;
   friend class PromoteManifestCallback;