diff options
Diffstat (limited to 'net/ceph/osdmap.c')
-rw-r--r-- | net/ceph/osdmap.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index 911919320d2e..378471644501 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c | |||
@@ -1095,32 +1095,24 @@ EXPORT_SYMBOL(ceph_calc_file_object_mapping); | |||
1095 | * calculate an object layout (i.e. pgid) from an oid, | 1095 | * calculate an object layout (i.e. pgid) from an oid, |
1096 | * file_layout, and osdmap | 1096 | * file_layout, and osdmap |
1097 | */ | 1097 | */ |
1098 | int ceph_calc_object_layout(struct ceph_object_layout *ol, | 1098 | int ceph_calc_object_layout(struct ceph_pg *pg, |
1099 | const char *oid, | 1099 | const char *oid, |
1100 | struct ceph_file_layout *fl, | 1100 | struct ceph_file_layout *fl, |
1101 | struct ceph_osdmap *osdmap) | 1101 | struct ceph_osdmap *osdmap) |
1102 | { | 1102 | { |
1103 | unsigned int num, num_mask; | 1103 | unsigned int num, num_mask; |
1104 | struct ceph_pg pgid; | ||
1105 | struct ceph_pg_pool_info *pool; | 1104 | struct ceph_pg_pool_info *pool; |
1106 | 1105 | ||
1107 | BUG_ON(!osdmap); | 1106 | BUG_ON(!osdmap); |
1108 | 1107 | pg->pool = le32_to_cpu(fl->fl_pg_pool); | |
1109 | pgid.pool = le32_to_cpu(fl->fl_pg_pool); | 1108 | pool = __lookup_pg_pool(&osdmap->pg_pools, pg->pool); |
1110 | pool = __lookup_pg_pool(&osdmap->pg_pools, pgid.pool); | ||
1111 | if (!pool) | 1109 | if (!pool) |
1112 | return -EIO; | 1110 | return -EIO; |
1113 | pgid.seed = ceph_str_hash(pool->object_hash, oid, strlen(oid)); | 1111 | pg->seed = ceph_str_hash(pool->object_hash, oid, strlen(oid)); |
1114 | num = pool->pg_num; | 1112 | num = pool->pg_num; |
1115 | num_mask = pool->pg_num_mask; | 1113 | num_mask = pool->pg_num_mask; |
1116 | 1114 | ||
1117 | dout("calc_object_layout '%s' pgid %lld.%x\n", oid, pgid.pool, | 1115 | dout("calc_object_layout '%s' pgid %lld.%x\n", oid, pg->pool, pg->seed); |
1118 | pgid.seed); | ||
1119 | |||
1120 | ol->ol_pgid.ps = cpu_to_le16(pgid.seed); | ||
1121 | ol->ol_pgid.pool = fl->fl_pg_pool; | ||
1122 | ol->ol_pgid.preferred = cpu_to_le16(-1); | ||
1123 | ol->ol_stripe_unit = fl->fl_object_stripe_unit; | ||
1124 | return 0; | 1116 | return 0; |
1125 | } | 1117 | } |
1126 | EXPORT_SYMBOL(ceph_calc_object_layout); | 1118 | EXPORT_SYMBOL(ceph_calc_object_layout); |