From 369d54f41357fd136f3c9895c0ccfd26727d20b1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 22 Mar 2016 11:44:35 -0400 Subject: [PATCH 1/2] mon/PGMonitor: minor optimization in send_pg_creates Avoid repeated hash lookup. Signed-off-by: Sage Weil --- src/mon/PGMonitor.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index eadba02139c..442fc49eed0 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1256,11 +1256,12 @@ epoch_t PGMonitor::send_pg_creates(int osd, Connection *con, epoch_t next) << dendl; last = q->first; for (set::iterator r = q->second.begin(); r != q->second.end(); ++r) { + pg_stat_t &st = pg_map.pg_stat[*r]; if (!m) m = new MOSDPGCreate(pg_map.last_osdmap_epoch); - m->mkpg[*r] = pg_create_t(pg_map.pg_stat[*r].created, - pg_map.pg_stat[*r].parent, - pg_map.pg_stat[*r].parent_split_bits); + m->mkpg[*r] = pg_create_t(st.created, + st.parent, + st.parent_split_bits); // Need the create time from the monitor using its clock to set // last_scrub_stamp upon pg creation. m->ctimes[*r] = pg_map.pg_stat[*r].last_scrub_stamp; From 9c616d269abff0113b644e3c99be4bfdcd82897d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 22 Mar 2016 11:44:07 -0400 Subject: [PATCH 2/2] mon/PGMonitor: do not send pg_creates for split PGs They will split from the parent on their own, and the OSD drops these PGs on the floor anyway in OSD::handle_pg_create(). Signed-off-by: Sage Weil --- src/mon/PGMap.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 81162012b0e..fbef9bab0c4 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -468,7 +468,8 @@ void PGMap::stat_pg_add(const pg_t &pgid, const pg_stat_t &s, num_pg++; num_pg_by_state[s.state]++; - if (s.state & PG_STATE_CREATING) { + if ((s.state & PG_STATE_CREATING) && + s.parent_split_bits == 0) { creating_pgs.insert(pgid); if (s.acting_primary >= 0) { creating_pgs_by_osd_epoch[s.acting_primary][s.mapping_epoch].insert(pgid); @@ -505,7 +506,8 @@ void PGMap::stat_pg_sub(const pg_t &pgid, const pg_stat_t &s, if (end == 0) num_pg_by_state.erase(s.state); - if (s.state & PG_STATE_CREATING) { + if ((s.state & PG_STATE_CREATING) && + s.parent_split_bits == 0) { creating_pgs.erase(pgid); if (s.acting_primary >= 0) { map >& r = creating_pgs_by_osd_epoch[s.acting_primary];