summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-10-11 15:34:19 -0700
committerSage Weil <sage@inktank.com>2013-10-22 13:45:39 -0700
commit35f0b043d7ed6fe257d0a7a2234fe94dd54f4d9e (patch)
tree11e4c022a27df63f5a5a923a09c7deeda10ae4b2
parentb2ae146af183849a80601429255359a95229fc9a (diff)
downloadceph-35f0b043d7ed6fe257d0a7a2234fe94dd54f4d9e.tar.gz
osdc/Objecter: expose methods for getting object hash position and pg
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/osdc/Objecter.cc18
-rw-r--r--src/osdc/Objecter.h3
2 files changed, 21 insertions, 0 deletions
diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc
index 89f99f1a927..9ad49b0715b 100644
--- a/src/osdc/Objecter.cc
+++ b/src/osdc/Objecter.cc
@@ -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;
diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h
index f2c44a49772..f42d07415cc 100644
--- a/src/osdc/Objecter.h
+++ b/src/osdc/Objecter.h
@@ -1351,6 +1351,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);