Commit d9591f5e authored by Ilya Dryomov's avatar Ilya Dryomov

libceph: rename ceph_oloc_oid_to_pg()

Rename ceph_oloc_oid_to_pg() to ceph_object_locator_to_pg().  Emphasise
that returned is raw PG and return -ENOENT instead of -EIO if the pool
doesn't exist.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent 985c1673
...@@ -215,7 +215,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg) ...@@ -215,7 +215,7 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
oloc.pool = ceph_file_layout_pg_pool(ci->i_layout); oloc.pool = ceph_file_layout_pg_pool(ci->i_layout);
ceph_oid_printf(&oid, "%s", dl.object_name); ceph_oid_printf(&oid, "%s", dl.object_name);
r = ceph_oloc_oid_to_pg(osdc->osdmap, &oloc, &oid, &pgid); r = ceph_object_locator_to_pg(osdc->osdmap, &oid, &oloc, &pgid);
if (r < 0) { if (r < 0) {
up_read(&osdc->map_sem); up_read(&osdc->map_sem);
return r; return r;
......
...@@ -213,11 +213,10 @@ extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, ...@@ -213,11 +213,10 @@ extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
u64 off, u64 len, u64 off, u64 len,
u64 *bno, u64 *oxoff, u64 *oxlen); u64 *bno, u64 *oxoff, u64 *oxlen);
/* calculate mapping of object to a placement group */ int ceph_object_locator_to_pg(struct ceph_osdmap *osdmap,
extern int ceph_oloc_oid_to_pg(struct ceph_osdmap *osdmap, struct ceph_object_id *oid,
struct ceph_object_locator *oloc, struct ceph_object_locator *oloc,
struct ceph_object_id *oid, struct ceph_pg *raw_pgid);
struct ceph_pg *pg_out);
extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap,
struct ceph_pg pgid, struct ceph_pg pgid,
......
...@@ -1324,8 +1324,8 @@ static int __calc_request_pg(struct ceph_osdmap *osdmap, ...@@ -1324,8 +1324,8 @@ static int __calc_request_pg(struct ceph_osdmap *osdmap,
/* !pi is caught in ceph_oloc_oid_to_pg() */ /* !pi is caught in ceph_oloc_oid_to_pg() */
} }
return ceph_oloc_oid_to_pg(osdmap, &req->r_target_oloc, return ceph_object_locator_to_pg(osdmap, &req->r_target_oid,
&req->r_target_oid, pg_out); &req->r_target_oloc, pg_out);
} }
static void __enqueue_request(struct ceph_osd_request *req) static void __enqueue_request(struct ceph_osd_request *req)
......
...@@ -1545,30 +1545,31 @@ int ceph_calc_file_object_mapping(struct ceph_file_layout *layout, ...@@ -1545,30 +1545,31 @@ int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
EXPORT_SYMBOL(ceph_calc_file_object_mapping); EXPORT_SYMBOL(ceph_calc_file_object_mapping);
/* /*
* Calculate mapping of a (oloc, oid) pair to a PG. Should only be * Map an object into a PG.
* called with target's (oloc, oid), since tiering isn't taken into *
* account. * Should only be called with target_oid and target_oloc (as opposed to
* base_oid and base_oloc), since tiering isn't taken into account.
*/ */
int ceph_oloc_oid_to_pg(struct ceph_osdmap *osdmap, int ceph_object_locator_to_pg(struct ceph_osdmap *osdmap,
struct ceph_object_locator *oloc, struct ceph_object_id *oid,
struct ceph_object_id *oid, struct ceph_object_locator *oloc,
struct ceph_pg *pg_out) struct ceph_pg *raw_pgid)
{ {
struct ceph_pg_pool_info *pi; struct ceph_pg_pool_info *pi;
pi = __lookup_pg_pool(&osdmap->pg_pools, oloc->pool); pi = ceph_pg_pool_by_id(osdmap, oloc->pool);
if (!pi) if (!pi)
return -EIO; return -ENOENT;
pg_out->pool = oloc->pool; raw_pgid->pool = oloc->pool;
pg_out->seed = ceph_str_hash(pi->object_hash, oid->name, raw_pgid->seed = ceph_str_hash(pi->object_hash, oid->name,
oid->name_len); oid->name_len);
dout("%s %*pE pgid %llu.%x\n", __func__, oid->name_len, oid->name, dout("%s %*pE -> raw_pgid %llu.%x\n", __func__, oid->name_len,
pg_out->pool, pg_out->seed); oid->name, raw_pgid->pool, raw_pgid->seed);
return 0; return 0;
} }
EXPORT_SYMBOL(ceph_oloc_oid_to_pg); EXPORT_SYMBOL(ceph_object_locator_to_pg);
static int do_crush(struct ceph_osdmap *map, int ruleno, int x, static int do_crush(struct ceph_osdmap *map, int ruleno, int x,
int *result, int result_max, int *result, int result_max,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment