]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add struct_v to most encoded structs that don't already have one
authorSage Weil <sage@newdream.net>
Wed, 27 Jan 2010 21:33:02 +0000 (13:33 -0800)
committerSage Weil <sage@newdream.net>
Wed, 27 Jan 2010 22:29:11 +0000 (14:29 -0800)
src/osd/OSDMap.h
src/osd/PG.h
src/osd/osd_types.h

index 6acd9aa03124be15a13b188222394776daf317a8..43ddeca18895d6e15ad15cae308b82c9123d2ed5 100644 (file)
@@ -89,6 +89,8 @@ struct osd_info_t {
   osd_info_t() : last_clean_first(0), last_clean_last(0),
                 up_from(0), up_thru(0), down_at(0), lost_at(0) {}
   void encode(bufferlist& bl) const {
+    __u8 struct_v = 1;
+    ::encode(struct_v, bl);
     ::encode(last_clean_first, bl);
     ::encode(last_clean_last, bl);
     ::encode(up_from, bl);
@@ -97,6 +99,8 @@ struct osd_info_t {
     ::encode(lost_at, bl);
   }
   void decode(bufferlist::iterator& bl) {
+    __u8 struct_v;
+    ::decode(struct_v, bl);
     ::decode(last_clean_first, bl);
     ::decode(last_clean_last, bl);
     ::decode(up_from, bl);
index 2a51a119dfe3874ab7e3c4f984b77ba281a2a551..6d457376e2cbc18da83c0380d37afb0ced6c65f7 100644 (file)
@@ -118,6 +118,8 @@ public:
       }
 
       void encode(bufferlist &bl) const {
+       __u8 struct_v = 1;
+       ::encode(struct_v, bl);
        ::encode(epoch_created, bl);
        ::encode(last_epoch_started, bl);
        ::encode(last_epoch_split, bl);
@@ -125,11 +127,12 @@ public:
        ::encode(same_up_since, bl);
        ::encode(same_primary_since, bl);
       }
-      void decode(bufferlist::iterator &bl, version_t v) {
+      void decode(bufferlist::iterator &bl) {
+       __u8 struct_v;
+       ::decode(struct_v, bl);
        ::decode(epoch_created, bl);
        ::decode(last_epoch_started, bl);
-       if (v >= 21)
-         ::decode(last_epoch_split, bl);
+       ::decode(last_epoch_split, bl);
        ::decode(same_acting_since, bl);
        ::decode(same_up_since, bl);
        ::decode(same_primary_since, bl);
@@ -166,7 +169,7 @@ public:
       ::decode(log_tail, bl);
       ::decode(log_backlog, bl);
       ::decode(stats, bl);
-      history.decode(bl, v);
+      history.decode(bl);
       ::decode(snap_trimq, bl);
     }
   };
@@ -205,7 +208,7 @@ public:
     void decode(bufferlist::iterator &bl) {
       ::decode(type, bl);
       ::decode(since, bl);
-      history.decode(bl, ~0ull);
+      history.decode(bl);
     }
   };
   WRITE_CLASS_ENCODER(Query)
@@ -253,6 +256,8 @@ public:
       bool is_update() const { return is_clone() || is_modify() || is_backlog(); }
 
       void encode(bufferlist &bl) const {
+       __u8 struct_v = 1;
+       ::encode(struct_v, bl);
        ::encode(op, bl);
        ::encode(soid, bl);
        ::encode(version, bl);
@@ -263,6 +268,8 @@ public:
          ::encode(snaps, bl);
       }
       void decode(bufferlist::iterator &bl) {
+       __u8 struct_v;
+       ::decode(struct_v, bl);
        ::decode(op, bl);
        ::decode(soid, bl);
        ::decode(version, bl);
@@ -306,12 +313,16 @@ public:
     }
 
     void encode(bufferlist& bl) const {
+      __u8 struct_v = 1;
+      ::encode(struct_v, bl);
       ::encode(head, bl);
       ::encode(tail, bl);
       ::encode(backlog, bl);
       ::encode(log, bl);
     }
     void decode(bufferlist::iterator &bl) {
+      __u8 struct_v = 1;
+      ::decode(struct_v, bl);
       ::decode(head, bl);
       ::decode(tail, bl);
       ::decode(backlog, bl);
@@ -435,10 +446,14 @@ public:
     bool trim_to(eversion_t v, ObjectStore::Transaction& t);
 
     void encode(bufferlist& bl) const {
+      __u8 struct_v = 1;
+      ::encode(struct_v, bl);
       ::encode(tail, bl);
       ::encode(head, bl);
     }
     void decode(bufferlist::iterator& bl) {
+      __u8 struct_v;
+      ::decode(struct_v, bl);
       ::decode(tail, bl);
       ::decode(head, bl);
     }
@@ -559,9 +574,13 @@ public:
     }
 
     void encode(bufferlist &bl) const {
+      __u8 struct_v = 1;
+      ::encode(struct_v, bl);
       ::encode(missing, bl);
     }
     void decode(bufferlist::iterator &bl) {
+      __u8 struct_v;
+      ::decode(struct_v, bl);
       ::decode(missing, bl);
 
       for (map<sobject_t,item>::iterator it = missing.begin();
@@ -632,6 +651,8 @@ public:
     bool maybe_went_rw;
 
     void encode(bufferlist& bl) const {
+      __u8 struct_v = 1;
+      ::encode(struct_v, bl);
       ::encode(first, bl);
       ::encode(last, bl);
       ::encode(up, bl);
@@ -639,6 +660,8 @@ public:
       ::encode(maybe_went_rw, bl);
     }
     void decode(bufferlist::iterator& bl) {
+      __u8 struct_v;
+      ::decode(struct_v, bl);
       ::decode(first, bl);
       ::decode(last, bl);
       ::decode(up, bl);
index ef80ca451c25445c7bc4cdf280dc2f07a186506d..0d091c210e45ae1869a5642c7657c10a070951b7 100644 (file)
@@ -43,11 +43,15 @@ struct osd_reqid_t {
   osd_reqid_t() : tid(0), inc(0) {}
   osd_reqid_t(const entity_name_t& a, int i, tid_t t) : name(a), tid(t), inc(i) {}
   void encode(bufferlist &bl) const {
+    __u8 struct_v = 1;
+    ::encode(struct_v, bl);
     ::encode(name, bl);
     ::encode(tid, bl);
     ::encode(inc, bl);
   }
   void decode(bufferlist::iterator &bl) {
+    __u8 struct_v;
+    ::decode(struct_v, bl);
     ::decode(name, bl);
     ::decode(tid, bl);
     ::decode(inc, bl);
@@ -267,10 +271,14 @@ struct coll_t {
   }
 
   void encode(bufferlist& bl) const {
+    __u8 struct_v = 1;
+    ::encode(struct_v, bl);
     ::encode(pgid, bl);
     ::encode(snap, bl);
   }
   void decode(bufferlist::iterator& bl) {
+    __u8 struct_v;
+    ::decode(struct_v, bl);
     ::decode(pgid, bl);
     ::decode(snap, bl);
   }
@@ -520,11 +528,15 @@ struct pool_snap_info_t {
   nstring name;
 
   void encode(bufferlist& bl) const {
+    __u8 struct_v = 1;
+    ::encode(struct_v, bl);
     ::encode(snapid, bl);
     ::encode(stamp, bl);
     ::encode(name, bl);
   }
   void decode(bufferlist::iterator& bl) {
+    __u8 struct_v;
+    ::decode(struct_v, bl);
     ::decode(snapid, bl);
     ::decode(stamp, bl);
     ::decode(name, bl);
@@ -1218,11 +1230,15 @@ struct ScrubMap {
     map<nstring,bufferptr> attrs;
 
     void encode(bufferlist& bl) const {
+      __u8 struct_v = 1;
+      ::encode(struct_v, bl);
       ::encode(poid, bl);
       ::encode(size, bl);
       ::encode(attrs, bl);
     }
     void decode(bufferlist::iterator& bl) {
+      __u8 struct_v;
+      ::decode(struct_v, bl);
       ::decode(poid, bl);
       ::decode(size, bl);
       ::decode(attrs, bl);
@@ -1235,11 +1251,15 @@ struct ScrubMap {
   bufferlist logbl;
 
   void encode(bufferlist& bl) const {
+    __u8 struct_v = 1;
+    ::encode(struct_v, bl);
     ::encode(objects, bl);
     ::encode(attrs, bl);
     ::encode(logbl, bl);
   }
   void decode(bufferlist::iterator& bl) {
+    __u8 struct_v;
+    ::decode(struct_v, bl);
     ::decode(objects, bl);
     ::decode(attrs, bl);
     ::decode(logbl, bl);