diff options
author | Sage Weil <sage@inktank.com> | 2013-10-02 22:15:41 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-10-02 22:32:25 -0700 |
commit | 1cb0d3d929613266c764a2a1b5dd9c48d830e4eb (patch) | |
tree | 71e616f7751f88f15a718b5401f81f7e27b19392 | |
parent | a1534b7e66389e56a749402c5c35a1843e56a1ed (diff) | |
download | ceph-1cb0d3d929613266c764a2a1b5dd9c48d830e4eb.tar.gz |
osd/OSDMap: use new object_locator_t::hash to place object in a pg
The hash value, is provided, becomes the ps (placement seed) portion of the
pg_t, skipping any hashing of the object name (or locator key).
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/osd/OSDMap.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 8007d613b8c..8c424cadc77 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -1006,13 +1006,17 @@ int OSDMap::object_locator_to_pg( if (!pool) return -ENOENT; ps_t ps; - string key; - if (!loc.key.empty()) - key = make_hash_str(loc.key, loc.nspace); - else - key = make_hash_str(oid.name, loc.nspace); + if (loc.hash >= 0) { + string key; + if (!loc.key.empty()) + key = make_hash_str(loc.key, loc.nspace); + else + key = make_hash_str(oid.name, loc.nspace); - ps = ceph_str_hash(pool->object_hash, key.c_str(), key.length()); + ps = ceph_str_hash(pool->object_hash, key.c_str(), key.length()); + } else { + ps = loc.hash; + } pg = pg_t(ps, loc.get_pool(), -1); return 0; } |