]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: expose methods for getting object hash position and pg
authorSage Weil <sage@inktank.com>
Fri, 11 Oct 2013 22:34:19 +0000 (15:34 -0700)
committerSage Weil <sage@inktank.com>
Fri, 6 Dec 2013 22:37:26 +0000 (14:37 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index ab6e55b82b1b3d392ff962ab97f18438a0c66aec..c0cd0fb6c2aae5a46f8358f5ade012750ecf359e 100644 (file)
@@ -1320,6 +1320,24 @@ bool Objecter::is_pg_changed(vector<int>& o, vector<int>& n, bool any_change)
   return false;      // same primary (tho replicas may have changed)
 }
 
+int64_t Objecter::get_object_hash_position(int64_t pool, const string& key,
+                                          const string& ns)
+{
+  const pg_pool_t *p = osdmap->get_pg_pool(pool);
+  if (!p)
+    return -ENOENT;
+  return p->hash_key(key, ns);
+}
+
+int64_t Objecter::get_object_pg_hash_position(int64_t pool, const string& key,
+                                             const string& ns)
+{
+  const pg_pool_t *p = osdmap->get_pg_pool(pool);
+  if (!p)
+    return -ENOENT;
+  return p->raw_hash_to_pg(p->hash_key(key, ns));
+}
+
 int Objecter::recalc_op_target(Op *op)
 {
   bool is_read = op->flags & CEPH_OSD_FLAG_READ;
index 329128e648cfd3426e8a3bbf6e6307a02c4389f4..67171590a9d0a78e72be6ce346df350ccb5795b1 100644 (file)
@@ -1345,6 +1345,9 @@ public:
                     list<LingerOp*>& need_resend_linger,
                     map<tid_t, CommandOp*>& need_resend_command);
 
+  int64_t get_object_hash_position(int64_t pool, const string& key, const string& ns);
+  int64_t get_object_pg_hash_position(int64_t pool, const string& key, const string& ns);
+
   // messages
  public:
   void dispatch(Message *m);