From: Sage Weil Date: Fri, 26 Aug 2011 19:31:52 +0000 (-0700) Subject: pgmap: decode old pg_t X-Git-Tag: v0.35~191^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f093a2eefa03df49a5bdeb0d6e2b1b08ca24cb49;p=ceph.git pgmap: decode old pg_t Signed-off-by: Sage Weil --- diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index a996d5d4f50b..1d2345c0d897 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -156,7 +156,7 @@ void PGMap::stat_osd_sub(const osd_stat_t &s) void PGMap::encode(bufferlist &bl) { - __u8 v = 2; + __u8 v = 3; ::encode(v, bl); ::encode(version, bl); ::encode(pg_stat, bl); @@ -172,7 +172,19 @@ void PGMap::decode(bufferlist::iterator &bl) __u8 v; ::decode(v, bl); ::decode(version, bl); - ::decode(pg_stat, bl); + if (v < 3) { + pg_stat.clear(); + __u32 n; + ::decode(n, bl); + while (n--) { + old_pg_t opgid; + ::decode(opgid, bl); + pg_t pgid = opgid; + ::decode(pg_stat[pgid], bl); + } + } else { + ::decode(pg_stat, bl); + } ::decode(osd_stat, bl); ::decode(last_osdmap_epoch, bl); ::decode(last_pg_scan, bl); diff --git a/src/mon/PGMap.h b/src/mon/PGMap.h index b3a8b40b6bd1..e075a5a24299 100644 --- a/src/mon/PGMap.h +++ b/src/mon/PGMap.h @@ -50,7 +50,7 @@ public: float nearfull_ratio; void encode(bufferlist &bl) const { - __u8 v = 2; + __u8 v = 3; ::encode(v, bl); ::encode(version, bl); ::encode(pg_stat_updates, bl); @@ -66,7 +66,19 @@ public: __u8 v; ::decode(v, bl); ::decode(version, bl); - ::decode(pg_stat_updates, bl); + if (v < 3) { + pg_stat_updates.clear(); + __u32 n; + ::decode(n, bl); + while (n--) { + old_pg_t opgid; + ::decode(opgid, bl); + pg_t pgid = opgid; + ::decode(pg_stat_updates[pgid], bl); + } + } else { + ::decode(pg_stat_updates, bl); + } ::decode(osd_stat_updates, bl); ::decode(osd_stat_rm, bl); ::decode(osdmap_epoch, bl); @@ -75,7 +87,18 @@ public: ::decode(full_ratio, bl); ::decode(nearfull_ratio, bl); } - ::decode(pg_remove, bl); + if (v < 3) { + pg_remove.clear(); + __u32 n; + ::decode(n, bl); + while (n--) { + old_pg_t opgid; + ::decode(opgid, bl); + pg_remove.insert(pg_t(opgid)); + } + } else { + ::decode(pg_remove, bl); + } } Incremental() : version(0), osdmap_epoch(0), pg_scan(0),