]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pgmap: decode old pg_t
authorSage Weil <sage@newdream.net>
Fri, 26 Aug 2011 19:31:52 +0000 (12:31 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Sat, 27 Aug 2011 17:20:54 +0000 (10:20 -0700)
Signed-off-by: Sage Weil <sage@newdream.net>
src/mon/PGMap.cc
src/mon/PGMap.h

index a996d5d4f50bb427d7bed4d01f6d1842a8e35122..1d2345c0d897d1c7abba8ad3f44197378ab83fdc 100644 (file)
@@ -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);
index b3a8b40b6bd130a69f1c952ecac65ee45d7717d9..e075a5a242991da7e9e2efa5e2ab2869771f9514 100644 (file)
@@ -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),