From 83d03f0e1c65385dcf465108d544da84f8bfad97 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 8 May 2014 10:40:10 -0700 Subject: [PATCH] osd/osd_types: add last_force_op_resend to pg_pool_t Signed-off-by: Sage Weil (cherry picked from commit 3152faf79f498a723ae0fe44301ccb21b15a96ab) --- src/osd/osd_types.cc | 20 +++++++++++++++----- src/osd/osd_types.h | 3 +++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 15dd661d1761a..c57ee86cc48f3 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -770,6 +770,7 @@ void pg_pool_t::dump(Formatter *f) const f->dump_int("pg_placement_num", get_pgp_num()); f->dump_unsigned("crash_replay_interval", get_crash_replay_interval()); f->dump_stream("last_change") << get_last_change(); + f->dump_stream("last_force_op_resend") << get_last_force_op_resend(); f->dump_unsigned("auid", get_auid()); f->dump_string("snap_mode", is_pool_snaps_mode() ? "pool" : "selfmanaged"); f->dump_unsigned("snap_seq", get_snap_seq()); @@ -1058,7 +1059,7 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const } __u8 encode_compat = 5; - ENCODE_START(14, encode_compat, bl); + ENCODE_START(15, encode_compat, bl); ::encode(type, bl); ::encode(size, bl); ::encode(crush_ruleset, bl); @@ -1097,12 +1098,13 @@ void pg_pool_t::encode(bufferlist& bl, uint64_t features) const ::encode(cache_min_flush_age, bl); ::encode(cache_min_evict_age, bl); ::encode(erasure_code_profile, bl); + ::encode(last_force_op_resend, bl); ENCODE_FINISH(bl); } void pg_pool_t::decode(bufferlist::iterator& bl) { - DECODE_START_LEGACY_COMPAT_LEN(14, 5, 5, bl); + DECODE_START_LEGACY_COMPAT_LEN(15, 5, 5, bl); ::decode(type, bl); ::decode(size, bl); ::decode(crush_ruleset, bl); @@ -1199,7 +1201,11 @@ void pg_pool_t::decode(bufferlist::iterator& bl) if (struct_v >= 14) { ::decode(erasure_code_profile, bl); } - + if (struct_v >= 15) { + ::decode(last_force_op_resend, bl); + } else { + last_force_op_resend = 0; + } DECODE_FINISH(bl); calc_pg_masks(); } @@ -1216,6 +1222,7 @@ void pg_pool_t::generate_test_instances(list& o) a.pg_num = 6; a.pgp_num = 5; a.last_change = 9; + a.last_force_op_resend = 123823; a.snap_seq = 10; a.snap_epoch = 11; a.auid = 12; @@ -1264,8 +1271,11 @@ ostream& operator<<(ostream& out, const pg_pool_t& p) << " object_hash " << p.get_object_hash_name() << " pg_num " << p.get_pg_num() << " pgp_num " << p.get_pgp_num() - << " last_change " << p.get_last_change() - << " owner " << p.get_auid(); + << " last_change " << p.get_last_change(); + if (p.get_last_force_op_resend()) + out << " lfor " << p.get_last_force_op_resend(); + if (p.get_auid()) + out << " owner " << p.get_auid(); if (p.flags) out << " flags " << p.get_flags_string(); if (p.crash_replay_interval) diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 092d6ccbf6fad..60fa89d644e9b 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -882,6 +882,7 @@ public: map properties; ///< OBSOLETE string erasure_code_profile; ///< name of the erasure code profile in OSDMap epoch_t last_change; ///< most recent epoch changed, exclusing snapshot changes + epoch_t last_force_op_resend; ///< last epoch that forced clients to resend snapid_t snap_seq; ///< seq for per-pool snapshot epoch_t snap_epoch; ///< osdmap epoch of last snap uint64_t auid; ///< who owns the pg @@ -940,6 +941,7 @@ public: crush_ruleset(0), object_hash(0), pg_num(0), pgp_num(0), last_change(0), + last_force_op_resend(0), snap_seq(0), snap_epoch(0), auid(0), crash_replay_interval(0), @@ -979,6 +981,7 @@ public: return ceph_str_hash_name(get_object_hash()); } epoch_t get_last_change() const { return last_change; } + epoch_t get_last_force_op_resend() const { return last_force_op_resend; } epoch_t get_snap_epoch() const { return snap_epoch; } snapid_t get_snap_seq() const { return snap_seq; } uint64_t get_auid() const { return auid; } -- 2.39.5