Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264204
b: refs/heads/master
c: 782e182
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed Sep 28, 2011
1 parent 80ca64d commit 2b1c877
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 935b639a049053d0ccbcf7422f2f9cd221642f58
refs/heads/master: 782e182e91e97f529a1edb30fdece9f1bef90ecc
34 changes: 21 additions & 13 deletions trunk/net/ceph/osdmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,29 +1046,32 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
struct ceph_pg_mapping *pg;
struct ceph_pg_pool_info *pool;
int ruleno;
unsigned poolid, ps, pps;
unsigned poolid, ps, pps, t;
int preferred;

poolid = le32_to_cpu(pgid.pool);
ps = le16_to_cpu(pgid.ps);
preferred = (s16)le16_to_cpu(pgid.preferred);

pool = __lookup_pg_pool(&osdmap->pg_pools, poolid);
if (!pool)
return NULL;

/* pg_temp? */
if (preferred >= 0)
t = ceph_stable_mod(ps, le32_to_cpu(pool->v.lpg_num),
pool->lpgp_num_mask);
else
t = ceph_stable_mod(ps, le32_to_cpu(pool->v.pg_num),
pool->pgp_num_mask);
pgid.ps = cpu_to_le16(t);
pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid);
if (pg) {
*num = pg->len;
return pg->osds;
}

/* crush */
poolid = le32_to_cpu(pgid.pool);
ps = le16_to_cpu(pgid.ps);
preferred = (s16)le16_to_cpu(pgid.preferred);

/* don't forcefeed bad device ids to crush */
if (preferred >= osdmap->max_osd ||
preferred >= osdmap->crush->max_devices)
preferred = -1;

pool = __lookup_pg_pool(&osdmap->pg_pools, poolid);
if (!pool)
return NULL;
ruleno = crush_find_rule(osdmap->crush, pool->v.crush_ruleset,
pool->v.type, pool->v.size);
if (ruleno < 0) {
Expand All @@ -1078,6 +1081,11 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
return NULL;
}

/* don't forcefeed bad device ids to crush */
if (preferred >= osdmap->max_osd ||
preferred >= osdmap->crush->max_devices)
preferred = -1;

if (preferred >= 0)
pps = ceph_stable_mod(ps,
le32_to_cpu(pool->v.lpgp_num),
Expand Down

0 comments on commit 2b1c877

Please sign in to comment.