From 4cfbd81c1383121e0d4233f88a5a697d6e9e65e7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 25 Apr 2012 16:22:14 -0700 Subject: [PATCH] osdmap: drop obsolete PG_ROLE_* constants There are cruft from the old primary/chain/splay replication code. All current code says <0 is stray, 0 is primary, and >0 is replica. That is, the role is the acting vector position, or -1 if not in the vector. Signed-off-by: Sage Weil --- src/osd/OSDMap.cc | 11 +---------- src/osd/OSDMap.h | 15 --------------- src/osd/PG.h | 2 +- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index a89fd0ade2bde..767fd868c5957 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -879,16 +879,7 @@ int OSDMap::calc_pg_role(int osd, vector& acting, int nrep) { if (!nrep) nrep = acting.size(); - int rank = calc_pg_rank(osd, acting, nrep); - - if (rank < 0) - return PG_ROLE_STRAY; - else if (rank == 0) - return PG_ROLE_HEAD; - else if (rank == 1) - return PG_ROLE_ACKER; - else - return PG_ROLE_MIDDLE; + return calc_pg_rank(osd, acting, nrep); } diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 9580ea8f5272b..66cc543f53395 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -42,21 +42,6 @@ using namespace std; #include using __gnu_cxx::hash_set; - - -/* - * some system constants - */ - -// pg roles -#define PG_ROLE_STRAY -1 -#define PG_ROLE_HEAD 0 -#define PG_ROLE_ACKER 1 -#define PG_ROLE_MIDDLE 2 // der.. misnomer -//#define PG_ROLE_TAIL 2 - - - /* * we track up to two intervals during which the osd was alive and * healthy. the most recent is [up_from,up_thru), where up_thru is diff --git a/src/osd/PG.h b/src/osd/PG.h index 70466db5a4a60..e8a31bbf982e6 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -1315,7 +1315,7 @@ public: int get_role() const { return role; } void set_role(int r) { role = r; } - bool is_primary() const { return role == PG_ROLE_HEAD; } + bool is_primary() const { return role == 0; } bool is_replica() const { return role > 0; } epoch_t get_last_peering_reset() const { return last_peering_reset; } -- 2.39.5