aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/osdmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ceph/osdmap.c')
-rw-r--r--net/ceph/osdmap.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index 8b1a6b48bb5d..768dd04eb9b1 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -1090,25 +1090,30 @@ invalid:
1090EXPORT_SYMBOL(ceph_calc_file_object_mapping); 1090EXPORT_SYMBOL(ceph_calc_file_object_mapping);
1091 1091
1092/* 1092/*
1093 * calculate an object layout (i.e. pgid) from an oid, 1093 * Calculate mapping of a (oloc, oid) pair to a PG. Should only be
1094 * file_layout, and osdmap 1094 * called with target's (oloc, oid), since tiering isn't taken into
1095 * account.
1095 */ 1096 */
1096int ceph_calc_ceph_pg(struct ceph_pg *pg, const char *oid, 1097int ceph_oloc_oid_to_pg(struct ceph_osdmap *osdmap,
1097 struct ceph_osdmap *osdmap, uint64_t pool) 1098 struct ceph_object_locator *oloc,
1099 struct ceph_object_id *oid,
1100 struct ceph_pg *pg_out)
1098{ 1101{
1099 struct ceph_pg_pool_info *pool_info; 1102 struct ceph_pg_pool_info *pi;
1100 1103
1101 BUG_ON(!osdmap); 1104 pi = __lookup_pg_pool(&osdmap->pg_pools, oloc->pool);
1102 pool_info = __lookup_pg_pool(&osdmap->pg_pools, pool); 1105 if (!pi)
1103 if (!pool_info)
1104 return -EIO; 1106 return -EIO;
1105 pg->pool = pool;
1106 pg->seed = ceph_str_hash(pool_info->object_hash, oid, strlen(oid));
1107 1107
1108 dout("%s '%s' pgid %lld.%x\n", __func__, oid, pg->pool, pg->seed); 1108 pg_out->pool = oloc->pool;
1109 pg_out->seed = ceph_str_hash(pi->object_hash, oid->name,
1110 oid->name_len);
1111
1112 dout("%s '%.*s' pgid %llu.%x\n", __func__, oid->name_len, oid->name,
1113 pg_out->pool, pg_out->seed);
1109 return 0; 1114 return 0;
1110} 1115}
1111EXPORT_SYMBOL(ceph_calc_ceph_pg); 1116EXPORT_SYMBOL(ceph_oloc_oid_to_pg);
1112 1117
1113static int crush_do_rule_ary(const struct crush_map *map, int ruleno, int x, 1118static int crush_do_rule_ary(const struct crush_map *map, int ruleno, int x,
1114 int *result, int result_max, 1119 int *result, int result_max,