From 9304db003a37c2a3965eb97937d92f026d2e8375 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 2 Feb 2012 12:42:07 -0800 Subject: [PATCH] osd: new encoding for pg_history_t Signed-off-by: Sage Weil --- src/osd/osd_types.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 617212de55d16..c39b3a4399c4d 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -1125,9 +1125,7 @@ void pg_history_t::generate_test_instances(list& o) void pg_info_t::encode(bufferlist &bl) const { - __u8 v = 25; - ::encode(v, bl); - + ENCODE_START(26, 26, bl); ::encode(pgid, bl); ::encode(last_update, bl); ::encode(last_complete, bl); @@ -1136,14 +1134,13 @@ void pg_info_t::encode(bufferlist &bl) const ::encode(stats, bl); history.encode(bl); ::encode(purged_snaps, bl); + ENCODE_FINISH(bl); } void pg_info_t::decode(bufferlist::iterator &bl) { - __u8 v; - ::decode(v, bl); - - if (v < 23) { + DECODE_START_LEGACY_COMPAT_LEN(26, 26, 26, bl); + if (struct_v < 23) { old_pg_t opgid; ::decode(opgid, bl); pgid = opgid; @@ -1153,20 +1150,21 @@ void pg_info_t::decode(bufferlist::iterator &bl) ::decode(last_update, bl); ::decode(last_complete, bl); ::decode(log_tail, bl); - if (v < 25) { + if (struct_v < 25) { bool log_backlog; ::decode(log_backlog, bl); } - if (v >= 24) + if (struct_v >= 24) ::decode(last_backfill, bl); ::decode(stats, bl); history.decode(bl); - if (v >= 22) + if (struct_v >= 22) ::decode(purged_snaps, bl); else { set snap_trimq; ::decode(snap_trimq, bl); } + DECODE_FINISH(bl); } // -- pg_info_t -- -- 2.39.5