@@ -157,6 +157,8 @@ extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
/* calculate mapping of object to a placement group */
extern int ceph_calc_ceph_pg(struct ceph_pg *pg, const char *oid,
struct ceph_osdmap *osdmap, uint64_t pool);
+extern int ceph_calc_ceph_temp_pg(struct ceph_pg *pg, const char *oid,
+ struct ceph_osdmap *osdmap, uint64_t pool);
extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap,
struct ceph_pg pgid,
int *acting);
@@ -1111,6 +1111,30 @@ int ceph_calc_ceph_pg(struct ceph_pg *pg, const char *oid,
EXPORT_SYMBOL(ceph_calc_ceph_pg);
/*
+ * Using temp pg.seed only by cephfs.We want to dispaly the same name like
+ * command 'ceph pg dump'
+ */
+int ceph_calc_ceph_temp_pg(struct ceph_pg *pg, const char *oid,
+ struct ceph_osdmap *osdmap, uint64_t pool)
+{
+ struct ceph_pg_pool_info *pool_info;
+
+ BUG_ON(!osdmap);
+ pool_info = __lookup_pg_pool(&osdmap->pg_pools, pool);
+ if (!pool_info)
+ return -EIO;
+ pg->pool = pool;
+ pg->seed = ceph_str_hash(pool_info->object_hash, oid, strlen(oid));
+ pg->seed = ceph_stable_mod(pg->seed, pool_info->pg_num,
+ pool_info->pgp_num_mask);
+
+ dout("%s '%s' pgid(temp) %lld.%x\n", __func__,
+ oid, pg->pool, pg->seed);
+ return 0;
+}
+EXPORT_SYMBOL(ceph_calc_ceph_temp_pg);
+
+/*
* Calculate raw osd vector for the given pgid. Return pointer to osd
* array, or NULL on failure.
*/
We need temp seed of pg in ceph filesystem.So we add a new func and export it. Signed-off-by: Jianpeng Ma <majianpeng@gmail.com> --- include/linux/ceph/osdmap.h | 2 ++ net/ceph/osdmap.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) -- 1.8.3.rc1.44.gb387c77 Thanks! Jianpeng Ma