OPTION(osd_pool_default_min_size, OPT_INT, 0) // 0 means no specific default; ceph will use size-size/2
OPTION(osd_pool_default_pg_num, OPT_INT, 8) // number of PGs for new pools. Configure in global or mon section of ceph.conf
OPTION(osd_pool_default_pgp_num, OPT_INT, 8) // number of PGs for placement purposes. Should be equal to pg_num
+OPTION(osd_pool_default_flags, OPT_INT, 0) // default flags for new pools
OPTION(osd_map_dedup, OPT_BOOL, true)
OPTION(osd_map_cache_size, OPT_INT, 500)
OPTION(osd_map_message_max, OPT_INT, 100) // max maps per MOSDMap message
#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. Should be everything above.
CEPH_FEATURE_CRUSH_TUNABLES2 | \
CEPH_FEATURE_CREATEPOOLID | \
CEPH_FEATURE_REPLY_CREATE_INODE | \
- CEPH_FEATURE_OSD_HBMSGS | \
- CEPH_FEATURE_MDSENC)
+ CEPH_FEATURE_OSD_HBMSGS | \
+ CEPH_FEATURE_MDSENC | \
+ CEPH_FEATURE_OSDHASHPSPOOL)
#define CEPH_FEATURES_SUPPORTED_DEFAULT CEPH_FEATURES_ALL
pending_inc.new_pool_max = osdmap.pool_max;
int64_t pool = ++pending_inc.new_pool_max;
pending_inc.new_pools[pool].type = pg_pool_t::TYPE_REP;
+ pending_inc.new_pools[pool].type = g_conf->osd_pool_default_flags;
pending_inc.new_pools[pool].size = g_conf->osd_pool_default_size;
pending_inc.new_pools[pool].min_size = g_conf->get_osd_pool_default_min_size();
for (map<int,const char*>::iterator p = rulesets.begin(); p != rulesets.end(); p++) {
int64_t pool = ++pool_max;
pools[pool].type = pg_pool_t::TYPE_REP;
+ pools[pool].flags = cct->_conf->osd_pool_default_flags;
pools[pool].size = cct->_conf->osd_pool_default_size;
pools[pool].min_size = cct->_conf->get_osd_pool_default_min_size();
pools[pool].crush_ruleset = p->first;
for (map<int,const char*>::iterator p = rulesets.begin(); p != rulesets.end(); p++) {
int64_t pool = ++pool_max;
pools[pool].type = pg_pool_t::TYPE_REP;
+ pools[pool].flags = cct->_conf->osd_pool_default_flags;
pools[pool].size = cct->_conf->osd_pool_default_size;
pools[pool].min_size = cct->_conf->get_osd_pool_default_min_size();
pools[pool].crush_ruleset = p->first;
#include "osd_types.h"
#include "include/ceph_features.h"
+extern "C" {
+#include "crush/hash.h"
+}
#include "PG.h"
#include "OSDMap.h"
*/
ps_t pg_pool_t::raw_pg_to_pps(pg_t pg) const
{
- return ceph_stable_mod(pg.ps(), pgp_num, pgp_num_mask) + pg.pool();
+ if (true) {//flags & FLAG_HASHPSPOOL) {
+ // Hash the pool id so that pool PGs do not overlap.
+ return
+ crush_hash32_2(CRUSH_HASH_RJENKINS1,
+ ceph_stable_mod(pg.ps(), pgp_num, pgp_num_mask),
+ pg.pool());
+ } else {
+ // Legacy behavior; add ps and pool together. This is not a great
+ // idea because the PGs from each pool will essentially overlap on
+ // top of each other: 0.5 == 1.4 == 2.3 == ...
+ return
+ ceph_stable_mod(pg.ps(), pgp_num, pgp_num_mask) +
+ pg.pool();
+ }
}
void pg_pool_t::encode(bufferlist& bl, uint64_t features) const
TYPE_REP = 1, // replication
TYPE_RAID4 = 2, // raid4 (never implemented)
};
+ enum {
+ FLAG_HASHPSPOOL = 1, // hash pg seed and pool together (instead of adding)
+ };
static const char *get_type_name(int t) {
switch (t) {