From 8af0ee92faf514d4fde19f44c33df956193ce6d4 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 12 Sep 2018 14:57:56 -0500 Subject: [PATCH] osd/osd_types: rename pg_num_pending_dec_epoch -> pg_num_dec_last_epoch_clean Change the content of this field to be the last_epoch_clean for the PG when it tells the mon it is ready to be merged. This will later be used to populate the last_epoch_clean and last_epoch_started fields in PG::merge_from() in certain corner cases. Signed-off-by: Sage Weil --- src/osd/osd_types.cc | 14 ++++++++------ src/osd/osd_types.h | 7 ++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 3fdc2dc3221..192d2e150d5 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1229,7 +1229,8 @@ void pg_pool_t::dump(Formatter *f) const f->dump_unsigned("pg_placement_num_target", get_pgp_num_target()); f->dump_unsigned("pg_num_target", get_pg_num_target()); f->dump_unsigned("pg_num_pending", get_pg_num_pending()); - f->dump_unsigned("pg_num_pending_dec_epoch", get_pg_num_pending_dec_epoch()); + f->dump_unsigned("pg_num_dec_last_epoch_clean", + get_pg_num_dec_last_epoch_clean()); f->dump_stream("last_change") << get_last_change(); f->dump_stream("last_force_op_resend") << get_last_force_op_resend(); f->dump_stream("last_force_op_resend_prenautilus") @@ -1731,7 +1732,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const encode(pg_num_target, bl); encode(pgp_num_target, bl); encode(pg_num_pending, bl); - encode(pg_num_pending_dec_epoch, bl); + encode(pg_num_dec_last_epoch_clean, bl); encode(last_force_op_resend, bl); } ENCODE_FINISH(bl); @@ -1896,7 +1897,7 @@ void pg_pool_t::decode(bufferlist::const_iterator& bl) decode(pg_num_target, bl); decode(pgp_num_target, bl); decode(pg_num_pending, bl); - decode(pg_num_pending_dec_epoch, bl); + decode(pg_num_dec_last_epoch_clean, bl); decode(last_force_op_resend, bl); } else { pg_num_target = pg_num; @@ -1924,7 +1925,7 @@ void pg_pool_t::generate_test_instances(list& o) a.pgp_num_target = 4; a.pg_num_target = 5; a.pg_num_pending = 5; - a.pg_num_pending_dec_epoch = 2; + a.pg_num_dec_last_epoch_clean = 2; a.last_change = 9; a.last_force_op_resend = 123823; a.last_force_op_resend_preluminous = 123824; @@ -1994,8 +1995,9 @@ ostream& operator<<(ostream& out, const pg_pool_t& p) out << " pgp_num_target " << p.get_pgp_num_target(); } if (p.get_pg_num_pending() != p.get_pg_num()) { - out << " pg_num_pending " << p.get_pg_num_pending() - << "(e" << p.get_pg_num_pending_dec_epoch() << ")"; + out << " pg_num_pending " << p.get_pg_num_pending(); + if (p.get_pg_num_dec_last_epoch_clean()) + out << " dlec " << p.get_pg_num_dec_last_epoch_clean(); } out << " last_change " << p.get_last_change(); if (p.get_last_force_op_resend() || diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 7ee2dd300a5..ea6ebb343b2 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -1356,7 +1356,8 @@ public: /// last epoch that forced clients to resend (pre-luminous clients only) epoch_t last_force_op_resend_preluminous = 0; - epoch_t pg_num_pending_dec_epoch = 0; ///< epoch pg_num_pending decremented + ///< last_epoch_clean preceding pg_num decrement request + epoch_t pg_num_dec_last_epoch_clean = 0; snapid_t snap_seq; ///< seq for per-pool snapshot epoch_t snap_epoch; ///< osdmap epoch of last snap uint64_t auid; ///< who owns the pg @@ -1612,6 +1613,10 @@ public: // pool size that it represents. unsigned get_pg_num_divisor(pg_t pgid) const; + epoch_t get_pg_num_dec_last_epoch_clean() const { + return pg_num_dec_last_epoch_clean; + } + bool is_pending_merge(pg_t pgid, bool *target) const; void set_pg_num(int p) { -- 2.39.5