From 75014ceb1437c5bb48293574ec6f991e4bec64bb Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Thu, 28 Mar 2019 20:32:43 -0400 Subject: [PATCH] osd: Update osd_types to work without using namespace Signed-off-by: Adam C. Emerson --- src/osd/osd_types.cc | 448 ++++++++++---------- src/osd/osd_types.h | 959 ++++++++++++++++++++++--------------------- 2 files changed, 697 insertions(+), 710 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 130a8f2e2f8..d40e7e97dfe 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -15,15 +15,49 @@ * */ +#include +#include +#include +#include +#include +#include +#include +#include + + #include -#include "osd_types.h" #include "include/ceph_features.h" +#include "include/encoding.h" #include "include/stringify.h" extern "C" { #include "crush/hash.h" } + +#include "common/Formatter.h" + #include "OSDMap.h" +#include "osd_types.h" + +using std::list; +using std::make_pair; +using std::map; +using std::ostream; +using std::ostringstream; +using std::pair; +using std::set; +using std::string; +using std::stringstream; +using std::unique_ptr; +using std::vector; + +using ceph::decode; +using ceph::decode_nohead; +using ceph::encode; +using ceph::encode_nohead; +using ceph::Formatter; + +using namespace std::literals; const char *ceph_osd_flag_name(unsigned flag) { @@ -142,14 +176,14 @@ string ceph_osd_alloc_hint_flag_string(unsigned flags) return string("-"); } -void pg_shard_t::encode(bufferlist &bl) const +void pg_shard_t::encode(ceph::buffer::list &bl) const { ENCODE_START(1, 1, bl); encode(osd, bl); encode(shard, bl); ENCODE_FINISH(bl); } -void pg_shard_t::decode(bufferlist::const_iterator &bl) +void pg_shard_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(1, bl); decode(osd, bl); @@ -199,7 +233,7 @@ void osd_reqid_t::generate_test_instances(list& o) // -- object_locator_t -- -void object_locator_t::encode(bufferlist& bl) const +void object_locator_t::encode(ceph::buffer::list& bl) const { // verify that nobody's corrupted the locator ceph_assert(hash == -1 || key.empty()); @@ -216,7 +250,7 @@ void object_locator_t::encode(bufferlist& bl) const ENCODE_FINISH_NEW_COMPAT(bl, encode_compat); } -void object_locator_t::decode(bufferlist::const_iterator& p) +void object_locator_t::decode(ceph::buffer::list::const_iterator& p) { DECODE_START_LEGACY_COMPAT_LEN(6, 3, 3, p); if (struct_v < 2) { @@ -261,7 +295,7 @@ void object_locator_t::generate_test_instances(list& o) } // -- request_redirect_t -- -void request_redirect_t::encode(bufferlist& bl) const +void request_redirect_t::encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(redirect_locator, bl); @@ -271,7 +305,7 @@ void request_redirect_t::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void request_redirect_t::decode(bufferlist::const_iterator& bl) +void request_redirect_t::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(1, bl); uint32_t legacy_osd_instructions_len; @@ -310,7 +344,7 @@ void objectstore_perf_stat_t::dump(Formatter *f) const f->dump_unsigned("apply_latency_ns", os_apply_latency_ns); } -void objectstore_perf_stat_t::encode(bufferlist &bl, uint64_t features) const +void objectstore_perf_stat_t::encode(ceph::buffer::list &bl, uint64_t features) const { uint8_t target_v = 2; if (!HAVE_FEATURE(features, OS_PERF_STAT_NS)) { @@ -330,7 +364,7 @@ void objectstore_perf_stat_t::encode(bufferlist &bl, uint64_t features) const ENCODE_FINISH(bl); } -void objectstore_perf_stat_t::decode(bufferlist::const_iterator &bl) +void objectstore_perf_stat_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(2, bl); if (struct_v >= 2) { @@ -392,7 +426,7 @@ void osd_stat_t::dump(Formatter *f) const f->close_section(); } -void osd_stat_t::encode(bufferlist &bl, uint64_t features) const +void osd_stat_t::encode(ceph::buffer::list &bl, uint64_t features) const { ENCODE_START(10, 2, bl); @@ -428,7 +462,7 @@ void osd_stat_t::encode(bufferlist &bl, uint64_t features) const ENCODE_FINISH(bl); } -void osd_stat_t::decode(bufferlist::const_iterator &bl) +void osd_stat_t::decode(ceph::buffer::list::const_iterator &bl) { int64_t kb, kb_used,kb_avail; int64_t kb_used_data, kb_used_omap, kb_used_meta; @@ -777,7 +811,7 @@ bool coll_t::parse(const std::string& s) return false; } -void coll_t::encode(bufferlist& bl) const +void coll_t::encode(ceph::buffer::list& bl) const { using ceph::encode; // when changing this, remember to update encoded_size() too. @@ -823,7 +857,7 @@ size_t coll_t::encoded_size() const return r; } -void coll_t::decode(bufferlist::const_iterator& bl) +void coll_t::decode(ceph::buffer::list::const_iterator& bl) { using ceph::decode; __u8 struct_v; @@ -901,12 +935,12 @@ std::string pg_vector_string(const vector &a) { ostringstream oss; oss << "["; - for (vector::const_iterator i = a.begin(); i != a.end(); ++i) { - if (i != a.begin()) + for (auto i = a.cbegin(); i != a.cend(); ++i) { + if (i != a.begin()) oss << ","; - if (*i != CRUSH_ITEM_NONE) + if (*i != CRUSH_ITEM_NONE) oss << *i; - else + else oss << "NONE"; } oss << "]"; @@ -1071,7 +1105,7 @@ void pool_snap_info_t::dump(Formatter *f) const f->dump_string("name", name); } -void pool_snap_info_t::encode(bufferlist& bl, uint64_t features) const +void pool_snap_info_t::encode(ceph::buffer::list& bl, uint64_t features) const { using ceph::encode; if ((features & CEPH_FEATURE_PGPOOL3) == 0) { @@ -1089,7 +1123,7 @@ void pool_snap_info_t::encode(bufferlist& bl, uint64_t features) const ENCODE_FINISH(bl); } -void pool_snap_info_t::decode(bufferlist::const_iterator& bl) +void pool_snap_info_t::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); decode(snapid, bl); @@ -1155,7 +1189,7 @@ bool pool_opts_t::is_opt_name(const std::string& name) pool_opts_t::opt_desc_t pool_opts_t::get_opt_desc(const std::string& name) { - opt_mapping_t::iterator i = opt_mapping.find(name); + auto i = opt_mapping.find(name); ceph_assert(i != opt_mapping.end()); return i->second; } @@ -1167,7 +1201,7 @@ bool pool_opts_t::is_set(pool_opts_t::key_t key) const const pool_opts_t::value_t& pool_opts_t::get(pool_opts_t::key_t key) const { - opts_t::const_iterator i = opts.find(key); + auto i = opts.find(key); ceph_assert(i != opts.end()); return i->second; } @@ -1199,7 +1233,7 @@ private: void pool_opts_t::dump(const std::string& name, Formatter* f) const { const opt_desc_t& desc = get_opt_desc(name); - opts_t::const_iterator i = opts.find(desc.key); + auto i = opts.find(desc.key); if (i == opts.end()) { return; } @@ -1208,11 +1242,10 @@ void pool_opts_t::dump(const std::string& name, Formatter* f) const void pool_opts_t::dump(Formatter* f) const { - for (opt_mapping_t::iterator i = opt_mapping.begin(); i != opt_mapping.end(); - ++i) { + for (auto i = opt_mapping.cbegin(); i != opt_mapping.cend(); ++i) { const std::string& name = i->first; const opt_desc_t& desc = i->second; - opts_t::const_iterator j = opts.find(desc.key); + auto j = opts.find(desc.key); if (j == opts.end()) { continue; } @@ -1222,7 +1255,7 @@ void pool_opts_t::dump(Formatter* f) const class pool_opts_encoder_t : public boost::static_visitor<> { public: - explicit pool_opts_encoder_t(bufferlist& bl_, uint64_t features) + explicit pool_opts_encoder_t(ceph::buffer::list& bl_, uint64_t features) : bl(bl_), features(features) {} @@ -1244,11 +1277,11 @@ public: } private: - bufferlist& bl; + ceph::buffer::list& bl; uint64_t features; }; -void pool_opts_t::encode(bufferlist& bl, uint64_t features) const +void pool_opts_t::encode(ceph::buffer::list& bl, uint64_t features) const { unsigned v = 2; if (!HAVE_FEATURE(features, SERVER_NAUTILUS)) { @@ -1257,14 +1290,14 @@ void pool_opts_t::encode(bufferlist& bl, uint64_t features) const ENCODE_START(v, 1, bl); uint32_t n = static_cast(opts.size()); encode(n, bl); - for (opts_t::const_iterator i = opts.begin(); i != opts.end(); ++i) { + for (auto i = opts.cbegin(); i != opts.cend(); ++i) { encode(static_cast(i->first), bl); boost::apply_visitor(pool_opts_encoder_t(bl, features), i->second); } ENCODE_FINISH(bl); } -void pool_opts_t::decode(bufferlist::const_iterator& bl) +void pool_opts_t::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(1, bl); __u32 n; @@ -1301,11 +1334,10 @@ void pool_opts_t::decode(bufferlist::const_iterator& bl) ostream& operator<<(ostream& out, const pool_opts_t& opts) { - for (opt_mapping_t::iterator i = opt_mapping.begin(); i != opt_mapping.end(); - ++i) { + for (auto i = opt_mapping.begin(); i != opt_mapping.end(); ++i) { const std::string& name = i->first; const pool_opts_t::opt_desc_t& desc = i->second; - pool_opts_t::opts_t::const_iterator j = opts.opts.find(desc.key); + auto j = opts.opts.find(desc.key); if (j == opts.opts.end()) { continue; } @@ -1349,7 +1381,7 @@ void pg_pool_t::dump(Formatter *f) const f->dump_unsigned("snap_seq", get_snap_seq()); f->dump_unsigned("snap_epoch", get_snap_epoch()); f->open_array_section("pool_snaps"); - for (map::const_iterator p = snaps.begin(); p != snaps.end(); ++p) { + for (auto p = snaps.cbegin(); p != snaps.cend(); ++p) { f->open_object_section("pool_snap_info"); p->second.dump(f); f->close_section(); @@ -1359,7 +1391,7 @@ void pg_pool_t::dump(Formatter *f) const f->dump_unsigned("quota_max_bytes", quota_max_bytes); f->dump_unsigned("quota_max_objects", quota_max_objects); f->open_array_section("tiers"); - for (set::const_iterator p = tiers.begin(); p != tiers.end(); ++p) + for (auto p = tiers.cbegin(); p != tiers.cend(); ++p) f->dump_unsigned("pool_id", *p); f->close_section(); f->dump_int("tier_of", tier_of); @@ -1511,9 +1543,7 @@ bool pg_pool_t::maybe_updated_removed_snaps(const interval_set& cached snapid_t pg_pool_t::snap_exists(const char *s) const { - for (map::const_iterator p = snaps.begin(); - p != snaps.end(); - ++p) + for (auto p = snaps.cbegin(); p != snaps.cend(); ++p) if (p->second.name == s) return p->second.snapid; return 0; @@ -1566,9 +1596,7 @@ SnapContext pg_pool_t::get_snap_context() const { vector s(snaps.size()); unsigned i = 0; - for (map::const_reverse_iterator p = snaps.rbegin(); - p != snaps.rend(); - ++p) + for (auto p = snaps.crbegin(); p != snaps.crend(); ++p) s[i++] = p->first; return SnapContext(get_snap_seq(), s); } @@ -1640,7 +1668,7 @@ uint32_t pg_pool_t::get_random_pg_position(pg_t pg, uint32_t seed) const return r; } -void pg_pool_t::encode(bufferlist& bl, uint64_t features) const +void pg_pool_t::encode(ceph::buffer::list& bl, uint64_t features) const { using ceph::encode; if ((features & CEPH_FEATURE_PGPOOL3) == 0) { @@ -1850,7 +1878,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const ENCODE_FINISH(bl); } -void pg_pool_t::decode(bufferlist::const_iterator& bl) +void pg_pool_t::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(29, 5, 5, bl); decode(type, bl); @@ -2227,7 +2255,7 @@ void object_stat_sum_t::dump(Formatter *f) const f->dump_int("num_omap_keys", num_omap_keys); } -void object_stat_sum_t::encode(bufferlist& bl) const +void object_stat_sum_t::encode(ceph::buffer::list& bl) const { ENCODE_START(19, 14, bl); #if defined(CEPH_LITTLE_ENDIAN) @@ -2276,7 +2304,7 @@ void object_stat_sum_t::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void object_stat_sum_t::decode(bufferlist::const_iterator& bl) +void object_stat_sum_t::decode(ceph::buffer::list::const_iterator& bl) { bool decode_finish = false; DECODE_START(19, bl); // make sure to also update fast decode below @@ -2521,7 +2549,7 @@ void object_stat_collection_t::dump(Formatter *f) const f->close_section(); } -void object_stat_collection_t::encode(bufferlist& bl) const +void object_stat_collection_t::encode(ceph::buffer::list& bl) const { ENCODE_START(2, 2, bl); encode(sum, bl); @@ -2529,7 +2557,7 @@ void object_stat_collection_t::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void object_stat_collection_t::decode(bufferlist::const_iterator& bl) +void object_stat_collection_t::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl); decode(sum, bl); @@ -2546,7 +2574,7 @@ void object_stat_collection_t::generate_test_instances(list l; object_stat_sum_t::generate_test_instances(l); - for (list::iterator p = l.begin(); p != l.end(); ++p) { + for (auto p = l.begin(); p != l.end(); ++p) { a.add(**p); o.push_back(new object_stat_collection_t(a)); } @@ -2560,8 +2588,7 @@ bool pg_stat_t::is_acting_osd(int32_t osd, bool primary) const if (primary && osd == acting_primary) { return true; } else if (!primary) { - for(vector::const_iterator it = acting.begin(); - it != acting.end(); ++it) + for(auto it = acting.cbegin(); it != acting.cend(); ++it) { if (*it == osd) return true; @@ -2610,24 +2637,21 @@ void pg_stat_t::dump(Formatter *f) const f->dump_unsigned("snaptrimq_len", snaptrimq_len); stats.dump(f); f->open_array_section("up"); - for (vector::const_iterator p = up.begin(); p != up.end(); ++p) + for (auto p = up.cbegin(); p != up.cend(); ++p) f->dump_int("osd", *p); f->close_section(); f->open_array_section("acting"); - for (vector::const_iterator p = acting.begin(); p != acting.end(); ++p) + for (auto p = acting.cbegin(); p != acting.cend(); ++p) f->dump_int("osd", *p); f->close_section(); f->open_array_section("blocked_by"); - for (vector::const_iterator p = blocked_by.begin(); - p != blocked_by.end(); ++p) + for (auto p = blocked_by.cbegin(); p != blocked_by.cend(); ++p) f->dump_int("osd", *p); f->close_section(); f->dump_int("up_primary", up_primary); f->dump_int("acting_primary", acting_primary); f->open_array_section("purged_snaps"); - for (interval_set::const_iterator i = purged_snaps.begin(); - i != purged_snaps.end(); - ++i) { + for (auto i = purged_snaps.begin(); i != purged_snaps.end(); ++i) { f->open_object_section("interval"); f->dump_stream("start") << i.get_start(); f->dump_stream("length") << i.get_len(); @@ -2640,18 +2664,18 @@ void pg_stat_t::dump_brief(Formatter *f) const { f->dump_string("state", pg_state_string(state)); f->open_array_section("up"); - for (vector::const_iterator p = up.begin(); p != up.end(); ++p) + for (auto p = up.cbegin(); p != up.cend(); ++p) f->dump_int("osd", *p); f->close_section(); f->open_array_section("acting"); - for (vector::const_iterator p = acting.begin(); p != acting.end(); ++p) + for (auto p = acting.cbegin(); p != acting.cend(); ++p) f->dump_int("osd", *p); f->close_section(); f->dump_int("up_primary", up_primary); f->dump_int("acting_primary", acting_primary); } -void pg_stat_t::encode(bufferlist &bl) const +void pg_stat_t::encode(ceph::buffer::list &bl) const { ENCODE_START(25, 22, bl); encode(version, bl); @@ -2702,7 +2726,7 @@ void pg_stat_t::encode(bufferlist &bl) const ENCODE_FINISH(bl); } -void pg_stat_t::decode(bufferlist::const_iterator &bl) +void pg_stat_t::decode(ceph::buffer::list::const_iterator &bl) { bool tmp; uint32_t old_state; @@ -2950,7 +2974,7 @@ void pool_stat_t::dump(Formatter *f) const f->dump_int("num_store_stats", acting); } -void pool_stat_t::encode(bufferlist &bl, uint64_t features) const +void pool_stat_t::encode(ceph::buffer::list &bl, uint64_t features) const { using ceph::encode; if ((features & CEPH_FEATURE_OSDENC) == 0) { @@ -2973,7 +2997,7 @@ void pool_stat_t::encode(bufferlist &bl, uint64_t features) const ENCODE_FINISH(bl); } -void pool_stat_t::decode(bufferlist::const_iterator &bl) +void pool_stat_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(7, 5, 5, bl); if (struct_v >= 4) { @@ -3041,7 +3065,7 @@ void pool_stat_t::generate_test_instances(list& o) // -- pg_history_t -- -void pg_history_t::encode(bufferlist &bl) const +void pg_history_t::encode(ceph::buffer::list &bl) const { ENCODE_START(9, 4, bl); encode(epoch_created, bl); @@ -3063,7 +3087,7 @@ void pg_history_t::encode(bufferlist &bl) const ENCODE_FINISH(bl); } -void pg_history_t::decode(bufferlist::const_iterator &bl) +void pg_history_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(9, 4, 4, bl); decode(epoch_created, bl); @@ -3158,7 +3182,7 @@ void pg_history_t::generate_test_instances(list& o) // -- pg_info_t -- -void pg_info_t::encode(bufferlist &bl) const +void pg_info_t::encode(ceph::buffer::list &bl) const { ENCODE_START(32, 26, bl); encode(pgid.pgid, bl); @@ -3183,7 +3207,7 @@ void pg_info_t::encode(bufferlist &bl) const ENCODE_FINISH(bl); } -void pg_info_t::decode(bufferlist::const_iterator &bl) +void pg_info_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(32, bl); decode(pgid.pgid, bl); @@ -3276,7 +3300,7 @@ void pg_info_t::generate_test_instances(list& o) } // -- pg_notify_t -- -void pg_notify_t::encode(bufferlist &bl) const +void pg_notify_t::encode(ceph::buffer::list &bl) const { ENCODE_START(2, 2, bl); encode(query_epoch, bl); @@ -3287,7 +3311,7 @@ void pg_notify_t::encode(bufferlist &bl) const ENCODE_FINISH(bl); } -void pg_notify_t::decode(bufferlist::const_iterator &bl) +void pg_notify_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(2, bl); decode(query_epoch, bl); @@ -3331,7 +3355,7 @@ ostream &operator<<(ostream &lhs, const pg_notify_t ¬ify) // -- pg_interval_t -- -void PastIntervals::pg_interval_t::encode(bufferlist& bl) const +void PastIntervals::pg_interval_t::encode(ceph::buffer::list& bl) const { ENCODE_START(4, 2, bl); encode(first, bl); @@ -3344,7 +3368,7 @@ void PastIntervals::pg_interval_t::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void PastIntervals::pg_interval_t::decode(bufferlist::const_iterator& bl) +void PastIntervals::pg_interval_t::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl); decode(first, bl); @@ -3373,11 +3397,11 @@ void PastIntervals::pg_interval_t::dump(Formatter *f) const f->dump_unsigned("last", last); f->dump_int("maybe_went_rw", maybe_went_rw ? 1 : 0); f->open_array_section("up"); - for (vector::const_iterator p = up.begin(); p != up.end(); ++p) + for (auto p = up.cbegin(); p != up.cend(); ++p) f->dump_int("osd", *p); f->close_section(); f->open_array_section("acting"); - for (vector::const_iterator p = acting.begin(); p != acting.end(); ++p) + for (auto p = acting.cbegin(); p != acting.cend(); ++p) f->dump_int("osd", *p); f->close_section(); f->dump_int("primary", primary); @@ -3434,14 +3458,14 @@ struct compact_interval_t { f->dump_stream("acting") << acting; f->close_section(); } - void encode(bufferlist &bl) const { + void encode(ceph::buffer::list &bl) const { ENCODE_START(1, 1, bl); encode(first, bl); encode(last, bl); encode(acting, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator &bl) { + void decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(1, bl); decode(first, bl); decode(last, bl); @@ -3532,7 +3556,7 @@ public: return out << "([" << first << "," << last << "] intervals=" << intervals << ")"; } - void encode(bufferlist &bl) const override { + void encode(ceph::buffer::list &bl) const override { ENCODE_START(1, 1, bl); encode(first, bl); encode(last, bl); @@ -3540,7 +3564,7 @@ public: encode(intervals, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator &bl) override { + void decode(ceph::buffer::list::const_iterator &bl) override { DECODE_START(1, bl); decode(first, bl); decode(last, bl); @@ -3642,7 +3666,7 @@ ostream& operator<<(ostream& out, const PastIntervals::PriorSet &i) << ")"; } -void PastIntervals::decode(bufferlist::const_iterator &bl) +void PastIntervals::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(1, bl); __u8 type = 0; @@ -3849,8 +3873,7 @@ bool PastIntervals::check_new_interval( i.up_primary = old_up_primary; unsigned num_acting = 0; - for (vector::const_iterator p = i.acting.begin(); p != i.acting.end(); - ++p) + for (auto p = i.acting.cbegin(); p != i.acting.cend(); ++p) if (*p != CRUSH_ITEM_NONE) ++num_acting; @@ -3919,9 +3942,7 @@ bool PastIntervals::PriorSet::affected_by_map( const OSDMap &osdmap, const DoutPrefixProvider *dpp) const { - for (set::iterator p = probe.begin(); - p != probe.end(); - ++p) { + for (auto p = probe.begin(); p != probe.end(); ++p) { int o = p->osd; // did someone in the prior set go down? @@ -3931,7 +3952,7 @@ bool PastIntervals::PriorSet::affected_by_map( } // did a down osd in cur get (re)marked as lost? - map::const_iterator r = blocked_by.find(o); + auto r = blocked_by.find(o); if (r != blocked_by.end()) { if (!osdmap.exists(o)) { ldpp_dout(dpp, 10) << "affected_by_map osd." << o << " no longer exists" << dendl; @@ -3945,9 +3966,7 @@ bool PastIntervals::PriorSet::affected_by_map( } // did someone in the prior down set go up? - for (set::const_iterator p = down.begin(); - p != down.end(); - ++p) { + for (auto p = down.cbegin(); p != down.cend(); ++p) { int o = *p; if (osdmap.is_up(o)) { @@ -3961,7 +3980,7 @@ bool PastIntervals::PriorSet::affected_by_map( return true; } // did a down osd in down get (re)marked as lost? - map::const_iterator r = blocked_by.find(o); + auto r = blocked_by.find(o); if (r != blocked_by.end()) { if (osdmap.get_info(o).lost_at != r->second) { ldpp_dout(dpp, 10) << "affected_by_map osd." << o << " (re)marked as lost" << dendl; @@ -3988,7 +4007,7 @@ ostream& operator<<(ostream& out, const PastIntervals::pg_interval_t& i) // -- pg_query_t -- -void pg_query_t::encode(bufferlist &bl, uint64_t features) const { +void pg_query_t::encode(ceph::buffer::list &bl, uint64_t features) const { ENCODE_START(3, 3, bl); encode(type, bl); encode(since, bl); @@ -3999,7 +4018,7 @@ void pg_query_t::encode(bufferlist &bl, uint64_t features) const { ENCODE_FINISH(bl); } -void pg_query_t::decode(bufferlist::const_iterator &bl) { +void pg_query_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(3, bl); decode(type, bl); decode(since, bl); @@ -4052,7 +4071,7 @@ void ObjectModDesc::visit(Visitor *visitor) const break; } case SETATTRS: { - map > attrs; + map > attrs; decode(attrs, bp); visitor->setattrs(attrs); break; @@ -4106,13 +4125,11 @@ struct DumpVisitor : public ObjectModDesc::Visitor { f->dump_unsigned("old_size", old_size); f->close_section(); } - void setattrs(map > &attrs) override { + void setattrs(map > &attrs) override { f->open_object_section("op"); f->dump_string("code", "SETATTRS"); f->open_array_section("attrs"); - for (map >::iterator i = attrs.begin(); - i != attrs.end(); - ++i) { + for (auto i = attrs.begin(); i != attrs.end(); ++i) { f->dump_string("attr_name", i->first); } f->close_section(); @@ -4168,7 +4185,7 @@ void ObjectModDesc::dump(Formatter *f) const void ObjectModDesc::generate_test_instances(list& o) { - map > attrs; + map > attrs; attrs[OI_ATTR]; attrs[SS_ATTR]; attrs["asdf"]; @@ -4187,7 +4204,7 @@ void ObjectModDesc::generate_test_instances(list& o) o.back()->append(1000); } -void ObjectModDesc::encode(bufferlist &_bl) const +void ObjectModDesc::encode(ceph::buffer::list &_bl) const { ENCODE_START(max_required_version, max_required_version, _bl); encode(can_local_rollback, _bl); @@ -4195,14 +4212,14 @@ void ObjectModDesc::encode(bufferlist &_bl) const encode(bl, _bl); ENCODE_FINISH(_bl); } -void ObjectModDesc::decode(bufferlist::const_iterator &_bl) +void ObjectModDesc::decode(ceph::buffer::list::const_iterator &_bl) { DECODE_START(2, _bl); max_required_version = struct_v; decode(can_local_rollback, _bl); decode(rollback_info_completed, _bl); decode(bl, _bl); - // ensure bl does not pin a larger buffer in memory + // ensure bl does not pin a larger ceph::buffer in memory bl.rebuild(); bl.reassign_to_mempool(mempool::mempool_osd_pglog); DECODE_FINISH(_bl); @@ -4215,30 +4232,30 @@ string pg_log_entry_t::get_key_name() const return version.get_key_name(); } -void pg_log_entry_t::encode_with_checksum(bufferlist& bl) const +void pg_log_entry_t::encode_with_checksum(ceph::buffer::list& bl) const { using ceph::encode; - bufferlist ebl(sizeof(*this)*2); + ceph::buffer::list ebl(sizeof(*this)*2); this->encode(ebl); __u32 crc = ebl.crc32c(0); encode(ebl, bl); encode(crc, bl); } -void pg_log_entry_t::decode_with_checksum(bufferlist::const_iterator& p) +void pg_log_entry_t::decode_with_checksum(ceph::buffer::list::const_iterator& p) { using ceph::decode; - bufferlist bl; + ceph::buffer::list bl; decode(bl, p); __u32 crc; decode(crc, p); if (crc != bl.crc32c(0)) - throw buffer::malformed_input("bad checksum on pg_log_entry_t"); + throw ceph::buffer::malformed_input("bad checksum on pg_log_entry_t"); auto q = bl.cbegin(); this->decode(q); } -void pg_log_entry_t::encode(bufferlist &bl) const +void pg_log_entry_t::encode(ceph::buffer::list &bl) const { ENCODE_START(12, 4, bl); encode(op, bl); @@ -4272,7 +4289,7 @@ void pg_log_entry_t::encode(bufferlist &bl) const ENCODE_FINISH(bl); } -void pg_log_entry_t::decode(bufferlist::const_iterator &bl) +void pg_log_entry_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(12, 4, 4, bl); decode(op, bl); @@ -4310,7 +4327,7 @@ void pg_log_entry_t::decode(bufferlist::const_iterator &bl) if (struct_v >= 7 || // for v >= 7, this is for all ops. op == CLONE) { // for v < 7, it's only present for CLONE. decode(snaps, bl); - // ensure snaps does not pin a larger buffer in memory + // ensure snaps does not pin a larger ceph::buffer in memory snaps.rebuild(); snaps.reassign_to_mempool(mempool::mempool_osd_pglog); } @@ -4359,7 +4376,7 @@ void pg_log_entry_t::dump(Formatter *f) const f->dump_int("return_code", return_code); if (snaps.length() > 0) { vector v; - bufferlist c = snaps; + ceph::buffer::list c = snaps; auto p = c.cbegin(); try { using ceph::decode; @@ -4368,7 +4385,7 @@ void pg_log_entry_t::dump(Formatter *f) const v.clear(); } f->open_object_section("snaps"); - for (vector::iterator p = v.begin(); p != v.end(); ++p) + for (auto p = v.begin(); p != v.end(); ++p) f->dump_unsigned("snap", *p); f->close_section(); } @@ -4399,7 +4416,7 @@ ostream& operator<<(ostream& out, const pg_log_entry_t& e) << " " << e.return_code; if (e.snaps.length()) { vector snaps; - bufferlist c = e.snaps; + ceph::buffer::list c = e.snaps; auto p = c.cbegin(); try { decode(snaps, p); @@ -4423,7 +4440,7 @@ std::string pg_log_dup_t::get_key_name() const return key; } -void pg_log_dup_t::encode(bufferlist &bl) const +void pg_log_dup_t::encode(ceph::buffer::list &bl) const { ENCODE_START(1, 1, bl); encode(reqid, bl); @@ -4433,7 +4450,7 @@ void pg_log_dup_t::encode(bufferlist &bl) const ENCODE_FINISH(bl); } -void pg_log_dup_t::decode(bufferlist::const_iterator &bl) +void pg_log_dup_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(1, bl); decode(reqid, bl); @@ -4484,8 +4501,7 @@ void pg_log_t::filter_log(spg_t import_pgid, const OSDMap &curmap, out.log.clear(); reject.log.clear(); - for (list::const_iterator i = in.log.begin(); - i != in.log.end(); ++i) { + for (auto i = in.log.cbegin(); i != in.log.cend(); ++i) { // Reject pg log entries for temporary objects if (i->soid.is_temp()) { @@ -4510,7 +4526,7 @@ void pg_log_t::filter_log(spg_t import_pgid, const OSDMap &curmap, } } -void pg_log_t::encode(bufferlist& bl) const +void pg_log_t::encode(ceph::buffer::list& bl) const { ENCODE_START(7, 3, bl); encode(head, bl); @@ -4522,7 +4538,7 @@ void pg_log_t::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void pg_log_t::decode(bufferlist::const_iterator &bl, int64_t pool) +void pg_log_t::decode(ceph::buffer::list::const_iterator &bl, int64_t pool) { DECODE_START_LEGACY_COMPAT_LEN(7, 3, 3, bl); decode(head, bl); @@ -4547,9 +4563,7 @@ void pg_log_t::decode(bufferlist::const_iterator &bl, int64_t pool) // handle hobject_t format change if (struct_v < 4) { - for (list::iterator i = log.begin(); - i != log.end(); - ++i) { + for (auto i = log.begin(); i != log.end(); ++i) { if (!i->soid.is_max() && i->soid.pool == -1) i->soid.pool = pool; } @@ -4561,7 +4575,7 @@ void pg_log_t::dump(Formatter *f) const f->dump_stream("head") << head; f->dump_stream("tail") << tail; f->open_array_section("log"); - for (list::const_iterator p = log.begin(); p != log.end(); ++p) { + for (auto p = log.cbegin(); p != log.cend(); ++p) { f->open_object_section("entry"); p->dump(f); f->close_section(); @@ -4586,7 +4600,7 @@ void pg_log_t::generate_test_instances(list& o) o.back()->tail = eversion_t(3,4); list e; pg_log_entry_t::generate_test_instances(e); - for (list::iterator p = e.begin(); p != e.end(); ++p) + for (auto p = e.begin(); p != e.end(); ++p) o.back()->log.push_back(**p); } @@ -4595,9 +4609,7 @@ void pg_log_t::copy_after(const pg_log_t &other, eversion_t v) can_rollback_to = other.can_rollback_to; head = other.head; tail = other.tail; - for (list::const_reverse_iterator i = other.log.rbegin(); - i != other.log.rend(); - ++i) { + for (auto i = other.log.crbegin(); i != other.log.crend(); ++i) { ceph_assert(i->version > other.tail); if (i->version <= v) { // make tail accurate. @@ -4611,7 +4623,7 @@ void pg_log_t::copy_after(const pg_log_t &other, eversion_t v) void pg_log_t::copy_range(const pg_log_t &other, eversion_t from, eversion_t to) { can_rollback_to = other.can_rollback_to; - list::const_reverse_iterator i = other.log.rbegin(); + auto i = other.log.crbegin(); ceph_assert(i != other.log.rend()); while (i->version > to) { ++i; @@ -4634,9 +4646,7 @@ void pg_log_t::copy_up_to(const pg_log_t &other, int max) int n = 0; head = other.head; tail = other.tail; - for (list::const_reverse_iterator i = other.log.rbegin(); - i != other.log.rend(); - ++i) { + for (auto i = other.log.crbegin(); i != other.log.crend(); ++i) { if (n++ >= max) { tail = i->version; break; @@ -4648,9 +4658,7 @@ void pg_log_t::copy_up_to(const pg_log_t &other, int max) ostream& pg_log_t::print(ostream& out) const { out << *this << std::endl; - for (list::const_iterator p = log.begin(); - p != log.end(); - ++p) + for (auto p = log.cbegin(); p != log.cend(); ++p) out << *p << std::endl; for (const auto& entry : dups) { out << " dup entry: " << entry << std::endl; @@ -4671,7 +4679,7 @@ ostream& operator<<(ostream& out, const pg_missing_item& i) // -- object_copy_cursor_t -- -void object_copy_cursor_t::encode(bufferlist& bl) const +void object_copy_cursor_t::encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(attr_complete, bl); @@ -4682,7 +4690,7 @@ void object_copy_cursor_t::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void object_copy_cursor_t::decode(bufferlist::const_iterator &bl) +void object_copy_cursor_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(1, bl); decode(attr_complete, bl); @@ -4720,7 +4728,7 @@ void object_copy_cursor_t::generate_test_instances(list& // -- object_copy_data_t -- -void object_copy_data_t::encode(bufferlist& bl, uint64_t features) const +void object_copy_data_t::encode(ceph::buffer::list& bl, uint64_t features) const { ENCODE_START(8, 5, bl); encode(size, bl); @@ -4742,7 +4750,7 @@ void object_copy_data_t::encode(bufferlist& bl, uint64_t features) const ENCODE_FINISH(bl); } -void object_copy_data_t::decode(bufferlist::const_iterator& bl) +void object_copy_data_t::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(7, bl); if (struct_v < 5) { @@ -4756,7 +4764,7 @@ void object_copy_data_t::decode(bufferlist::const_iterator& bl) decode(attrs, bl); decode(data, bl); { - map omap; + map omap; decode(omap, bl); omap_data.clear(); if (!omap.empty()) { @@ -4815,7 +4823,7 @@ void object_copy_data_t::generate_test_instances(list& o) list cursors; object_copy_cursor_t::generate_test_instances(cursors); - list::iterator ci = cursors.begin(); + auto ci = cursors.begin(); o.back()->cursor = **(ci++); o.push_back(new object_copy_data_t()); @@ -4824,18 +4832,18 @@ void object_copy_data_t::generate_test_instances(list& o) o.push_back(new object_copy_data_t()); o.back()->size = 1234; o.back()->mtime.set_from_double(1234); - bufferptr bp("there", 5); - bufferlist bl; + ceph::buffer::ptr bp("there", 5); + ceph::buffer::list bl; bl.push_back(bp); o.back()->attrs["hello"] = bl; - bufferptr bp2("not", 3); - bufferlist bl2; + ceph::buffer::ptr bp2("not", 3); + ceph::buffer::list bl2; bl2.push_back(bp2); - map omap; + map omap; omap["why"] = bl2; using ceph::encode; encode(omap, o.back()->omap_data); - bufferptr databp("iamsomedatatocontain", 20); + ceph::buffer::ptr databp("iamsomedatatocontain", 20); o.back()->data.push_back(databp); o.back()->omap_header.append("this is an omap header"); o.back()->snaps.push_back(123); @@ -4849,7 +4857,7 @@ void object_copy_data_t::dump(Formatter *f) const f->close_section(); // cursor f->dump_int("size", size); f->dump_stream("mtime") << mtime; - /* we should really print out the attrs here, but bufferlist + /* we should really print out the attrs here, but ceph::buffer::list const-correctness prevents that */ f->dump_int("attrs_size", attrs.size()); f->dump_int("flags", flags); @@ -4859,8 +4867,7 @@ void object_copy_data_t::dump(Formatter *f) const f->dump_int("omap_header_length", omap_header.length()); f->dump_int("data_length", data.length()); f->open_array_section("snaps"); - for (vector::const_iterator p = snaps.begin(); - p != snaps.end(); ++p) + for (auto p = snaps.cbegin(); p != snaps.cend(); ++p) f->dump_unsigned("snap", *p); f->close_section(); f->open_array_section("reqids"); @@ -4882,7 +4889,7 @@ void object_copy_data_t::dump(Formatter *f) const // -- pg_create_t -- -void pg_create_t::encode(bufferlist &bl) const +void pg_create_t::encode(ceph::buffer::list &bl) const { ENCODE_START(1, 1, bl); encode(created, bl); @@ -4891,7 +4898,7 @@ void pg_create_t::encode(bufferlist &bl) const ENCODE_FINISH(bl); } -void pg_create_t::decode(bufferlist::const_iterator &bl) +void pg_create_t::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(1, bl); decode(created, bl); @@ -4916,7 +4923,7 @@ void pg_create_t::generate_test_instances(list& o) // -- pg_hit_set_info_t -- -void pg_hit_set_info_t::encode(bufferlist& bl) const +void pg_hit_set_info_t::encode(ceph::buffer::list& bl) const { ENCODE_START(2, 1, bl); encode(begin, bl); @@ -4926,7 +4933,7 @@ void pg_hit_set_info_t::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void pg_hit_set_info_t::decode(bufferlist::const_iterator& p) +void pg_hit_set_info_t::decode(ceph::buffer::list::const_iterator& p) { DECODE_START(2, p); decode(begin, p); @@ -4959,7 +4966,7 @@ void pg_hit_set_info_t::generate_test_instances(list& ls) // -- pg_hit_set_history_t -- -void pg_hit_set_history_t::encode(bufferlist& bl) const +void pg_hit_set_history_t::encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(current_last_update, bl); @@ -4975,7 +4982,7 @@ void pg_hit_set_history_t::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void pg_hit_set_history_t::decode(bufferlist::const_iterator& p) +void pg_hit_set_history_t::decode(ceph::buffer::list::const_iterator& p) { DECODE_START(1, p); decode(current_last_update, p); @@ -4995,8 +5002,7 @@ void pg_hit_set_history_t::dump(Formatter *f) const { f->dump_stream("current_last_update") << current_last_update; f->open_array_section("history"); - for (list::const_iterator p = history.begin(); - p != history.end(); ++p) { + for (auto p = history.cbegin(); p != history.cend(); ++p) { f->open_object_section("info"); p->dump(f); f->close_section(); @@ -5014,7 +5020,7 @@ void pg_hit_set_history_t::generate_test_instances(list& // -- OSDSuperblock -- -void OSDSuperblock::encode(bufferlist &bl) const +void OSDSuperblock::encode(ceph::buffer::list &bl) const { ENCODE_START(8, 5, bl); encode(cluster_fsid, bl); @@ -5032,7 +5038,7 @@ void OSDSuperblock::encode(bufferlist &bl) const ENCODE_FINISH(bl); } -void OSDSuperblock::decode(bufferlist::const_iterator &bl) +void OSDSuperblock::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START_LEGACY_COMPAT_LEN(8, 5, 5, bl); if (struct_v < 3) { @@ -5099,7 +5105,7 @@ void OSDSuperblock::generate_test_instances(list& o) // -- SnapSet -- -void SnapSet::encode(bufferlist& bl) const +void SnapSet::encode(ceph::buffer::list& bl) const { ENCODE_START(3, 2, bl); encode(seq, bl); @@ -5112,7 +5118,7 @@ void SnapSet::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void SnapSet::decode(bufferlist::const_iterator& bl) +void SnapSet::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl); decode(seq, bl); @@ -5136,7 +5142,7 @@ void SnapSet::dump(Formatter *f) const sc.dump(f); f->close_section(); f->open_array_section("clones"); - for (vector::const_iterator p = clones.begin(); p != clones.end(); ++p) { + for (auto p = clones.cbegin(); p != clones.cend(); ++p) { f->open_object_section("clone"); f->dump_unsigned("snap", *p); auto cs = clone_size.find(*p); @@ -5197,16 +5203,13 @@ void SnapSet::from_snap_set(const librados::snap_set_t& ss, bool legacy) seq = ss.seq; set _snaps; set _clones; - for (vector::const_iterator p = ss.clones.begin(); - p != ss.clones.end(); - ++p) { + for (auto p = ss.clones.cbegin(); p != ss.clones.cend(); ++p) { if (p->cloneid != librados::SNAP_HEAD) { _clones.insert(p->cloneid); _snaps.insert(p->snaps.begin(), p->snaps.end()); clone_size[p->cloneid] = p->size; clone_overlap[p->cloneid]; // the entry must exist, even if it's empty. - for (vector >::const_iterator q = - p->overlap.begin(); q != p->overlap.end(); ++q) + for (auto q = p->overlap.cbegin(); q != p->overlap.cend(); ++q) clone_overlap[p->cloneid].insert(q->first, q->second); if (!legacy) { // p->snaps is ascending; clone_snaps is descending @@ -5221,13 +5224,13 @@ void SnapSet::from_snap_set(const librados::snap_set_t& ss, bool legacy) // ascending clones.clear(); clones.reserve(_clones.size()); - for (set::iterator p = _clones.begin(); p != _clones.end(); ++p) + for (auto p = _clones.begin(); p != _clones.end(); ++p) clones.push_back(*p); // descending snaps.clear(); snaps.reserve(_snaps.size()); - for (set::reverse_iterator p = _snaps.rbegin(); + for (auto p = _snaps.rbegin(); p != _snaps.rend(); ++p) snaps.push_back(*p); } @@ -5246,9 +5249,7 @@ void SnapSet::filter(const pg_pool_t &pinfo) { vector oldsnaps; oldsnaps.swap(snaps); - for (vector::const_iterator i = oldsnaps.begin(); - i != oldsnaps.end(); - ++i) { + for (auto i = oldsnaps.cbegin(); i != oldsnaps.cend(); ++i) { if (!pinfo.is_removed_snap(*i)) snaps.push_back(*i); } @@ -5263,7 +5264,7 @@ SnapSet SnapSet::get_filtered(const pg_pool_t &pinfo) const // -- watch_info_t -- -void watch_info_t::encode(bufferlist& bl, uint64_t features) const +void watch_info_t::encode(ceph::buffer::list& bl, uint64_t features) const { ENCODE_START(4, 3, bl); encode(cookie, bl); @@ -5272,7 +5273,7 @@ void watch_info_t::encode(bufferlist& bl, uint64_t features) const ENCODE_FINISH(bl); } -void watch_info_t::decode(bufferlist::const_iterator& bl) +void watch_info_t::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START_LEGACY_COMPAT_LEN(4, 3, 3, bl); decode(cookie, bl); @@ -5316,7 +5317,7 @@ void watch_info_t::generate_test_instances(list& o) // -- chunk_info_t -- -void chunk_info_t::encode(bufferlist& bl) const +void chunk_info_t::encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(offset, bl); @@ -5327,7 +5328,7 @@ void chunk_info_t::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void chunk_info_t::decode(bufferlist::const_iterator& bl) +void chunk_info_t::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(1, bl); decode(offset, bl); @@ -5357,7 +5358,7 @@ ostream& operator<<(ostream& out, const chunk_info_t& ci) // -- object_manifest_t -- -void object_manifest_t::encode(bufferlist& bl) const +void object_manifest_t::encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(type, bl); @@ -5367,7 +5368,7 @@ void object_manifest_t::encode(bufferlist& bl) const encode(redirect_target, bl); break; case TYPE_CHUNKED: - encode(chunk_map, bl); + encode(chunk_map, bl); break; default: ceph_abort(); @@ -5375,7 +5376,7 @@ void object_manifest_t::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void object_manifest_t::decode(bufferlist::const_iterator& bl) +void object_manifest_t::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(1, bl); decode(type, bl); @@ -5447,14 +5448,11 @@ void object_info_t::copy_user_bits(const object_info_t& other) omap_digest = other.omap_digest; } -void object_info_t::encode(bufferlist& bl, uint64_t features) const +void object_info_t::encode(ceph::buffer::list& bl, uint64_t features) const { object_locator_t myoloc(soid); map old_watchers; - for (map, watch_info_t>::const_iterator i = - watchers.begin(); - i != watchers.end(); - ++i) { + for (auto i = watchers.cbegin(); i != watchers.cend(); ++i) { old_watchers.insert(make_pair(i->first.second, i->second)); } ENCODE_START(17, 8, bl); @@ -5494,7 +5492,7 @@ void object_info_t::encode(bufferlist& bl, uint64_t features) const ENCODE_FINISH(bl); } -void object_info_t::decode(bufferlist::const_iterator& bl) +void object_info_t::decode(ceph::buffer::list::const_iterator& bl) { object_locator_t myoloc; DECODE_START_LEGACY_COMPAT_LEN(17, 8, 8, bl); @@ -5545,9 +5543,7 @@ void object_info_t::decode(bufferlist::const_iterator& bl) if (struct_v >= 11) { decode(watchers, bl); } else { - for (map::iterator i = old_watchers.begin(); - i != old_watchers.end(); - ++i) { + for (auto i = old_watchers.begin(); i != old_watchers.end(); ++i) { watchers.insert( make_pair( make_pair(i->second.cookie, i->first), i->second)); @@ -5615,8 +5611,7 @@ void object_info_t::dump(Formatter *f) const f->dump_unsigned("alloc_hint_flags", alloc_hint_flags); f->dump_object("manifest", manifest); f->open_object_section("watchers"); - for (map,watch_info_t>::const_iterator p = - watchers.begin(); p != watchers.end(); ++p) { + for (auto p = watchers.cbegin(); p != watchers.cend(); ++p) { stringstream ss; ss << p->first.second; f->open_object_section(ss.str().c_str()); @@ -5656,7 +5651,7 @@ ostream& operator<<(ostream& out, const object_info_t& oi) } // -- ObjectRecovery -- -void ObjectRecoveryProgress::encode(bufferlist &bl) const +void ObjectRecoveryProgress::encode(ceph::buffer::list &bl) const { ENCODE_START(1, 1, bl); encode(first, bl); @@ -5667,7 +5662,7 @@ void ObjectRecoveryProgress::encode(bufferlist &bl) const ENCODE_FINISH(bl); } -void ObjectRecoveryProgress::decode(bufferlist::const_iterator &bl) +void ObjectRecoveryProgress::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(1, bl); decode(first, bl); @@ -5720,7 +5715,7 @@ void ObjectRecoveryProgress::dump(Formatter *f) const f->dump_string("omap_recovered_to", omap_recovered_to); } -void ObjectRecoveryInfo::encode(bufferlist &bl, uint64_t features) const +void ObjectRecoveryInfo::encode(ceph::buffer::list &bl, uint64_t features) const { ENCODE_START(2, 1, bl); encode(soid, bl); @@ -5733,7 +5728,7 @@ void ObjectRecoveryInfo::encode(bufferlist &bl, uint64_t features) const ENCODE_FINISH(bl); } -void ObjectRecoveryInfo::decode(bufferlist::const_iterator &bl, +void ObjectRecoveryInfo::decode(ceph::buffer::list::const_iterator &bl, int64_t pool) { DECODE_START(2, bl); @@ -5751,9 +5746,7 @@ void ObjectRecoveryInfo::decode(bufferlist::const_iterator &bl, soid.pool = pool; map> tmp; tmp.swap(clone_subset); - for (map>::iterator i = tmp.begin(); - i != tmp.end(); - ++i) { + for (auto i = tmp.begin(); i != tmp.end(); ++i) { hobject_t first(i->first); if (!first.is_max() && first.pool == -1) first.pool = pool; @@ -5817,14 +5810,14 @@ void PushReplyOp::generate_test_instances(list &o) o.back()->soid = hobject_t(sobject_t("asdf", CEPH_NOSNAP)); } -void PushReplyOp::encode(bufferlist &bl) const +void PushReplyOp::encode(ceph::buffer::list &bl) const { ENCODE_START(1, 1, bl); encode(soid, bl); ENCODE_FINISH(bl); } -void PushReplyOp::decode(bufferlist::const_iterator &bl) +void PushReplyOp::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(1, bl); decode(soid, bl); @@ -5867,7 +5860,7 @@ void PullOp::generate_test_instances(list &o) o.back()->recovery_info.version = eversion_t(0, 0); } -void PullOp::encode(bufferlist &bl, uint64_t features) const +void PullOp::encode(ceph::buffer::list &bl, uint64_t features) const { ENCODE_START(1, 1, bl); encode(soid, bl); @@ -5876,7 +5869,7 @@ void PullOp::encode(bufferlist &bl, uint64_t features) const ENCODE_FINISH(bl); } -void PullOp::decode(bufferlist::const_iterator &bl) +void PullOp::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(1, bl); decode(soid, bl); @@ -5932,7 +5925,7 @@ void PushOp::generate_test_instances(list &o) o.back()->version = eversion_t(0, 0); } -void PushOp::encode(bufferlist &bl, uint64_t features) const +void PushOp::encode(ceph::buffer::list &bl, uint64_t features) const { ENCODE_START(1, 1, bl); encode(soid, bl); @@ -5948,7 +5941,7 @@ void PushOp::encode(bufferlist &bl, uint64_t features) const ENCODE_FINISH(bl); } -void PushOp::decode(bufferlist::const_iterator &bl) +void PushOp::decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(1, bl); decode(soid, bl); @@ -6014,10 +6007,7 @@ ostream& operator<<(ostream& out, const PushOp &op) uint64_t PushOp::cost(CephContext *cct) const { uint64_t cost = data_included.size(); - for (map::const_iterator i = - omap_entries.begin(); - i != omap_entries.end(); - ++i) { + for (auto i = omap_entries.cbegin(); i != omap_entries.cend(); ++i) { cost += i->second.length(); } cost += cct->_conf->osd_push_per_object_cost; @@ -6031,11 +6021,9 @@ void ScrubMap::merge_incr(const ScrubMap &l) ceph_assert(valid_through == l.incr_since); valid_through = l.valid_through; - for (map::const_iterator p = l.objects.begin(); - p != l.objects.end(); - ++p){ + for (auto p = l.objects.cbegin(); p != l.objects.cend(); ++p){ if (p->second.negative) { - map::iterator q = objects.find(p->first); + auto q = objects.find(p->first); if (q != objects.end()) { objects.erase(q); } @@ -6045,19 +6033,19 @@ void ScrubMap::merge_incr(const ScrubMap &l) } } -void ScrubMap::encode(bufferlist& bl) const +void ScrubMap::encode(ceph::buffer::list& bl) const { ENCODE_START(3, 2, bl); encode(objects, bl); encode((__u32)0, bl); // used to be attrs; now deprecated - bufferlist old_logbl; // not used + ceph::buffer::list old_logbl; // not used encode(old_logbl, bl); encode(valid_through, bl); encode(incr_since, bl); ENCODE_FINISH(bl); } -void ScrubMap::decode(bufferlist::const_iterator& bl, int64_t pool) +void ScrubMap::decode(ceph::buffer::list::const_iterator& bl, int64_t pool) { DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl); decode(objects, bl); @@ -6065,7 +6053,7 @@ void ScrubMap::decode(bufferlist::const_iterator& bl, int64_t pool) map attrs; // deprecated decode(attrs, bl); } - bufferlist old_logbl; // not used + ceph::buffer::list old_logbl; // not used decode(old_logbl, bl); decode(valid_through, bl); decode(incr_since, bl); @@ -6075,9 +6063,7 @@ void ScrubMap::decode(bufferlist::const_iterator& bl, int64_t pool) if (struct_v < 3) { map tmp; tmp.swap(objects); - for (map::iterator i = tmp.begin(); - i != tmp.end(); - ++i) { + for (auto i = tmp.begin(); i != tmp.end(); ++i) { hobject_t first(i->first); if (!first.is_max() && first.pool == -1) first.pool = pool; @@ -6091,7 +6077,7 @@ void ScrubMap::dump(Formatter *f) const f->dump_stream("valid_through") << valid_through; f->dump_stream("incremental_since") << incr_since; f->open_array_section("objects"); - for (map::const_iterator p = objects.begin(); p != objects.end(); ++p) { + for (auto p = objects.cbegin(); p != objects.cend(); ++p) { f->open_object_section("object"); f->dump_string("name", p->first.oid.name); f->dump_unsigned("hash", p->first.get_hash()); @@ -6118,7 +6104,7 @@ void ScrubMap::generate_test_instances(list& o) // -- ScrubMap::object -- -void ScrubMap::object::encode(bufferlist& bl) const +void ScrubMap::object::encode(ceph::buffer::list& bl) const { bool compat_read_error = read_error || ec_hash_mismatch || ec_size_mismatch; ENCODE_START(10, 7, bl); @@ -6144,7 +6130,7 @@ void ScrubMap::object::encode(bufferlist& bl) const ENCODE_FINISH(bl); } -void ScrubMap::object::decode(bufferlist::const_iterator& bl) +void ScrubMap::object::decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(10, bl); decode(size, bl); @@ -6196,7 +6182,7 @@ void ScrubMap::object::dump(Formatter *f) const f->dump_int("size", size); f->dump_int("negative", negative); f->open_array_section("attrs"); - for (map::const_iterator p = attrs.begin(); p != attrs.end(); ++p) { + for (auto p = attrs.cbegin(); p != attrs.cend(); ++p) { f->open_object_section("attr"); f->dump_string("name", p->first); f->dump_int("length", p->second.length()); @@ -6212,8 +6198,8 @@ void ScrubMap::object::generate_test_instances(list& o) o.back()->negative = true; o.push_back(new object); o.back()->size = 123; - o.back()->attrs["foo"] = buffer::copy("foo", 3); - o.back()->attrs["bar"] = buffer::copy("barval", 6); + o.back()->attrs["foo"] = ceph::buffer::copy("foo", 3); + o.back()->attrs["bar"] = ceph::buffer::copy("barval", 6); } // -- OSDOp -- @@ -6316,9 +6302,9 @@ ostream& operator<<(ostream& out, const OSDOp& op) } -void OSDOp::split_osd_op_vector_in_data(vector& ops, bufferlist& in) +void OSDOp::split_osd_op_vector_in_data(vector& ops, ceph::buffer::list& in) { - bufferlist::iterator datap = in.begin(); + ceph::buffer::list::iterator datap = in.begin(); for (unsigned i = 0; i < ops.size(); i++) { if (ops[i].op.payload_len) { datap.copy(ops[i].op.payload_len, ops[i].indata); @@ -6326,7 +6312,7 @@ void OSDOp::split_osd_op_vector_in_data(vector& ops, bufferlist& in) } } -void OSDOp::merge_osd_op_vector_in_data(vector& ops, bufferlist& out) +void OSDOp::merge_osd_op_vector_in_data(vector& ops, ceph::buffer::list& out) { for (unsigned i = 0; i < ops.size(); i++) { if (ops[i].indata.length()) { @@ -6336,9 +6322,9 @@ void OSDOp::merge_osd_op_vector_in_data(vector& ops, bufferlist& out) } } -void OSDOp::split_osd_op_vector_out_data(vector& ops, bufferlist& in) +void OSDOp::split_osd_op_vector_out_data(vector& ops, ceph::buffer::list& in) { - bufferlist::iterator datap = in.begin(); + auto datap = in.begin(); for (unsigned i = 0; i < ops.size(); i++) { if (ops[i].op.payload_len) { datap.copy(ops[i].op.payload_len, ops[i].outdata); @@ -6346,7 +6332,7 @@ void OSDOp::split_osd_op_vector_out_data(vector& ops, bufferlist& in) } } -void OSDOp::merge_osd_op_vector_out_data(vector& ops, bufferlist& out) +void OSDOp::merge_osd_op_vector_out_data(vector& ops, ceph::buffer::list& out) { for (unsigned i = 0; i < ops.size(); i++) { if (ops[i].outdata.length()) { @@ -6364,8 +6350,8 @@ void OSDOp::clear_data(vector& ops) if (ceph_osd_op_type_attr(op.op.op) && op.op.xattr.name_len && op.indata.length() >= op.op.xattr.name_len) { - bufferptr bp(op.op.xattr.name_len); - bufferlist bl; + ceph::buffer::ptr bp(op.op.xattr.name_len); + ceph::buffer::list bl; bl.append(bp); bl.copy_in(0, op.op.xattr.name_len, op.indata); op.indata.claim(bl); @@ -6374,8 +6360,8 @@ void OSDOp::clear_data(vector& ops) op.indata.length() > (op.op.cls.class_len + op.op.cls.method_len)) { __u8 len = op.op.cls.class_len + op.op.cls.method_len; - bufferptr bp(len); - bufferlist bl; + ceph::buffer::ptr bp(len); + ceph::buffer::list bl; bl.append(bp); bl.copy_in(0, len, op.indata); op.indata.claim(bl); diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index e2cd7721ec9..70f46b454be 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -18,10 +18,12 @@ #ifndef CEPH_OSD_TYPES_H #define CEPH_OSD_TYPES_H +#include #include -#include +#include #include #include + #include #include #include @@ -45,7 +47,6 @@ #include "include/cmp.h" #include "librados/ListObjectImpl.h" #include "compressor/Compressor.h" -#include #define CEPH_OSD_ONDISK_MAGIC "ceph osd volume v026" @@ -103,22 +104,22 @@ typedef hobject_t collection_list_handle_t; -/// convert a single CPEH_OSD_FLAG_* to a string +/// convert a single CPEH_OSD_FLAG_* to a std::string const char *ceph_osd_flag_name(unsigned flag); -/// convert a single CEPH_OSD_OF_FLAG_* to a string +/// convert a single CEPH_OSD_OF_FLAG_* to a std::string const char *ceph_osd_op_flag_name(unsigned flag); -/// convert CEPH_OSD_FLAG_* op flags to a string -string ceph_osd_flag_string(unsigned flags); -/// conver CEPH_OSD_OP_FLAG_* op flags to a string -string ceph_osd_op_flag_string(unsigned flags); -/// conver CEPH_OSD_ALLOC_HINT_FLAG_* op flags to a string -string ceph_osd_alloc_hint_flag_string(unsigned flags); +/// convert CEPH_OSD_FLAG_* op flags to a std::string +std::string ceph_osd_flag_string(unsigned flags); +/// conver CEPH_OSD_OP_FLAG_* op flags to a std::string +std::string ceph_osd_op_flag_string(unsigned flags); +/// conver CEPH_OSD_ALLOC_HINT_FLAG_* op flags to a std::string +std::string ceph_osd_alloc_hint_flag_string(unsigned flags); -typedef map osd_alert_list_t; +typedef std::map osd_alert_list_t; /// map osd id -> alert_list_t -typedef map osd_alerts_t; -void dump(Formatter* f, const osd_alerts_t& alerts); +typedef std::map osd_alerts_t; +void dump(ceph::Formatter* f, const osd_alerts_t& alerts); /** * osd request identifier @@ -144,8 +145,8 @@ struct osd_reqid_t { denc(v.inc, p); DENC_FINISH(p); } - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_DENC(osd_reqid_t) @@ -161,10 +162,10 @@ struct pg_shard_t { bool is_undefined() const { return osd == -1; } - string get_osd() const { return (osd == NO_OSD ? "NONE" : to_string(osd)); } - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const { + std::string get_osd() const { return (osd == NO_OSD ? "NONE" : std::to_string(osd)); } + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const { f->dump_unsigned("osd", osd); if (shard != shard_id_t::NO_SHARD) { f->dump_unsigned("shard", shard); @@ -174,14 +175,14 @@ struct pg_shard_t { WRITE_CLASS_ENCODER(pg_shard_t) WRITE_EQ_OPERATORS_2(pg_shard_t, osd, shard) WRITE_CMP_OPERATORS_2(pg_shard_t, osd, shard) -ostream &operator<<(ostream &lhs, const pg_shard_t &rhs); +std::ostream& operator<<(std::ostream &lhs, const pg_shard_t &rhs); class IsPGRecoverablePredicate { public: /** * have encodes the shards available */ - virtual bool operator()(const set &have) const = 0; + virtual bool operator()(const std::set &have) const = 0; virtual ~IsPGRecoverablePredicate() {} }; @@ -190,11 +191,11 @@ public: /** * have encodes the shards available */ - virtual bool operator()(const set &have) const = 0; + virtual bool operator()(const std::set &have) const = 0; virtual ~IsPGReadablePredicate() {} }; -inline ostream& operator<<(ostream& out, const osd_reqid_t& r) { +inline std::ostream& operator<<(std::ostream& out, const osd_reqid_t& r) { return out << r.name << "." << r.inc << ":" << r.tid; } @@ -232,8 +233,8 @@ namespace std { struct object_locator_t { // You specify either the hash or the key -- not both int64_t pool; ///< pool id - string key; ///< key string (if non-empty) - string nspace; ///< namespace + std::string key; ///< key std::string (if non-empty) + std::string nspace; ///< namespace int64_t hash; ///< hash position (if >= 0) explicit object_locator_t() @@ -242,11 +243,11 @@ struct object_locator_t { : pool(po), hash(-1) {} explicit object_locator_t(int64_t po, int64_t ps) : pool(po), hash(ps) {} - explicit object_locator_t(int64_t po, string ns) + explicit object_locator_t(int64_t po, std::string ns) : pool(po), nspace(ns), hash(-1) {} - explicit object_locator_t(int64_t po, string ns, int64_t ps) + explicit object_locator_t(int64_t po, std::string ns, int64_t ps) : pool(po), nspace(ns), hash(ps) {} - explicit object_locator_t(int64_t po, string ns, string s) + explicit object_locator_t(int64_t po, std::string ns, std::string s) : pool(po), key(s), nspace(ns), hash(-1) {} explicit object_locator_t(const hobject_t& soid) : pool(soid.pool), key(soid.get_key()), nspace(soid.nspace), hash(-1) {} @@ -266,10 +267,10 @@ struct object_locator_t { return pool == -1; } - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& p); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& p); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(object_locator_t) @@ -280,7 +281,7 @@ inline bool operator!=(const object_locator_t& l, const object_locator_t& r) { return !(l == r); } -inline ostream& operator<<(ostream& out, const object_locator_t& loc) +inline std::ostream& operator<<(std::ostream& out, const object_locator_t& loc) { out << "@" << loc.pool; if (loc.nspace.length()) @@ -293,9 +294,9 @@ inline ostream& operator<<(ostream& out, const object_locator_t& loc) struct request_redirect_t { private: object_locator_t redirect_locator; ///< this is authoritative - string redirect_object; ///< If non-empty, the request goes to this object name + std::string redirect_object; ///< If non-empty, the request goes to this object name - friend ostream& operator<<(ostream& out, const request_redirect_t& redir); + friend std::ostream& operator<<(std::ostream& out, const request_redirect_t& redir); public: request_redirect_t() {} @@ -304,26 +305,26 @@ public: explicit request_redirect_t(const object_locator_t& rloc) : redirect_locator(rloc) {} explicit request_redirect_t(const object_locator_t& orig, - const string& robj) : + const std::string& robj) : redirect_locator(orig), redirect_object(robj) {} bool empty() const { return redirect_locator.empty() && redirect_object.empty(); } - void combine_with_locator(object_locator_t& orig, string& obj) const { + void combine_with_locator(object_locator_t& orig, std::string& obj) const { orig = redirect_locator; if (!redirect_object.empty()) obj = redirect_object; } - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(request_redirect_t) -inline ostream& operator<<(ostream& out, const request_redirect_t& redir) { +inline std::ostream& operator<<(std::ostream& out, const request_redirect_t& redir) { out << "object " << redir.redirect_object << ", locator{" << redir.redirect_locator << "}"; return out; } @@ -353,11 +354,11 @@ typedef uint32_t ps_t; // old (v1) pg_t encoding (wrap old struct ceph_pg) struct old_pg_t { ceph_pg v; - void encode(bufferlist& bl) const { - ::encode_raw(v, bl); + void encode(ceph::buffer::list& bl) const { + ceph::encode_raw(v, bl); } - void decode(bufferlist::const_iterator& bl) { - ::decode_raw(v, bl); + void decode(ceph::buffer::list::const_iterator& bl) { + ceph::decode_raw(v, bl); } }; WRITE_CLASS_ENCODER(old_pg_t) @@ -411,7 +412,7 @@ struct pg_t { int print(char *o, int maxlen) const; bool parse(const char *s); - bool is_split(unsigned old_pg_num, unsigned new_pg_num, set *pchildren) const; + bool is_split(unsigned old_pg_num, unsigned new_pg_num, std::set *pchildren) const; bool is_merge_source(unsigned old_pg_num, unsigned new_pg_num, pg_t *parent) const; bool is_merge_target(unsigned old_pg_num, unsigned new_pg_num) const { @@ -438,7 +439,7 @@ struct pg_t { hobject_t get_hobj_start() const; hobject_t get_hobj_end(unsigned pg_num) const; - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { using ceph::encode; __u8 v = 1; encode(v, bl); @@ -446,7 +447,7 @@ struct pg_t { encode(m_seed, bl); encode((int32_t)-1, bl); // was preferred } - void decode(bufferlist::const_iterator& bl) { + void decode(ceph::buffer::list::const_iterator& bl) { using ceph::decode; __u8 v; decode(v, bl); @@ -454,14 +455,14 @@ struct pg_t { decode(m_seed, bl); bl.advance(sizeof(int32_t)); // was preferred } - void decode_old(bufferlist::const_iterator& bl) { + void decode_old(ceph::buffer::list::const_iterator& bl) { using ceph::decode; old_pg_t opg; decode(opg, bl); *this = opg; } - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(pg_t) @@ -490,7 +491,7 @@ inline bool operator>=(const pg_t& l, const pg_t& r) { (l.pool() == r.pool() && (l.ps() >= r.ps())); } -ostream& operator<<(ostream& out, const pg_t &pg); +std::ostream& operator<<(std::ostream& out, const pg_t &pg); namespace std { template<> struct hash< pg_t > @@ -536,12 +537,12 @@ struct spg_t { } bool is_split(unsigned old_pg_num, unsigned new_pg_num, - set *pchildren) const { - set _children; - set *children = pchildren ? &_children : NULL; + std::set *pchildren) const { + std::set _children; + std::set *children = pchildren ? &_children : NULL; bool is_split = pgid.is_split(old_pg_num, new_pg_num, children); if (pchildren && is_split) { - for (set::iterator i = _children.begin(); + for (std::set::iterator i = _children.begin(); i != _children.end(); ++i) { pchildren->insert(spg_t(*i, shard)); @@ -570,20 +571,20 @@ struct spg_t { return ghobject_t::make_pgmeta(pgid.pool(), pgid.ps(), shard); } - void encode(bufferlist &bl) const { + void encode(ceph::buffer::list &bl) const { ENCODE_START(1, 1, bl); encode(pgid, bl); encode(shard, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& bl) { + void decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(1, bl); decode(pgid, bl); decode(shard, bl); DECODE_FINISH(bl); } - ghobject_t make_temp_ghobject(const string& name) const { + ghobject_t make_temp_ghobject(const std::string& name) const { return ghobject_t( hobject_t(object_t(name), "", CEPH_NOSNAP, pgid.ps(), @@ -612,7 +613,7 @@ namespace std { }; } // namespace std -ostream& operator<<(ostream& out, const spg_t &pg); +std::ostream& operator<<(std::ostream& out, const spg_t &pg); // ---------------------- @@ -672,7 +673,7 @@ public: } const std::string to_str() const { - return string(_str); + return std::string(_str); } const char *c_str() const { return _str; @@ -716,8 +717,8 @@ public: return false; } - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& bl); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& bl); size_t encoded_size() const; inline bool operator==(const coll_t& rhs) const { @@ -761,13 +762,13 @@ public: return 0; // whatever. } - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(coll_t) -inline ostream& operator<<(ostream& out, const coll_t& c) { +inline std::ostream& operator<<(std::ostream& out, const coll_t& c) { out << c.to_str(); return out; } @@ -776,7 +777,7 @@ namespace std { template<> struct hash { size_t operator()(const coll_t &c) const { size_t h = 0; - string str(c.to_str()); + std::string str(c.to_str()); std::string::const_iterator end(str.end()); for (std::string::const_iterator s = str.begin(); s != end; ++s) { h += *s; @@ -791,7 +792,7 @@ namespace std { }; } // namespace std -inline ostream& operator<<(ostream& out, const ceph_object_layout &ol) +inline std::ostream& operator<<(std::ostream& out, const ceph_object_layout &ol) { out << pg_t(ol.ol_pgid); int su = ol.ol_stripe_unit; @@ -821,7 +822,7 @@ public: epoch(ce.epoch), __pad(0) { } - explicit eversion_t(bufferlist& bl) : __pad(0) { decode(bl); } + explicit eversion_t(ceph::buffer::list& bl) : __pad(0) { decode(bl); } static const eversion_t& max() { static const eversion_t max(-1,-1); @@ -835,7 +836,7 @@ public: return c; } - string get_key_name() const; + std::string get_key_name() const; // key must point to the beginning of a block of 32 chars inline void get_key_name(char* key) const { @@ -846,7 +847,7 @@ public: ritoa(epoch, key + 10); } - void encode(bufferlist &bl) const { + void encode(ceph::buffer::list &bl) const { #if defined(CEPH_LITTLE_ENDIAN) bl.append((char *)this, sizeof(version_t) + sizeof(epoch_t)); #else @@ -855,7 +856,7 @@ public: encode(epoch, bl); #endif } - void decode(bufferlist::const_iterator &bl) { + void decode(ceph::buffer::list::const_iterator &bl) { #if defined(CEPH_LITTLE_ENDIAN) bl.copy(sizeof(version_t) + sizeof(epoch_t), (char *)this); #else @@ -864,7 +865,7 @@ public: decode(epoch, bl); #endif } - void decode(bufferlist& bl) { + void decode(ceph::buffer::list& bl) { auto p = std::cbegin(bl); decode(p); } @@ -889,7 +890,7 @@ inline bool operator>(const eversion_t& l, const eversion_t& r) { inline bool operator>=(const eversion_t& l, const eversion_t& r) { return (l.epoch == r.epoch) ? (l.version >= r.version):(l.epoch >= r.epoch); } -inline ostream& operator<<(ostream& out, const eversion_t& e) { +inline std::ostream& operator<<(std::ostream& out, const eversion_t& e) { return out << e.epoch << "'" << e.version; } @@ -919,9 +920,9 @@ struct objectstore_perf_stat_t { os_commit_latency_ns -= o.os_commit_latency_ns; os_apply_latency_ns -= o.os_apply_latency_ns; } - void dump(Formatter *f) const; - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::const_iterator &bl); + void dump(ceph::Formatter *f) const; + void encode(ceph::buffer::list &bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator &bl); static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER_FEATURES(objectstore_perf_stat_t) @@ -962,7 +963,7 @@ WRITE_CLASS_ENCODER_FEATURES(objectstore_perf_stat_t) #define PG_STATE_FORCED_BACKFILL (1ULL << 31) // force backfill of this pg before any other std::string pg_state_string(uint64_t state); -std::string pg_vector_string(const vector &a); +std::string pg_vector_string(const std::vector &a); boost::optional pg_string_state(const std::string& state); @@ -974,16 +975,16 @@ boost::optional pg_string_state(const std::string& state); struct pool_snap_info_t { snapid_t snapid; utime_t stamp; - string name; + std::string name; - void dump(Formatter *f) const; - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::const_iterator& bl); - static void generate_test_instances(list& o); + void dump(ceph::Formatter *f) const; + void encode(ceph::buffer::list& bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator& bl); + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER_FEATURES(pool_snap_info_t) -inline ostream& operator<<(ostream& out, const pool_snap_info_t& si) { +inline std::ostream& operator<<(std::ostream& out, const pool_snap_info_t& si) { return out << si.snapid << '(' << si.name << ' ' << si.stamp << ')'; } @@ -1063,17 +1064,17 @@ public: bool unset(key_t key); - void dump(const std::string& name, Formatter *f) const; + void dump(const std::string& name, ceph::Formatter *f) const; - void dump(Formatter *f) const; - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::const_iterator &bl); + void dump(ceph::Formatter *f) const; + void encode(ceph::buffer::list &bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator &bl); private: typedef std::map opts_t; opts_t opts; - friend ostream& operator<<(ostream& out, const pool_opts_t& opts); + friend std::ostream& operator<<(std::ostream& out, const pool_opts_t& opts); }; WRITE_CLASS_ENCODER_FEATURES(pool_opts_t) @@ -1085,7 +1086,7 @@ struct pg_merge_meta_t { eversion_t source_version; eversion_t target_version; - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(source_pgid, bl); encode(ready_epoch, bl); @@ -1095,7 +1096,7 @@ struct pg_merge_meta_t { encode(target_version, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& p) { + void decode(ceph::buffer::list::const_iterator& p) { DECODE_START(1, p); decode(source_pgid, p); decode(ready_epoch, p); @@ -1105,7 +1106,7 @@ struct pg_merge_meta_t { decode(target_version, p); DECODE_FINISH(p); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->dump_stream("source_pgid") << source_pgid; f->dump_unsigned("ready_epoch", ready_epoch); f->dump_unsigned("last_epoch_started", last_epoch_started); @@ -1181,8 +1182,8 @@ struct pg_pool_t { default: return "???"; } } - static string get_flags_string(uint64_t f) { - string s; + static std::string get_flags_string(uint64_t f) { + std::string s; for (unsigned n=0; f && n<64; ++n) { if (f & (1ull << n)) { if (s.length()) @@ -1192,10 +1193,10 @@ struct pg_pool_t { } return s; } - string get_flags_string() const { + std::string get_flags_string() const { return get_flags_string(flags); } - static uint64_t get_flag_by_name(const string& name) { + static uint64_t get_flag_by_name(const std::string& name) { if (name == "hashpspool") return FLAG_HASHPSPOOL; if (name == "full") @@ -1232,7 +1233,7 @@ struct pg_pool_t { } /// converts the acting/up vector to a set of pg shards - void convert_to_pg_shards(const vector &from, set* to) const; + void convert_to_pg_shards(const std::vector &from, std::set* to) const; typedef enum { CACHEMODE_NONE = 0, ///< no caching @@ -1255,7 +1256,7 @@ struct pg_pool_t { default: return "unknown"; } } - static cache_mode_t get_cache_mode_from_str(const string& s) { + static cache_mode_t get_cache_mode_from_str(const std::string& s) { if (s == "none") return CACHEMODE_NONE; if (s == "writeback") @@ -1304,7 +1305,7 @@ struct pg_pool_t { default: return "???"; } } - static int get_pg_autoscale_mode_by_name(const string& m) { + static int get_pg_autoscale_mode_by_name(const std::string& m) { if (m == "off") { return PG_AUTOSCALE_MODE_OFF; } @@ -1331,8 +1332,8 @@ private: __u32 pgp_num_target = 0; ///< pgp_num we should converge toward public: - map properties; ///< OBSOLETE - string erasure_code_profile; ///< name of the erasure code profile in OSDMap + std::map properties; ///< OBSOLETE + std::string erasure_code_profile; ///< name of the erasure code profile in OSDMap epoch_t last_change; ///< most recent epoch changed, exclusing snapshot changes /// last epoch that forced clients to resend @@ -1357,7 +1358,7 @@ public: * the pool, unless the client manually specifies an alternate * context. */ - map snaps; + std::map snaps; /* * Alternatively, if we are defining non-pool snaps (e.g. via the * Ceph MDS), we must track @removed_snaps (since @snaps is not @@ -1368,7 +1369,7 @@ public: unsigned pg_num_mask, pgp_num_mask; - set tiers; ///< pools that are tiers of us + std::set tiers; ///< pools that are tiers of us int64_t tier_of; ///< pool for which we are a tier // Note that write wins for read+write ops int64_t read_tier; ///< pool/tier for objecter to direct reads to @@ -1438,7 +1439,7 @@ public: TYPE_FINGERPRINT_NONE = 0, TYPE_FINGERPRINT_SHA1 = 1, } fingerprint_t; - static fingerprint_t get_fingerprint_from_str(const string& s) { + static fingerprint_t get_fingerprint_from_str(const std::string& s) { if (s == "none") return TYPE_FINGERPRINT_NONE; if (s == "sha1") @@ -1446,12 +1447,12 @@ public: return (fingerprint_t)-1; } const fingerprint_t get_fingerprint_type() const { - string fp_str; + std::string fp_str; opts.get(pool_opts_t::FINGERPRINT_ALGORITHM, &fp_str); return get_fingerprint_from_str(fp_str); } const char *get_fingerprint_name() const { - string fp_str; + std::string fp_str; fingerprint_t fp_t; opts.get(pool_opts_t::FINGERPRINT_ALGORITHM, &fp_str); fp_t = get_fingerprint_from_str(fp_str); @@ -1466,10 +1467,10 @@ public: } /// application -> key/value metadata - map> application_metadata; + std::map> application_metadata; private: - vector grade_table; + std::vector grade_table; public: uint32_t get_grade(unsigned i) const { @@ -1516,7 +1517,7 @@ public: opts() { } - void dump(Formatter *f) const; + void dump(ceph::Formatter *f) const; const utime_t &get_create_time() const { return create_time; } uint64_t get_flags() const { return flags; } @@ -1688,7 +1689,7 @@ public: SnapContext get_snap_context() const; /// hash a object name+namespace key to a hash position - uint32_t hash_key(const string& key, const string& ns) const; + uint32_t hash_key(const std::string& key, const std::string& ns) const; /// round a hash position down to a pg num uint32_t raw_hash_to_pg(uint32_t v) const; @@ -1708,14 +1709,14 @@ public: /// choose a random hash position within a pg uint32_t get_random_pg_position(pg_t pgid, uint32_t seed) const; - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::const_iterator& bl); + void encode(ceph::buffer::list& bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator& bl); - static void generate_test_instances(list& o); + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER_FEATURES(pg_pool_t) -ostream& operator<<(ostream& out, const pg_pool_t& p); +std::ostream& operator<<(std::ostream& out, const pg_pool_t& p); /** @@ -1847,7 +1848,7 @@ struct object_stat_sum_t { #undef FLOOR } - void split(vector &out) const { + void split(std::vector &out) const { #define SPLIT(PARAM) \ for (unsigned i = 0; i < out.size(); ++i) { \ out[i].PARAM = PARAM / out.size(); \ @@ -1924,7 +1925,7 @@ struct object_stat_sum_t { void add(const object_stat_sum_t& o); void sub(const object_stat_sum_t& o); - void dump(Formatter *f) const; + void dump(ceph::Formatter *f) const; void padding_check() { static_assert( sizeof(object_stat_sum_t) == @@ -1970,9 +1971,9 @@ struct object_stat_sum_t { , "object_stat_sum_t have padding"); } - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& bl); - static void generate_test_instances(list& o); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& bl); + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(object_stat_sum_t) @@ -1993,10 +1994,10 @@ struct object_stat_collection_t { sum.calc_copies(nrep); } - void dump(Formatter *f) const; - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& bl); - static void generate_test_instances(list& o); + void dump(ceph::Formatter *f) const; + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& bl); + static void generate_test_instances(std::list& o); bool is_zero() const { return sum.is_zero(); @@ -2068,10 +2069,10 @@ struct pg_stat_t { int64_t log_size; int64_t ondisk_log_size; // >= active_log_size - vector up, acting; + std::vector up, acting; epoch_t mapping_epoch; - vector blocked_by; ///< osds on which the pg is blocked + std::vector blocked_by; ///< osds on which the pg is blocked interval_set purged_snaps; ///< recently removed snaps that we've purged @@ -2126,8 +2127,8 @@ struct pg_stat_t { } } - pair get_version_pair() const { - return make_pair(reported_epoch, reported_seq); + std::pair get_version_pair() const { + return { reported_epoch, reported_seq }; } void floor(int64_t f) { @@ -2169,11 +2170,11 @@ struct pg_stat_t { } bool is_acting_osd(int32_t osd, bool primary) const; - void dump(Formatter *f) const; - void dump_brief(Formatter *f) const; - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - static void generate_test_instances(list& o); + void dump(ceph::Formatter *f) const; + void dump_brief(ceph::Formatter *f) const; + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(pg_stat_t) @@ -2288,7 +2289,7 @@ struct store_statfs_t omap_allocated -= o.omap_allocated; internal_metadata -= o.internal_metadata; } - void dump(Formatter *f) const; + void dump(ceph::Formatter *f) const; DENC(store_statfs_t, v, p) { DENC_START(1, 1, p); denc(v.total, p); @@ -2303,18 +2304,18 @@ struct store_statfs_t denc(v.internal_metadata, p); DENC_FINISH(p); } - static void generate_test_instances(list& o); + static void generate_test_instances(std::list& o); }; WRITE_CLASS_DENC(store_statfs_t) -ostream &operator<<(ostream &lhs, const store_statfs_t &rhs); +std::ostream &operator<<(std::ostream &lhs, const store_statfs_t &rhs); /** osd_stat * aggregate stats for an osd */ struct osd_stat_t { store_statfs_t statfs; - vector hb_peers; + std::vector hb_peers; int32_t snap_trim_queue_len, num_snap_trimming; pow2_hist_t op_queue_age_hist; @@ -2360,9 +2361,9 @@ struct osd_stat_t { } } } - void dump(Formatter *f) const; - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::const_iterator &bl); + void dump(ceph::Formatter *f) const; + void encode(ceph::buffer::list &bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator &bl); static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER_FEATURES(osd_stat_t) @@ -2380,7 +2381,7 @@ inline bool operator!=(const osd_stat_t& l, const osd_stat_t& r) { return !(l == r); } -inline ostream& operator<<(ostream& out, const osd_stat_t& s) { +inline std::ostream& operator<<(std::ostream& out, const osd_stat_t& s) { return out << "osd_stat(" << s.statfs << ", " << "peers " << s.hb_peers << " op hist " << s.op_queue_age_hist.h @@ -2485,10 +2486,10 @@ struct pool_stat_t { return user_bytes; } - void dump(Formatter *f) const; - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::const_iterator &bl); - static void generate_test_instances(list& o); + void dump(ceph::Formatter *f) const; + void encode(ceph::buffer::list &bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator &bl); + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER_FEATURES(pool_stat_t) @@ -2518,10 +2519,10 @@ struct pg_hit_set_info_t { explicit pg_hit_set_info_t(bool using_gmt = true) : using_gmt(using_gmt) {} - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(pg_hit_set_info_t) @@ -2533,7 +2534,7 @@ WRITE_CLASS_ENCODER(pg_hit_set_info_t) */ struct pg_hit_set_history_t { eversion_t current_last_update; ///< last version inserted into current set - list history; ///< archived sets, sorted oldest -> newest + std::list history; ///< archived sets, sorted oldest -> newest friend bool operator==(const pg_hit_set_history_t& l, const pg_hit_set_history_t& r) { @@ -2542,10 +2543,10 @@ struct pg_hit_set_history_t { l.history == r.history; } - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(pg_hit_set_history_t) @@ -2678,14 +2679,14 @@ struct pg_history_t { return modified; } - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& p); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& p); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(pg_history_t) -inline ostream& operator<<(ostream& out, const pg_history_t& h) { +inline std::ostream& operator<<(std::ostream& out, const pg_history_t& h) { return out << "ec=" << h.epoch_created << "/" << h.epoch_pool_created << " lis/c " << h.last_interval_started << "/" << h.last_interval_clean @@ -2772,14 +2773,14 @@ struct pg_info_t { bool has_missing() const { return last_complete != last_update; } bool is_incomplete() const { return !last_backfill.is_max(); } - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& p); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& p); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(pg_info_t) -inline ostream& operator<<(ostream& out, const pg_info_t& pgi) +inline std::ostream& operator<<(std::ostream& out, const pg_info_t& pgi) { out << pgi.pgid << "("; if (pgi.dne()) @@ -2896,7 +2897,7 @@ struct pg_fast_info_t { return true; } - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(last_update, bl); encode(last_complete, bl); @@ -2921,7 +2922,7 @@ struct pg_fast_info_t { encode(stats.stats.sum.num_objects_dirty, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& p) { + void decode(ceph::buffer::list::const_iterator& p) { DECODE_START(1, p); decode(last_update, p); decode(last_complete, p); @@ -2970,13 +2971,13 @@ struct pg_notify_t { info(info), to(to), from(from) { ceph_assert(from == info.pgid.shard); } - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &p); - void dump(Formatter *f) const; - static void generate_test_instances(list &o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &p); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list &o); }; WRITE_CLASS_ENCODER(pg_notify_t) -ostream &operator<<(ostream &lhs, const pg_notify_t ¬ify); +std::ostream &operator<<(std::ostream &lhs, const pg_notify_t ¬ify); class OSDMap; @@ -2987,7 +2988,7 @@ class OSDMap; class PastIntervals { public: struct pg_interval_t { - vector up, acting; + std::vector up, acting; epoch_t first, last; bool maybe_went_rw; int32_t primary; @@ -3001,8 +3002,8 @@ public: {} pg_interval_t( - vector &&up, - vector &&acting, + std::vector &&up, + std::vector &&acting, epoch_t first, epoch_t last, bool maybe_went_rw, @@ -3012,10 +3013,10 @@ public: maybe_went_rw(maybe_went_rw), primary(primary), up_primary(up_primary) {} - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; PastIntervals(); @@ -3030,18 +3031,18 @@ public: virtual size_t size() const = 0; virtual bool empty() const = 0; virtual void clear() = 0; - virtual pair get_bounds() const = 0; - virtual set get_all_participants( + virtual std::pair get_bounds() const = 0; + virtual std::set get_all_participants( bool ec_pool) const = 0; virtual void add_interval(bool ec_pool, const pg_interval_t &interval) = 0; - virtual unique_ptr clone() const = 0; - virtual ostream &print(ostream &out) const = 0; - virtual void encode(bufferlist &bl) const = 0; - virtual void decode(bufferlist::const_iterator &bl) = 0; - virtual void dump(Formatter *f) const = 0; + virtual std::unique_ptr clone() const = 0; + virtual std::ostream &print(std::ostream &out) const = 0; + virtual void encode(ceph::buffer::list &bl) const = 0; + virtual void decode(ceph::buffer::list::const_iterator &bl) = 0; + virtual void dump(ceph::Formatter *f) const = 0; virtual void iterate_mayberw_back_to( epoch_t les, - std::function &)> &&f) const = 0; + std::function &)> &&f) const = 0; virtual bool has_full_intervals() const { return false; } virtual void iterate_all_intervals( @@ -3056,7 +3057,7 @@ public: friend class pi_compact_rep; private: - unique_ptr past_intervals; + std::unique_ptr past_intervals; explicit PastIntervals(interval_rep *rep) : past_intervals(rep) {} @@ -3066,7 +3067,7 @@ public: return past_intervals->add_interval(ec_pool, interval); } - void encode(bufferlist &bl) const { + void encode(ceph::buffer::list &bl) const { ENCODE_START(1, 1, bl); if (past_intervals) { __u8 type = 2; @@ -3078,13 +3079,13 @@ public: ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator &bl); + void decode(ceph::buffer::list::const_iterator &bl); - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { ceph_assert(past_intervals); past_intervals->dump(f); } - static void generate_test_instances(list & o); + static void generate_test_instances(std::list & o); /** * Determines whether there is an interval change @@ -3092,12 +3093,12 @@ public: static bool is_new_interval( int old_acting_primary, int new_acting_primary, - const vector &old_acting, - const vector &new_acting, + const std::vector &old_acting, + const std::vector &new_acting, int old_up_primary, int new_up_primary, - const vector &old_up, - const vector &new_up, + const std::vector &old_up, + const std::vector &new_up, int old_size, int new_size, int old_min_size, @@ -3119,12 +3120,12 @@ public: static bool is_new_interval( int old_acting_primary, ///< [in] primary as of lastmap int new_acting_primary, ///< [in] primary as of lastmap - const vector &old_acting, ///< [in] acting as of lastmap - const vector &new_acting, ///< [in] acting as of osdmap + const std::vector &old_acting, ///< [in] acting as of lastmap + const std::vector &new_acting, ///< [in] acting as of osdmap int old_up_primary, ///< [in] up primary of lastmap int new_up_primary, ///< [in] up primary of osdmap - const vector &old_up, ///< [in] up as of lastmap - const vector &new_up, ///< [in] up as of osdmap + const std::vector &old_up, ///< [in] up as of lastmap + const std::vector &new_up, ///< [in] up as of osdmap std::shared_ptr osdmap, ///< [in] current map std::shared_ptr lastmap, ///< [in] last map pg_t pgid ///< [in] pgid for pg @@ -3137,12 +3138,12 @@ public: static bool check_new_interval( int old_acting_primary, ///< [in] primary as of lastmap int new_acting_primary, ///< [in] primary as of osdmap - const vector &old_acting, ///< [in] acting as of lastmap - const vector &new_acting, ///< [in] acting as of osdmap + const std::vector &old_acting, ///< [in] acting as of lastmap + const std::vector &new_acting, ///< [in] acting as of osdmap int old_up_primary, ///< [in] up primary of lastmap int new_up_primary, ///< [in] up primary of osdmap - const vector &old_up, ///< [in] up as of lastmap - const vector &new_up, ///< [in] up as of osdmap + const std::vector &old_up, ///< [in] up as of lastmap + const std::vector &new_up, ///< [in] up as of osdmap epoch_t same_interval_since, ///< [in] as of osdmap epoch_t last_epoch_clean, ///< [in] current std::shared_ptr osdmap, ///< [in] current map @@ -3150,10 +3151,10 @@ public: pg_t pgid, ///< [in] pgid for pg IsPGRecoverablePredicate *could_have_gone_active, ///< [in] predicate whether the pg can be active PastIntervals *past_intervals, ///< [out] intervals - ostream *out = 0 ///< [out] debug ostream + std::ostream *out = 0 ///< [out] debug ostream ); - friend ostream& operator<<(ostream& out, const PastIntervals &i); + friend std::ostream& operator<<(std::ostream& out, const PastIntervals &i); template void iterate_mayberw_back_to( @@ -3190,7 +3191,7 @@ public: * Return all shards which have been in the acting set back to the * latest epoch to which we have trimmed except for pg_whoami */ - set get_might_have_unfound( + std::set get_might_have_unfound( pg_shard_t pg_whoami, bool ec_pool) const { ceph_assert(past_intervals); @@ -3202,7 +3203,7 @@ public: /** * Return all shards which we might want to talk to for peering */ - set get_all_probe( + std::set get_all_probe( bool ec_pool) const { ceph_assert(past_intervals); return past_intervals->get_all_participants(ec_pool); @@ -3211,7 +3212,7 @@ public: /* Return the set of epochs [start, end) represented by the * past_interval set. */ - pair get_bounds() const { + std::pair get_bounds() const { ceph_assert(past_intervals); return past_intervals->get_bounds(); } @@ -3229,12 +3230,12 @@ public: }; struct PriorSet { bool ec_pool = false; - set probe; ///< current+prior OSDs we need to probe. - set down; ///< down osds that would normally be in @a probe and might be interesting. - map blocked_by; ///< current lost_at values for any OSDs in cur set for which (re)marking them lost would affect cur set + std::set probe; ///< current+prior OSDs we need to probe. + std::set down; ///< down osds that would normally be in @a probe and might be interesting. + std::map blocked_by; ///< current lost_at values for any OSDs in cur set for which (re)marking them lost would affect cur set bool pg_down = false; ///< some down osds are included in @a cur; the DOWN pg state bit should be set. - unique_ptr pcontdec; + std::unique_ptr pcontdec; PriorSet() = default; PriorSet(PriorSet &&) = default; @@ -3258,9 +3259,9 @@ public: // For verifying tests PriorSet( bool ec_pool, - set probe, - set down, - map blocked_by, + std::set probe, + std::set down, + std::map blocked_by, bool pg_down, IsPGRecoverablePredicate *pcontdec) : ec_pool(ec_pool), probe(probe), down(down), blocked_by(blocked_by), @@ -3274,8 +3275,8 @@ public: epoch_t last_epoch_started, IsPGRecoverablePredicate *c, F f, - const vector &up, - const vector &acting, + const std::vector &up, + const std::vector &acting, const DoutPrefixProvider *dpp); friend class PastIntervals; @@ -3288,9 +3289,9 @@ public: }; WRITE_CLASS_ENCODER(PastIntervals) -ostream& operator<<(ostream& out, const PastIntervals::pg_interval_t& i); -ostream& operator<<(ostream& out, const PastIntervals &i); -ostream& operator<<(ostream& out, const PastIntervals::PriorSet &i); +std::ostream& operator<<(std::ostream& out, const PastIntervals::pg_interval_t& i); +std::ostream& operator<<(std::ostream& out, const PastIntervals &i); +std::ostream& operator<<(std::ostream& out, const PastIntervals::PriorSet &i); template PastIntervals::PriorSet::PriorSet( @@ -3299,8 +3300,8 @@ PastIntervals::PriorSet::PriorSet( epoch_t last_epoch_started, IsPGRecoverablePredicate *c, F f, - const vector &up, - const vector &acting, + const std::vector &up, + const std::vector &acting, const DoutPrefixProvider *dpp) : ec_pool(ec_pool), pg_down(false), pcontdec(c) { @@ -3362,7 +3363,7 @@ PastIntervals::PriorSet::PriorSet( probe.insert(pg_shard_t(up[i], ec_pool ? shard_id_t(i) : shard_id_t::NO_SHARD)); } - set all_probe = past_intervals.get_all_probe(ec_pool); + std::set all_probe = past_intervals.get_all_probe(ec_pool); ldpp_dout(dpp, 10) << "build_prior all_probe " << all_probe << dendl; for (auto &&i: all_probe) { switch (f(0, i.osd, nullptr)) { @@ -3381,15 +3382,15 @@ PastIntervals::PriorSet::PriorSet( past_intervals.iterate_mayberw_back_to( last_epoch_started, - [&](epoch_t start, const set &acting) { + [&](epoch_t start, const std::set &acting) { ldpp_dout(dpp, 10) << "build_prior maybe_rw interval:" << start << ", acting: " << acting << dendl; // look at candidate osds during this interval. each falls into // one of three categories: up, down (but potentially // interesting), or lost (down, but we won't wait for it). - set up_now; - map candidate_blocked_by; + std::set up_now; + std::map candidate_blocked_by; // any candidates down now (that might have useful data) bool any_down_now = false; @@ -3500,15 +3501,15 @@ struct pg_query_t { ceph_assert(t == LOG); } - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::const_iterator &bl); + void encode(ceph::buffer::list &bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator &bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER_FEATURES(pg_query_t) -inline ostream& operator<<(ostream& out, const pg_query_t& q) { +inline std::ostream& operator<<(std::ostream& out, const pg_query_t& q) { out << "query(" << q.get_type_name() << " " << q.since; if (q.type == pg_query_t::LOG) out << " " << q.history; @@ -3528,7 +3529,7 @@ public: class Visitor { public: virtual void append(uint64_t old_offset) {} - virtual void setattrs(map > &attrs) {} + virtual void setattrs(std::map> &attrs) {} virtual void rmobject(version_t old_version) {} /** * Used to support the unfound_lost_delete log event: if the stashed @@ -3540,14 +3541,14 @@ public: rmobject(old_version); } virtual void create() {} - virtual void update_snaps(const set &old_snaps) {} + virtual void update_snaps(const std::set &old_snaps) {} virtual void rollback_extents( version_t gen, - const vector > &extents) {} + const std::vector > &extents) {} virtual ~Visitor() {} }; void visit(Visitor *visitor) const; - mutable bufferlist bl; + mutable ceph::buffer::list bl; enum ModID { APPEND = 1, SETATTRS = 2, @@ -3597,7 +3598,7 @@ public: encode(old_size, bl); ENCODE_FINISH(bl); } - void setattrs(map > &old_attrs) { + void setattrs(std::map> &old_attrs) { if (!can_local_rollback || rollback_info_completed) return; ENCODE_START(1, 1, bl); @@ -3633,7 +3634,7 @@ public: append_id(CREATE); ENCODE_FINISH(bl); } - void update_snaps(const set &old_snaps) { + void update_snaps(const std::set &old_snaps) { if (!can_local_rollback || rollback_info_completed) return; ENCODE_START(1, 1, bl); @@ -3642,7 +3643,7 @@ public: ENCODE_FINISH(bl); } void rollback_extents( - version_t gen, const vector > &extents) { + version_t gen, const std::vector > &extents) { ceph_assert(can_local_rollback); ceph_assert(!rollback_info_completed); if (max_required_version < 2) @@ -3679,10 +3680,10 @@ public: if (bl.length() > 0) bl.rebuild(); } - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(ObjectModDesc) @@ -3734,10 +3735,10 @@ struct pg_log_entry_t { // describes state for a locally-rollbackable entry ObjectModDesc mod_desc; - bufferlist snaps; // only for clone entries + ceph::buffer::list snaps; // only for clone entries hobject_t soid; osd_reqid_t reqid; // caller+tid to uniquely identify request - mempool::osd_pglog::vector > extra_reqids; + mempool::osd_pglog::vector > extra_reqids; /// map extra_reqids by index to error return code (if any) mempool::osd_pglog::map extra_reqid_return_codes; @@ -3810,19 +3811,19 @@ struct pg_log_entry_t { (op == MODIFY || op == DELETE || op == ERROR); } - string get_key_name() const; - void encode_with_checksum(bufferlist& bl) const; - void decode_with_checksum(bufferlist::const_iterator& p); + std::string get_key_name() const; + void encode_with_checksum(ceph::buffer::list& bl) const; + void decode_with_checksum(ceph::buffer::list::const_iterator& p); - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(pg_log_entry_t) -ostream& operator<<(ostream& out, const pg_log_entry_t& e); +std::ostream& operator<<(std::ostream& out, const pg_log_entry_t& e); struct pg_log_dup_t { osd_reqid_t reqid; // caller+tid to uniquely identify request @@ -3843,11 +3844,11 @@ struct pg_log_dup_t { return_code(return_code) {} - string get_key_name() const; - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + std::string get_key_name() const; + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); bool operator==(const pg_log_dup_t &rhs) const { return reqid == rhs.reqid && @@ -4006,11 +4007,11 @@ public: return divergent; } - void merge_from(const vector& slogs, eversion_t last_update) { + void merge_from(const std::vector& slogs, eversion_t last_update) { log.clear(); // sort and merge dups - multimap sorted; + std::multimap sorted; for (auto& d : dups) { sorted.emplace(d.version, d); } @@ -4043,7 +4044,7 @@ public: } static void filter_log(spg_t import_pgid, const OSDMap &curmap, - const string &hit_set_namespace, const pg_log_t &in, + const std::string &hit_set_namespace, const pg_log_t &in, pg_log_t &out, pg_log_t &reject); /** @@ -4071,16 +4072,16 @@ public: */ void copy_up_to(const pg_log_t &other, int max); - ostream& print(ostream& out) const; + std::ostream& print(std::ostream& out) const; - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl, int64_t pool = -1); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl, int64_t pool = -1); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(pg_log_t) -inline ostream& operator<<(ostream& out, const pg_log_t& log) +inline std::ostream& operator<<(std::ostream& out, const pg_log_t& log) { out << "log((" << log.tail << "," << log.head << "], crt=" << log.get_can_rollback_to() << ")"; @@ -4106,7 +4107,7 @@ struct pg_missing_item { set_delete(is_delete); } - void encode(bufferlist& bl, uint64_t features) const { + void encode(ceph::buffer::list& bl, uint64_t features) const { using ceph::encode; if (HAVE_FEATURE(features, OSD_RECOVERY_DELETES)) { // encoding a zeroed eversion_t to differentiate between this and @@ -4124,7 +4125,7 @@ struct pg_missing_item { encode(have, bl); } } - void decode(bufferlist::const_iterator& bl) { + void decode(ceph::buffer::list::const_iterator& bl) { using ceph::decode; eversion_t e; decode(e, bl); @@ -4149,7 +4150,7 @@ struct pg_missing_item { return (flags & FLAG_DELETE) == FLAG_DELETE; } - string flag_str() const { + std::string flag_str() const { if (flags == FLAG_NONE) { return "none"; } else { @@ -4157,12 +4158,12 @@ struct pg_missing_item { } } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->dump_stream("need") << need; f->dump_stream("have") << have; f->dump_stream("flags") << flag_str(); } - static void generate_test_instances(list& o) { + static void generate_test_instances(std::list& o) { o.push_back(new pg_missing_item); o.push_back(new pg_missing_item); o.back()->need = eversion_t(1, 2); @@ -4180,13 +4181,13 @@ struct pg_missing_item { } }; WRITE_CLASS_ENCODER_FEATURES(pg_missing_item) -ostream& operator<<(ostream& out, const pg_missing_item &item); +std::ostream& operator<<(std::ostream& out, const pg_missing_item &item); class pg_missing_const_i { public: - virtual const map & + virtual const std::map & get_items() const = 0; - virtual const map &get_rmissing() const = 0; + virtual const std::map &get_rmissing() const = 0; virtual bool get_may_include_deletes() const = 0; virtual unsigned int num_missing() const = 0; virtual bool have_missing() const = 0; @@ -4209,7 +4210,7 @@ public: }; template <> class ChangeTracker { - set _changed; + std::set _changed; public: void changed(const hobject_t &obj) { _changed.insert(obj); @@ -4231,8 +4232,8 @@ public: template class pg_missing_set : public pg_missing_const_i { using item = pg_missing_item; - map missing; // oid -> (need v, have v) - map rmissing; // v -> oid + std::map missing; // oid -> (need v, have v) + std::map rmissing; // v -> oid ChangeTracker tracker; public: @@ -4249,10 +4250,10 @@ public: bool may_include_deletes = false; - const map &get_items() const override { + const std::map &get_items() const override { return missing; } - const map &get_rmissing() const override { + const std::map &get_rmissing() const override { return rmissing; } bool get_may_include_deletes() const override { @@ -4273,7 +4274,7 @@ public: return true; } bool is_missing(const hobject_t& oid, eversion_t v) const override { - map::const_iterator m = + std::map::const_iterator m = missing.find(oid); if (m == missing.end()) return false; @@ -4302,7 +4303,7 @@ public: * assumes missing is accurate up through the previous log entry. */ void add_next_event(const pg_log_entry_t& e) { - map::iterator missing_it; + std::map::iterator missing_it; missing_it = missing.find(e.soid); bool is_missing_divergent_item = missing_it != missing.end(); if (e.prior_version == eversion_t() || e.is_clone()) { @@ -4384,7 +4385,7 @@ public: pg_missing_set *omissing) { omissing->may_include_deletes = may_include_deletes; unsigned mask = ~((~0)<::iterator i = missing.begin(); + for (std::map::iterator i = missing.begin(); i != missing.end(); ) { if ((i->first.get_hash() & mask) == child_pgid.m_seed) { @@ -4404,13 +4405,13 @@ public: rmissing.clear(); } - void encode(bufferlist &bl) const { + void encode(ceph::buffer::list &bl) const { ENCODE_START(4, 2, bl); encode(missing, bl, may_include_deletes ? CEPH_FEATURE_OSD_RECOVERY_DELETES : 0); encode(may_include_deletes, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator &bl, int64_t pool = -1) { + void decode(ceph::buffer::list::const_iterator &bl, int64_t pool = -1) { for (auto const &i: missing) tracker.changed(i.first); DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl); @@ -4422,8 +4423,8 @@ public: if (struct_v < 3) { // Handle hobject_t upgrade - map tmp; - for (map::iterator i = + std::map tmp; + for (std::map::iterator i = missing.begin(); i != missing.end(); ) { @@ -4439,7 +4440,7 @@ public: missing.insert(tmp.begin(), tmp.end()); } - for (map::iterator it = + for (std::map::iterator it = missing.begin(); it != missing.end(); ++it) @@ -4447,9 +4448,9 @@ public: for (auto const &i: missing) tracker.changed(i.first); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->open_array_section("missing"); - for (map::const_iterator p = + for (std::map::const_iterator p = missing.begin(); p != missing.end(); ++p) { f->open_object_section("item"); f->dump_stream("object") << p->first; @@ -4469,7 +4470,7 @@ public: } } } - static void generate_test_instances(list& o) { + static void generate_test_instances(std::list& o) { o.push_back(new pg_missing_set); o.push_back(new pg_missing_set); o.back()->add( @@ -4494,7 +4495,7 @@ public: template bool debug_verify_from_init( const missing_t &init_missing, - ostream *oss) const { + std::ostream *oss) const { if (!TrackChanges) return true; auto check_missing(init_missing.get_items()); @@ -4527,7 +4528,7 @@ public: } if (oss && !ok) { *oss << "check_missing: " << check_missing << "\n"; - set changed; + std::set changed; tracker.get_changed([&](const hobject_t &hoid) { changed.insert(hoid); }); *oss << "changed: " << changed << "\n"; } @@ -4536,17 +4537,17 @@ public: }; template void encode( - const pg_missing_set &c, bufferlist &bl, uint64_t features=0) { + const pg_missing_set &c, ceph::buffer::list &bl, uint64_t features=0) { ENCODE_DUMP_PRE(); c.encode(bl); ENCODE_DUMP_POST(cl); } template -void decode(pg_missing_set &c, bufferlist::const_iterator &p) { +void decode(pg_missing_set &c, ceph::buffer::list::const_iterator &p) { c.decode(p); } template -ostream& operator<<(ostream& out, const pg_missing_set &missing) +std::ostream& operator<<(std::ostream& out, const pg_missing_set &missing) { out << "missing(" << missing.num_missing() << " may_include_deletes = " << missing.may_include_deletes; @@ -4565,21 +4566,21 @@ using pg_missing_tracker_t = pg_missing_set; */ struct pg_nls_response_t { collection_list_handle_t handle; - list entries; + std::list entries; - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(handle, bl); __u32 n = (__u32)entries.size(); encode(n, bl); - for (list::const_iterator i = entries.begin(); i != entries.end(); ++i) { + for (std::list::const_iterator i = entries.begin(); i != entries.end(); ++i) { encode(i->nspace, bl); encode(i->oid, bl); encode(i->locator, bl); } ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& bl) { + void decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(1, bl); decode(handle, bl); __u32 n; @@ -4594,10 +4595,10 @@ struct pg_nls_response_t { } DECODE_FINISH(bl); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->dump_stream("handle") << handle; f->open_array_section("entries"); - for (list::const_iterator p = entries.begin(); p != entries.end(); ++p) { + for (std::list::const_iterator p = entries.begin(); p != entries.end(); ++p) { f->open_object_section("object"); f->dump_string("namespace", p->nspace); f->dump_string("object", p->oid); @@ -4606,7 +4607,7 @@ struct pg_nls_response_t { } f->close_section(); } - static void generate_test_instances(list& o) { + static void generate_test_instances(std::list& o) { o.push_back(new pg_nls_response_t); o.push_back(new pg_nls_response_t); o.back()->handle = hobject_t(object_t("hi"), "key", 1, 2, -1, ""); @@ -4634,16 +4635,16 @@ WRITE_CLASS_ENCODER(pg_nls_response_t) // For backwards compatibility with older OSD requests struct pg_ls_response_t { collection_list_handle_t handle; - list > entries; + std::list > entries; - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { using ceph::encode; __u8 v = 1; encode(v, bl); encode(handle, bl); encode(entries, bl); } - void decode(bufferlist::const_iterator& bl) { + void decode(ceph::buffer::list::const_iterator& bl) { using ceph::decode; __u8 v; decode(v, bl); @@ -4651,10 +4652,10 @@ struct pg_ls_response_t { decode(handle, bl); decode(entries, bl); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->dump_stream("handle") << handle; f->open_array_section("entries"); - for (list >::const_iterator p = entries.begin(); p != entries.end(); ++p) { + for (std::list >::const_iterator p = entries.begin(); p != entries.end(); ++p) { f->open_object_section("object"); f->dump_stream("object") << p->first; f->dump_string("key", p->second); @@ -4662,12 +4663,12 @@ struct pg_ls_response_t { } f->close_section(); } - static void generate_test_instances(list& o) { + static void generate_test_instances(std::list& o) { o.push_back(new pg_ls_response_t); o.push_back(new pg_ls_response_t); o.back()->handle = hobject_t(object_t("hi"), "key", 1, 2, -1, ""); - o.back()->entries.push_back(make_pair(object_t("one"), string())); - o.back()->entries.push_back(make_pair(object_t("two"), string("twokey"))); + o.back()->entries.push_back(std::make_pair(object_t("one"), std::string())); + o.back()->entries.push_back(std::make_pair(object_t("two"), std::string("twokey"))); } }; @@ -4678,7 +4679,7 @@ WRITE_CLASS_ENCODER(pg_ls_response_t) */ struct object_copy_cursor_t { uint64_t data_offset; - string omap_offset; + std::string omap_offset; bool attr_complete; bool data_complete; bool omap_complete; @@ -4697,10 +4698,10 @@ struct object_copy_cursor_t { return attr_complete && data_complete && omap_complete; } - static void generate_test_instances(list& o); - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const; + static void generate_test_instances(std::list& o); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const; }; WRITE_CLASS_ENCODER(object_copy_cursor_t) @@ -4728,18 +4729,18 @@ struct object_copy_data_t { utime_t mtime; uint32_t data_digest, omap_digest; uint32_t flags; - map attrs; - bufferlist data; - bufferlist omap_header; - bufferlist omap_data; + std::map attrs; + ceph::buffer::list data; + ceph::buffer::list omap_header; + ceph::buffer::list omap_data; /// which snaps we are defined for (if a snap and not the head) - vector snaps; + std::vector snaps; /// latest snap seq for the object (if head) snapid_t snap_seq; /// recent reqids on this object - mempool::osd_pglog::vector > reqids; + mempool::osd_pglog::vector > reqids; /// map reqids by index to error return code (if any) mempool::osd_pglog::map reqid_return_codes; @@ -4754,10 +4755,10 @@ public: truncate_seq(0), truncate_size(0) {} - static void generate_test_instances(list& o); - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::const_iterator& bl); - void dump(Formatter *f) const; + static void generate_test_instances(std::list& o); + void encode(ceph::buffer::list& bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator& bl); + void dump(ceph::Formatter *f) const; }; WRITE_CLASS_ENCODER_FEATURES(object_copy_data_t) @@ -4774,10 +4775,10 @@ struct pg_create_t { pg_create_t(unsigned c, pg_t p, int s) : created(c), parent(p), split_bits(s) {} - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(pg_create_t) @@ -4812,14 +4813,14 @@ class ObjectExtent { object_locator_t oloc; // object locator (pool etc) - vector > buffer_extents; // off -> len. extents in buffer being mapped (may be fragmented bc of striping!) + std::vector > buffer_extents; // off -> len. extents in buffer being mapped (may be fragmented bc of striping!) ObjectExtent() : objectno(0), offset(0), length(0), truncate_size(0) {} ObjectExtent(object_t o, uint64_t ono, uint64_t off, uint64_t l, uint64_t ts) : oid(o), objectno(ono), offset(off), length(l), truncate_size(ts) { } }; -inline ostream& operator<<(ostream& out, const ObjectExtent &ex) +inline std::ostream& operator<<(std::ostream& out, const ObjectExtent &ex) { return out << "extent(" << ex.oid << " (" << ex.objectno << ") in " << ex.oloc @@ -4851,14 +4852,14 @@ public: mounted(0), clean_thru(0) { } - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(OSDSuperblock) -inline ostream& operator<<(ostream& out, const OSDSuperblock& sb) +inline std::ostream& operator<<(std::ostream& out, const OSDSuperblock& sb) { return out << "sb(" << sb.cluster_fsid << " osd." << sb.whoami @@ -4883,14 +4884,14 @@ inline ostream& operator<<(ostream& out, const OSDSuperblock& sb) */ struct SnapSet { snapid_t seq; - vector snaps; // descending - vector clones; // ascending - map > clone_overlap; // overlap w/ next newest - map clone_size; - map> clone_snaps; // descending + std::vector snaps; // descending + std::vector clones; // ascending + std::map > clone_overlap; // overlap w/ next newest + std::map clone_size; + std::map> clone_snaps; // descending SnapSet() : seq(0) {} - explicit SnapSet(bufferlist& bl) { + explicit SnapSet(ceph::buffer::list& bl) { auto p = std::cbegin(bl); decode(p); } @@ -4901,15 +4902,15 @@ struct SnapSet { /// get space accounted to clone uint64_t get_clone_bytes(snapid_t clone) const; - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); SnapContext get_ssc_as_of(snapid_t as_of) const { SnapContext out; out.seq = as_of; - for (vector::const_iterator i = snaps.begin(); + for (std::vector::const_iterator i = snaps.begin(); i != snaps.end(); ++i) { if (*i <= as_of) @@ -4924,7 +4925,7 @@ struct SnapSet { }; WRITE_CLASS_ENCODER(SnapSet) -ostream& operator<<(ostream& out, const SnapSet& cs); +std::ostream& operator<<(std::ostream& out, const SnapSet& cs); @@ -4939,10 +4940,10 @@ struct watch_info_t { watch_info_t() : cookie(0), timeout_seconds(0) { } watch_info_t(uint64_t c, uint32_t t, const entity_addr_t& a) : cookie(c), timeout_seconds(t), addr(a) {} - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::const_iterator& bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list& bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator& bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER_FEATURES(watch_info_t) @@ -4951,7 +4952,7 @@ static inline bool operator==(const watch_info_t& l, const watch_info_t& r) { && l.addr == r.addr; } -static inline ostream& operator<<(ostream& out, const watch_info_t& w) { +static inline std::ostream& operator<<(std::ostream& out, const watch_info_t& w) { return out << "watch(cookie " << w.cookie << " " << w.timeout_seconds << "s" << " " << w.addr << ")"; } @@ -4960,10 +4961,10 @@ struct notify_info_t { uint64_t cookie; uint64_t notify_id; uint32_t timeout; - bufferlist bl; + ceph::buffer::list bl; }; -static inline ostream& operator<<(ostream& out, const notify_info_t& n) { +static inline std::ostream& operator<<(std::ostream& out, const notify_info_t& n) { return out << "notify(cookie " << n.cookie << " notify" << n.notify_id << " " << n.timeout << "s)"; @@ -4983,8 +4984,8 @@ struct chunk_info_t { chunk_info_t() : offset(0), length(0), flags((cflag_t)0) { } - static string get_flag_string(uint64_t flags) { - string r; + static std::string get_flag_string(uint64_t flags) { + std::string r; if (flags & FLAG_DIRTY) { r += "|dirty"; } @@ -5028,13 +5029,13 @@ struct chunk_info_t { bool has_fingerprint() const { return test_flag(FLAG_HAS_FINGERPRINT); } - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const; - friend ostream& operator<<(ostream& out, const chunk_info_t& ci); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const; + friend std::ostream& operator<<(std::ostream& out, const chunk_info_t& ci); }; WRITE_CLASS_ENCODER(chunk_info_t) -ostream& operator<<(ostream& out, const chunk_info_t& ci); +std::ostream& operator<<(std::ostream& out, const chunk_info_t& ci); struct object_info_t; struct object_manifest_t { @@ -5045,7 +5046,7 @@ struct object_manifest_t { }; uint8_t type; // redirect, chunked, ... hobject_t redirect_target; - map chunk_map; + std::map chunk_map; object_manifest_t() : type(0) { } object_manifest_t(uint8_t type, const hobject_t& redirect_target) @@ -5076,14 +5077,14 @@ struct object_manifest_t { redirect_target = hobject_t(); chunk_map.clear(); } - static void generate_test_instances(list& o); - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - void dump(Formatter *f) const; - friend ostream& operator<<(ostream& out, const object_info_t& oi); + static void generate_test_instances(std::list& o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + void dump(ceph::Formatter *f) const; + friend std::ostream& operator<<(std::ostream& out, const object_info_t& oi); }; WRITE_CLASS_ENCODER(object_manifest_t) -ostream& operator<<(ostream& out, const object_manifest_t& oi); +std::ostream& operator<<(std::ostream& out, const object_manifest_t& oi); struct object_info_t { hobject_t soid; @@ -5112,18 +5113,18 @@ struct object_info_t { flag_t flags; - static string get_flag_string(flag_t flags) { - string s; - vector sv = get_flag_vector(flags); + static std::string get_flag_string(flag_t flags) { + std::string s; + std::vector sv = get_flag_vector(flags); for (auto ss : sv) { - s += string("|") + ss; + s += std::string("|") + ss; } if (s.length()) return s.substr(1); return s; } - static vector get_flag_vector(flag_t flags) { - vector sv; + static std::vector get_flag_vector(flag_t flags) { + std::vector sv; if (flags & FLAG_LOST) sv.insert(sv.end(), "lost"); if (flags & FLAG_WHITEOUT) @@ -5146,13 +5147,13 @@ struct object_info_t { sv.insert(sv.end(), "redirect_has_reference"); return sv; } - string get_flag_string() const { + std::string get_flag_string() const { return get_flag_string(flags); } uint64_t truncate_seq, truncate_size; - map, watch_info_t> watchers; + std::map, watch_info_t> watchers; // opportunistic checksums; may or may not be present __u32 data_digest; ///< data crc32c @@ -5220,14 +5221,14 @@ struct object_info_t { clear_omap_digest(); } - void encode(bufferlist& bl, uint64_t features) const; - void decode(bufferlist::const_iterator& bl); - void decode(bufferlist& bl) { + void encode(ceph::buffer::list& bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator& bl); + void decode(ceph::buffer::list& bl) { auto p = std::cbegin(bl); decode(p); } - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); explicit object_info_t() : user_version(0), size(0), flags((flag_t)0), @@ -5246,13 +5247,13 @@ struct object_info_t { alloc_hint_flags(0) {} - explicit object_info_t(bufferlist& bl) { + explicit object_info_t(ceph::buffer::list& bl) { decode(bl); } }; WRITE_CLASS_ENCODER_FEATURES(object_info_t) -ostream& operator<<(ostream& out, const object_info_t& oi); +std::ostream& operator<<(std::ostream& out, const object_info_t& oi); @@ -5264,22 +5265,22 @@ struct ObjectRecoveryInfo { object_info_t oi; SnapSet ss; // only populated if soid is_snap() interval_set copy_subset; - map> clone_subset; + std::map> clone_subset; ObjectRecoveryInfo() : size(0) { } - static void generate_test_instances(list& o); - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::const_iterator &bl, int64_t pool = -1); - ostream &print(ostream &out) const; - void dump(Formatter *f) const; + static void generate_test_instances(std::list& o); + void encode(ceph::buffer::list &bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator &bl, int64_t pool = -1); + std::ostream &print(std::ostream &out) const; + void dump(ceph::Formatter *f) const; }; WRITE_CLASS_ENCODER_FEATURES(ObjectRecoveryInfo) -ostream& operator<<(ostream& out, const ObjectRecoveryInfo &inf); +std::ostream& operator<<(std::ostream& out, const ObjectRecoveryInfo &inf); struct ObjectRecoveryProgress { uint64_t data_recovered_to; - string omap_recovered_to; + std::string omap_recovered_to; bool first; bool data_complete; bool omap_complete; @@ -5297,28 +5298,28 @@ struct ObjectRecoveryProgress { omap_complete; } - static void generate_test_instances(list& o); - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - ostream &print(ostream &out) const; - void dump(Formatter *f) const; + static void generate_test_instances(std::list& o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + std::ostream &print(std::ostream &out) const; + void dump(ceph::Formatter *f) const; }; WRITE_CLASS_ENCODER(ObjectRecoveryProgress) -ostream& operator<<(ostream& out, const ObjectRecoveryProgress &prog); +std::ostream& operator<<(std::ostream& out, const ObjectRecoveryProgress &prog); struct PushReplyOp { hobject_t soid; - static void generate_test_instances(list& o); - void encode(bufferlist &bl) const; - void decode(bufferlist::const_iterator &bl); - ostream &print(ostream &out) const; - void dump(Formatter *f) const; + static void generate_test_instances(std::list& o); + void encode(ceph::buffer::list &bl) const; + void decode(ceph::buffer::list::const_iterator &bl); + std::ostream &print(std::ostream &out) const; + void dump(ceph::Formatter *f) const; uint64_t cost(CephContext *cct) const; }; WRITE_CLASS_ENCODER(PushReplyOp) -ostream& operator<<(ostream& out, const PushReplyOp &op); +std::ostream& operator<<(std::ostream& out, const PushReplyOp &op); struct PullOp { hobject_t soid; @@ -5326,40 +5327,40 @@ struct PullOp { ObjectRecoveryInfo recovery_info; ObjectRecoveryProgress recovery_progress; - static void generate_test_instances(list& o); - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::const_iterator &bl); - ostream &print(ostream &out) const; - void dump(Formatter *f) const; + static void generate_test_instances(std::list& o); + void encode(ceph::buffer::list &bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator &bl); + std::ostream &print(std::ostream &out) const; + void dump(ceph::Formatter *f) const; uint64_t cost(CephContext *cct) const; }; WRITE_CLASS_ENCODER_FEATURES(PullOp) -ostream& operator<<(ostream& out, const PullOp &op); +std::ostream& operator<<(std::ostream& out, const PullOp &op); struct PushOp { hobject_t soid; eversion_t version; - bufferlist data; + ceph::buffer::list data; interval_set data_included; - bufferlist omap_header; - map omap_entries; - map attrset; + ceph::buffer::list omap_header; + std::map omap_entries; + std::map attrset; ObjectRecoveryInfo recovery_info; ObjectRecoveryProgress before_progress; ObjectRecoveryProgress after_progress; - static void generate_test_instances(list& o); - void encode(bufferlist &bl, uint64_t features) const; - void decode(bufferlist::const_iterator &bl); - ostream &print(ostream &out) const; - void dump(Formatter *f) const; + static void generate_test_instances(std::list& o); + void encode(ceph::buffer::list &bl, uint64_t features) const; + void decode(ceph::buffer::list::const_iterator &bl); + std::ostream &print(std::ostream &out) const; + void dump(ceph::Formatter *f) const; uint64_t cost(CephContext *cct) const; }; WRITE_CLASS_ENCODER_FEATURES(PushOp) -ostream& operator<<(ostream& out, const PushOp &op); +std::ostream& operator<<(std::ostream& out, const PushOp &op); /* @@ -5367,7 +5368,7 @@ ostream& operator<<(ostream& out, const PushOp &op); */ struct ScrubMap { struct object { - map attrs; + std::map attrs; uint64_t size; __u32 omap_digest; ///< omap crc32c __u32 digest; ///< data crc32c @@ -5391,14 +5392,14 @@ struct ScrubMap { read_error(false), stat_error(false), ec_hash_mismatch(false), ec_size_mismatch(false), large_omap_object_found(false) {} - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& bl); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& bl); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(object) - map objects; + std::map objects; eversion_t valid_through; eversion_t incr_since; bool has_large_omap_object_errors:1; @@ -5418,22 +5419,22 @@ struct ScrubMap { swap(incr_since, r.incr_since); } - void encode(bufferlist& bl) const; - void decode(bufferlist::const_iterator& bl, int64_t pool=-1); - void dump(Formatter *f) const; - static void generate_test_instances(list& o); + void encode(ceph::buffer::list& bl) const; + void decode(ceph::buffer::list::const_iterator& bl, int64_t pool=-1); + void dump(ceph::Formatter *f) const; + static void generate_test_instances(std::list& o); }; WRITE_CLASS_ENCODER(ScrubMap::object) WRITE_CLASS_ENCODER(ScrubMap) struct ScrubMapBuilder { bool deep = false; - vector ls; + std::vector ls; size_t pos = 0; int64_t data_pos = 0; - string omap_pos; + std::string omap_pos; int ret = 0; - bufferhash data_hash, omap_hash; ///< accumulatinng hash value + ceph::buffer::hash data_hash, omap_hash; ///< accumulatinng hash value uint64_t omap_keys = 0; uint64_t omap_bytes = 0; @@ -5459,7 +5460,7 @@ struct ScrubMapBuilder { omap_bytes = 0; } - friend ostream& operator<<(ostream& out, const ScrubMapBuilder& pos) { + friend std::ostream& operator<<(std::ostream& out, const ScrubMapBuilder& pos) { out << "(" << pos.pos << "/" << pos.ls.size(); if (pos.pos < pos.ls.size()) { out << " " << pos.ls[pos.pos]; @@ -5484,7 +5485,7 @@ struct OSDOp { ceph_osd_op op; sobject_t soid; - bufferlist indata, outdata; + ceph::buffer::list indata, outdata; errorcode32_t rval; OSDOp() : rval(0) { @@ -5492,15 +5493,15 @@ struct OSDOp { } /** - * split a bufferlist into constituent indata members of a vector of OSDOps + * split a ceph::buffer::list into constituent indata members of a vector of OSDOps * * @param ops [out] vector of OSDOps * @param in [in] combined data buffer */ - static void split_osd_op_vector_in_data(vector& ops, bufferlist& in); + static void split_osd_op_vector_in_data(std::vector& ops, ceph::buffer::list& in); /** - * merge indata members of a vector of OSDOp into a single bufferlist + * merge indata members of a vector of OSDOp into a single ceph::buffer::list * * Notably this also encodes certain other OSDOp data into the data * buffer, including the sobject_t soid. @@ -5508,33 +5509,33 @@ struct OSDOp { * @param ops [in] vector of OSDOps * @param out [out] combined data buffer */ - static void merge_osd_op_vector_in_data(vector& ops, bufferlist& out); + static void merge_osd_op_vector_in_data(std::vector& ops, ceph::buffer::list& out); /** - * split a bufferlist into constituent outdata members of a vector of OSDOps + * split a ceph::buffer::list into constituent outdata members of a vector of OSDOps * * @param ops [out] vector of OSDOps * @param in [in] combined data buffer */ - static void split_osd_op_vector_out_data(vector& ops, bufferlist& in); + static void split_osd_op_vector_out_data(std::vector& ops, ceph::buffer::list& in); /** - * merge outdata members of a vector of OSDOps into a single bufferlist + * merge outdata members of a vector of OSDOps into a single ceph::buffer::list * * @param ops [in] vector of OSDOps * @param out [out] combined data buffer */ - static void merge_osd_op_vector_out_data(vector& ops, bufferlist& out); + static void merge_osd_op_vector_out_data(std::vector& ops, ceph::buffer::list& out); /** * Clear data as much as possible, leave minimal data for historical op dump * * @param ops [in] vector of OSDOps */ - static void clear_data(vector& ops); + static void clear_data(std::vector& ops); }; -ostream& operator<<(ostream& out, const OSDOp& op); +std::ostream& operator<<(std::ostream& out, const OSDOp& op); struct watch_item_t { entity_name_t name; @@ -5548,7 +5549,7 @@ struct watch_item_t { : name(name), cookie(cookie), timeout_seconds(timeout), addr(addr) { } - void encode(bufferlist &bl, uint64_t features) const { + void encode(ceph::buffer::list &bl, uint64_t features) const { ENCODE_START(2, 1, bl); encode(name, bl); encode(cookie, bl); @@ -5556,7 +5557,7 @@ struct watch_item_t { encode(addr, bl, features); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator &bl) { + void decode(ceph::buffer::list::const_iterator &bl) { DECODE_START(2, bl); decode(name, bl); decode(cookie, bl); @@ -5579,21 +5580,21 @@ struct obj_watch_item_t { * */ struct obj_list_watch_response_t { - list entries; + std::list entries; - void encode(bufferlist& bl, uint64_t features) const { + void encode(ceph::buffer::list& bl, uint64_t features) const { ENCODE_START(1, 1, bl); encode(entries, bl, features); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& bl) { + void decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(1, bl); decode(entries, bl); DECODE_FINISH(bl); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->open_array_section("entries"); - for (list::const_iterator p = entries.begin(); p != entries.end(); ++p) { + for (std::list::const_iterator p = entries.begin(); p != entries.end(); ++p) { f->open_object_section("watch"); f->dump_stream("watcher") << p->name; f->dump_int("cookie", p->cookie); @@ -5605,7 +5606,7 @@ struct obj_list_watch_response_t { } f->close_section(); } - static void generate_test_instances(list& o) { + static void generate_test_instances(std::list& o) { entity_addr_t ea; o.push_back(new obj_list_watch_response_t); o.push_back(new obj_list_watch_response_t); @@ -5628,13 +5629,13 @@ WRITE_CLASS_ENCODER_FEATURES(obj_list_watch_response_t) struct clone_info { snapid_t cloneid; - vector snaps; // ascending - vector< pair > overlap; + std::vector snaps; // ascending + std::vector< std::pair > overlap; uint64_t size; clone_info() : cloneid(CEPH_NOSNAP), size(0) {} - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(cloneid, bl); encode(snaps, bl); @@ -5642,7 +5643,7 @@ struct clone_info { encode(size, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& bl) { + void decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(1, bl); decode(cloneid, bl); decode(snaps, bl); @@ -5650,20 +5651,20 @@ struct clone_info { decode(size, bl); DECODE_FINISH(bl); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { if (cloneid == CEPH_NOSNAP) f->dump_string("cloneid", "HEAD"); else f->dump_unsigned("cloneid", cloneid.val); f->open_array_section("snapshots"); - for (vector::const_iterator p = snaps.begin(); p != snaps.end(); ++p) { + for (std::vector::const_iterator p = snaps.begin(); p != snaps.end(); ++p) { f->open_object_section("snap"); f->dump_unsigned("id", p->val); f->close_section(); } f->close_section(); f->open_array_section("overlaps"); - for (vector< pair >::const_iterator q = overlap.begin(); + for (std::vector< std::pair >::const_iterator q = overlap.begin(); q != overlap.end(); ++q) { f->open_object_section("overlap"); f->dump_unsigned("offset", q->first); @@ -5673,13 +5674,13 @@ struct clone_info { f->close_section(); f->dump_unsigned("size", size); } - static void generate_test_instances(list& o) { + static void generate_test_instances(std::list& o) { o.push_back(new clone_info); o.push_back(new clone_info); o.back()->cloneid = 1; o.back()->snaps.push_back(1); - o.back()->overlap.push_back(pair(0,4096)); - o.back()->overlap.push_back(pair(8192,4096)); + o.back()->overlap.push_back(std::pair(0,4096)); + o.back()->overlap.push_back(std::pair(8192,4096)); o.back()->size = 16384; o.push_back(new clone_info); o.back()->cloneid = CEPH_NOSNAP; @@ -5693,16 +5694,16 @@ WRITE_CLASS_ENCODER(clone_info) * */ struct obj_list_snap_response_t { - vector clones; // ascending + std::vector clones; // ascending snapid_t seq; - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { ENCODE_START(2, 1, bl); encode(clones, bl); encode(seq, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& bl) { + void decode(ceph::buffer::list::const_iterator& bl) { DECODE_START(2, bl); decode(clones, bl); if (struct_v >= 2) @@ -5711,9 +5712,9 @@ struct obj_list_snap_response_t { seq = CEPH_NOSNAP; DECODE_FINISH(bl); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->open_array_section("clones"); - for (vector::const_iterator p = clones.begin(); p != clones.end(); ++p) { + for (std::vector::const_iterator p = clones.begin(); p != clones.end(); ++p) { f->open_object_section("clone"); p->dump(f); f->close_section(); @@ -5721,14 +5722,14 @@ struct obj_list_snap_response_t { f->dump_unsigned("seq", seq); f->close_section(); } - static void generate_test_instances(list& o) { + static void generate_test_instances(std::list& o) { o.push_back(new obj_list_snap_response_t); o.push_back(new obj_list_snap_response_t); clone_info cl; cl.cloneid = 1; cl.snaps.push_back(1); - cl.overlap.push_back(pair(0,4096)); - cl.overlap.push_back(pair(8192,4096)); + cl.overlap.push_back(std::pair(0,4096)); + cl.overlap.push_back(std::pair(8192,4096)); cl.size = 16384; o.back()->clones.push_back(cl); cl.cloneid = CEPH_NOSNAP; @@ -5772,15 +5773,15 @@ struct pool_pg_num_history_t { /// last epoch updated epoch_t epoch = 0; /// poolid -> epoch -> pg_num - map> pg_nums; + std::map> pg_nums; /// pair(epoch, poolid) - set> deleted_pools; + std::set> deleted_pools; void log_pg_num_change(epoch_t epoch, int64_t pool, uint32_t pg_num) { pg_nums[pool][epoch] = pg_num; } void log_pool_delete(epoch_t epoch, int64_t pool) { - deleted_pools.insert(make_pair(epoch, pool)); + deleted_pools.insert(std::make_pair(epoch, pool)); } /// prune history based on oldest osdmap epoch in the cluster @@ -5803,21 +5804,21 @@ struct pool_pg_num_history_t { } } - void encode(bufferlist& bl) const { + void encode(ceph::buffer::list& bl) const { ENCODE_START(1, 1, bl); encode(epoch, bl); encode(pg_nums, bl); encode(deleted_pools, bl); ENCODE_FINISH(bl); } - void decode(bufferlist::const_iterator& p) { + void decode(ceph::buffer::list::const_iterator& p) { DECODE_START(1, p); decode(epoch, p); decode(pg_nums, p); decode(deleted_pools, p); DECODE_FINISH(p); } - void dump(Formatter *f) const { + void dump(ceph::Formatter *f) const { f->dump_unsigned("epoch", epoch); f->open_object_section("pools"); for (auto& i : pg_nums) { @@ -5843,10 +5844,10 @@ struct pool_pg_num_history_t { } f->close_section(); } - static void generate_test_instances(list& ls) { + static void generate_test_instances(std::list& ls) { ls.push_back(new pool_pg_num_history_t); } - friend ostream& operator<<(ostream& out, const pool_pg_num_history_t& h) { + friend std::ostream& operator<<(std::ostream& out, const pool_pg_num_history_t& h) { return out << "pg_num_history(e" << h.epoch << " pg_nums " << h.pg_nums << " deleted_pools " << h.deleted_pools -- 2.39.5