Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359698
b: refs/heads/master
c: 83ca14f
h: refs/heads/master
v: v3
  • Loading branch information
Sage Weil committed Feb 26, 2013
1 parent 65ba61c commit ad4c7bf
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 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: 1b83bef24c6746a146d39915a18fb5425f2facb0
refs/heads/master: 83ca14fdd35821554058e5fd4fa7b118ee504a33
4 changes: 3 additions & 1 deletion trunk/include/linux/ceph/ceph_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define CEPH_FEATURE_REPLY_CREATE_INODE (1<<27)
#define CEPH_FEATURE_OSD_HBMSGS (1<<28)
#define CEPH_FEATURE_MDSENC (1<<29)
#define CEPH_FEATURE_OSDHASHPSPOOL (1<<30)

/*
* Features supported.
Expand All @@ -45,7 +46,8 @@
CEPH_FEATURE_OSDENC | \
CEPH_FEATURE_CRUSH_TUNABLES | \
CEPH_FEATURE_CRUSH_TUNABLES2 | \
CEPH_FEATURE_REPLY_CREATE_INODE)
CEPH_FEATURE_REPLY_CREATE_INODE | \
CEPH_FEATURE_OSDHASHPSPOOL)

#define CEPH_FEATURES_REQUIRED_DEFAULT \
(CEPH_FEATURE_NOSRCADDR | \
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/ceph/osdmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ struct ceph_pg {
uint32_t seed;
};

#define CEPH_POOL_FLAG_HASHPSPOOL 1

struct ceph_pg_pool_info {
struct rb_node node;
s64 id;
Expand Down
39 changes: 26 additions & 13 deletions trunk/net/ceph/osdmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1127,18 +1127,16 @@ 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 int poolid, ps, pps, t, r;
int r;
u32 pps;

poolid = pgid.pool;
ps = pgid.seed;

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

/* pg_temp? */
t = ceph_stable_mod(ps, pool->pg_num, pool->pgp_num_mask);
pgid.seed = t;
pgid.seed = ceph_stable_mod(pgid.seed, pool->pg_num,
pool->pgp_num_mask);
pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid);
if (pg) {
*num = pg->len;
Expand All @@ -1149,20 +1147,35 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
ruleno = crush_find_rule(osdmap->crush, pool->crush_ruleset,
pool->type, pool->size);
if (ruleno < 0) {
pr_err("no crush rule pool %d ruleset %d type %d size %d\n",
poolid, pool->crush_ruleset, pool->type,
pr_err("no crush rule pool %lld ruleset %d type %d size %d\n",
pgid.pool, pool->crush_ruleset, pool->type,
pool->size);
return NULL;
}

pps = ceph_stable_mod(ps, pool->pgp_num, pool->pgp_num_mask);
pps += poolid;
if (pool->flags & CEPH_POOL_FLAG_HASHPSPOOL) {
/* hash pool id and seed sothat pool PGs do not overlap */
pps = crush_hash32_2(CRUSH_HASH_RJENKINS1,
ceph_stable_mod(pgid.seed, pool->pgp_num,
pool->pgp_num_mask),
pgid.pool);
} else {
/*
* legacy ehavior: add ps and pool together. this is
* not a great approach because the PGs from each pool
* will overlap on top of each other: 0.5 == 1.4 ==
* 2.3 == ...
*/
pps = ceph_stable_mod(pgid.seed, pool->pgp_num,
pool->pgp_num_mask) +
(unsigned)pgid.pool;
}
r = crush_do_rule(osdmap->crush, ruleno, pps, osds,
min_t(int, pool->size, *num),
osdmap->osd_weight);
if (r < 0) {
pr_err("error %d from crush rule: pool %d ruleset %d type %d"
" size %d\n", r, poolid, pool->crush_ruleset,
pr_err("error %d from crush rule: pool %lld ruleset %d type %d"
" size %d\n", r, pgid.pool, pool->crush_ruleset,
pool->type, pool->size);
return NULL;
}
Expand Down

0 comments on commit ad4c7bf

Please sign in to comment.