else
pending_inc.new_pools[pool].crush_ruleset = g_conf->osd_pool_default_crush_rule;
pending_inc.new_pools[pool].object_hash = CEPH_STR_HASH_RJENKINS;
- pending_inc.new_pools[pool].pg_num = (pg_num ? pg_num :
- g_conf->osd_pool_default_pg_num);
- pending_inc.new_pools[pool].pgp_num = (pgp_num ? pgp_num :
- g_conf->osd_pool_default_pgp_num);
+ pending_inc.new_pools[pool].set_pg_num(pg_num ? pg_num : g_conf->osd_pool_default_pg_num);
+ pending_inc.new_pools[pool].set_pgp_num(pgp_num ? pgp_num : g_conf->osd_pool_default_pgp_num);
pending_inc.new_pools[pool].last_change = pending_inc.epoch;
pending_inc.new_pools[pool].auid = auid;
pending_inc.new_pool_names[pool] = name;
} else {
if (pending_inc.new_pools.count(pool) == 0)
pending_inc.new_pools[pool] = *p;
- pending_inc.new_pools[pool].pg_num = n;
+ pending_inc.new_pools[pool].set_pg_num(n);
pending_inc.new_pools[pool].last_change = pending_inc.epoch;
ss << "set pool " << pool << " pg_num to " << n;
getline(ss, rs);
} else {
if (pending_inc.new_pools.count(pool) == 0)
pending_inc.new_pools[pool] = *p;
- pending_inc.new_pools[pool].pgp_num = n;
+ pending_inc.new_pools[pool].set_pgp_num(n);
pending_inc.new_pools[pool].last_change = pending_inc.epoch;
ss << "set pool " << pool << " pgp_num to " << n;
getline(ss, rs);
pool->auid = pi->auid;
// split?
- if (pool->info.pg_num != pi->pg_num) {
- dout(1) << " pool " << p->first << " pg_num " << pool->info.pg_num << " -> " << pi->pg_num << dendl;
- pool_resize[p->first] = pool->info.pg_num;
+ if (pool->info.get_pg_num() != pi->get_pg_num()) {
+ dout(1) << " pool " << p->first << " pg_num " << pool->info.get_pg_num()
+ << " -> " << pi->get_pg_num() << dendl;
+ pool_resize[p->first] = pool->info.get_pg_num();
changed = true;
}
pg_t pgid = it->first;
PG *pg = it->second;
set<pg_t> children;
- if (pgid.is_split(p->second, pg->pool->info.pg_num, &children)) {
+ if (pgid.is_split(p->second, pg->pool->info.get_pg_num(), &children)) {
do_split(pg, children, t, tfin);
}
}
pools[pool].size = cct->_conf->osd_pool_default_size;
pools[pool].crush_ruleset = p->first;
pools[pool].object_hash = CEPH_STR_HASH_RJENKINS;
- pools[pool].pg_num = poolbase << pg_bits;
- pools[pool].pgp_num = poolbase << pgp_bits;
+ pools[pool].set_pg_num(poolbase << pg_bits);
+ pools[pool].set_pgp_num(poolbase << pgp_bits);
pools[pool].last_change = epoch;
if (p->first == CEPH_DATA_RULE)
pools[pool].crash_replay_interval = cct->_conf->osd_default_data_pool_replay_window;
pools[pool].size = cct->_conf->osd_pool_default_size;
pools[pool].crush_ruleset = p->first;
pools[pool].object_hash = CEPH_STR_HASH_RJENKINS;
- pools[pool].pg_num = (maxosd + 1) << pg_bits;
- pools[pool].pgp_num = (maxosd + 1) << pgp_bits;
+ pools[pool].set_pg_num((maxosd + 1) << pg_bits);
+ pools[pool].set_pgp_num((maxosd + 1) << pgp_bits);
pools[pool].last_change = epoch;
if (p->first == CEPH_DATA_RULE)
pools[pool].crash_replay_interval = cct->_conf->osd_default_data_pool_replay_window;
__u8 size; /// number of osds in each pg
__u8 crush_ruleset; /// crush placement rule set
__u8 object_hash; /// hash mapping object name to ps
+private:
__u32 pg_num, pgp_num; /// number of pgs
+public:
epoch_t last_change; /// most recent epoch changed, exclusing snapshot changes
snapid_t snap_seq; /// seq for per-pool snapshot
epoch_t snap_epoch; /// osdmap epoch of last snap
unsigned get_pg_num_mask() const { return pg_num_mask; }
unsigned get_pgp_num_mask() const { return pgp_num_mask; }
+ void set_pg_num(int p) {
+ pg_num = p;
+ calc_pg_masks();
+ }
+ void set_pgp_num(int p) {
+ pgp_num = p;
+ calc_pg_masks();
+ }
+
static int calc_bits_of(int t);
void calc_pg_masks();