From c360c604aa806a43f9cae8cf9bfc122102de710e Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 30 Jan 2014 08:22:58 -0800 Subject: [PATCH] ceph_psim: some futzing to test primary_affinity - map to acting - count first position, primary Signed-off-by: Sage Weil --- src/tools/psim.cc | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/tools/psim.cc b/src/tools/psim.cc index ecc176d2c81..7f094b9b874 100644 --- a/src/tools/psim.cc +++ b/src/tools/psim.cc @@ -21,15 +21,25 @@ int main(int argc, char **argv) OSDMap osdmap; osdmap.decode(bl); + //osdmap.set_primary_affinity(0, 0x8000); + //osdmap.set_primary_affinity(3, 0); + int n = osdmap.get_max_osd(); int count[n]; + int first_count[n]; + int primary_count[n]; for (int i=0; itype = pg_pool_t::TYPE_ERASURE; + int size[4]; for (int i=0; i<4; i++) size[i] = 0; @@ -48,7 +58,7 @@ int main(int argc, char **argv) pg_t pgid = pg_t(l.ol_pgid); //pgid.u.ps = f * 4 + b; int primary; - osdmap.pg_to_osds(pgid, &osds, &primary); + osdmap.pg_to_acting_osds(pgid, &osds, &primary); size[osds.size()]++; #if 0 if (0) { @@ -66,13 +76,20 @@ int main(int argc, char **argv) //cout << " rep " << i << " on " << osds[i] << std::endl; count[osds[i]]++; } + if (osds.size()) + first_count[osds[0]]++; + if (primary >= 0) + primary_count[primary]++; } } } uint64_t avg = 0; for (int i=0; i