]> git.karo-electronics.de Git - linux-beck.git/commitdiff
libceph: rename ceph_calc_object_layout()
authorAlex Elder <elder@inktank.com>
Sat, 2 Mar 2013 00:00:15 +0000 (18:00 -0600)
committerSage Weil <sage@inktank.com>
Thu, 2 May 2013 04:16:17 +0000 (21:16 -0700)
The purpose of ceph_calc_object_layout() is to fill in the pool
number and seed for a ceph_pg structure provided, based on a given
osd map and target object id.

Currently that function takes a file layout parameter, but the only
thing used out of that is its pool number.

Change the function so it takes a pool number rather than the full
file layout structure.  Only update the ceph_pg if the pool is found
in the osd map.  Get rid of few useless lines of code from the
function while there.

Since the function now very clearly just fills in the ceph_pg
structure it's provided, rename it ceph_calc_ceph_pg().

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
fs/ceph/ioctl.c
include/linux/ceph/osdmap.h
net/ceph/osd_client.c
net/ceph/osdmap.c

index 4a989345b37bd368e62ede9ddc0032ff8e5b8fa4..e0b4ef31d3c870c9e73fecad303e9f9957542385 100644 (file)
@@ -208,8 +208,9 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg)
 
        snprintf(dl.object_name, sizeof(dl.object_name), "%llx.%08llx",
                 ceph_ino(inode), dl.object_no);
-       ceph_calc_object_layout(&pgid, dl.object_name, &ci->i_layout,
-                               osdc->osdmap);
+
+       ceph_calc_ceph_pg(&pgid, dl.object_name, osdc->osdmap,
+               ceph_file_layout_pg_pool(ci->i_layout));
 
        dl.osd = ceph_calc_pg_primary(osdc->osdmap, pgid);
        if (dl.osd >= 0) {
index c819190d16423c4b82a619871a1e68babbd765ba..167daf60c4e8a411b01c5daa73b690af1aa1cae7 100644 (file)
@@ -131,10 +131,8 @@ extern int ceph_calc_file_object_mapping(struct ceph_file_layout *layout,
                                         u64 *bno, u64 *oxoff, u64 *oxlen);
 
 /* calculate mapping of object to a placement group */
-extern int ceph_calc_object_layout(struct ceph_pg *pg,
-                                  const char *oid,
-                                  struct ceph_file_layout *fl,
-                                  struct ceph_osdmap *osdmap);
+extern int ceph_calc_ceph_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);
index d7ce457c59d91b80b0758e28c62cdf0561449f8d..38d09d13bb159466bc3d684fc60203220aa3bebd 100644 (file)
@@ -948,8 +948,8 @@ static int __map_request(struct ceph_osd_client *osdc,
        int err;
 
        dout("map_request %p tid %lld\n", req, req->r_tid);
-       err = ceph_calc_object_layout(&pgid, req->r_oid,
-                                     &req->r_file_layout, osdc->osdmap);
+       err = ceph_calc_ceph_pg(&pgid, req->r_oid, osdc->osdmap,
+                               ceph_file_layout_pg_pool(req->r_file_layout));
        if (err) {
                list_move(&req->r_req_lru_item, &osdc->req_notarget);
                return err;
index 4543b9aba40ce1a9e4565824624bcecba6c298cb..09898711f2fdc080d1348c74549e0d383848b599 100644 (file)
@@ -1111,27 +1111,22 @@ EXPORT_SYMBOL(ceph_calc_file_object_mapping);
  * calculate an object layout (i.e. pgid) from an oid,
  * file_layout, and osdmap
  */
-int ceph_calc_object_layout(struct ceph_pg *pg,
-                           const char *oid,
-                           struct ceph_file_layout *fl,
-                           struct ceph_osdmap *osdmap)
+int ceph_calc_ceph_pg(struct ceph_pg *pg, const char *oid,
+                       struct ceph_osdmap *osdmap, uint64_t pool)
 {
-       unsigned int num, num_mask;
-       struct ceph_pg_pool_info *pool;
+       struct ceph_pg_pool_info *pool_info;
 
        BUG_ON(!osdmap);
-       pg->pool = le32_to_cpu(fl->fl_pg_pool);
-       pool = __lookup_pg_pool(&osdmap->pg_pools, pg->pool);
-       if (!pool)
+       pool_info = __lookup_pg_pool(&osdmap->pg_pools, pool);
+       if (!pool_info)
                return -EIO;
-       pg->seed = ceph_str_hash(pool->object_hash, oid, strlen(oid));
-       num = pool->pg_num;
-       num_mask = pool->pg_num_mask;
+       pg->pool = pool;
+       pg->seed = ceph_str_hash(pool_info->object_hash, oid, strlen(oid));
 
-       dout("calc_object_layout '%s' pgid %lld.%x\n", oid, pg->pool, pg->seed);
+       dout("%s '%s' pgid %lld.%x\n", __func__, oid, pg->pool, pg->seed);
        return 0;
 }
-EXPORT_SYMBOL(ceph_calc_object_layout);
+EXPORT_SYMBOL(ceph_calc_ceph_pg);
 
 /*
  * Calculate raw osd vector for the given pgid.  Return pointer to osd