]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd_types: add nlink and snapcolls fields to ScrubMap::object
authorSamuel Just <sam.just@inktank.com>
Wed, 9 Jan 2013 19:53:52 +0000 (11:53 -0800)
committerSamuel Just <sam.just@inktank.com>
Wed, 16 Jan 2013 22:42:47 +0000 (14:42 -0800)
Signed-off-by: Samuel Just <sam.just@inktank.com>
src/osd/osd_types.cc
src/osd/osd_types.h

index c534611a36194c9a54b100a5a02d2f6c833dcc58..b98613ccd434899a0ed2a08f6f618f197347b886 100644 (file)
@@ -2756,18 +2756,20 @@ void ScrubMap::generate_test_instances(list<ScrubMap*>& o)
 
 void ScrubMap::object::encode(bufferlist& bl) const
 {
-  ENCODE_START(3, 2, bl);
+  ENCODE_START(4, 2, bl);
   ::encode(size, bl);
   ::encode(negative, bl);
   ::encode(attrs, bl);
   ::encode(digest, bl);
   ::encode(digest_present, bl);
+  ::encode(nlinks, bl);
+  ::encode(snapcolls, bl);
   ENCODE_FINISH(bl);
 }
 
 void ScrubMap::object::decode(bufferlist::iterator& bl)
 {
-  DECODE_START_LEGACY_COMPAT_LEN(3, 2, 2, bl);
+  DECODE_START_LEGACY_COMPAT_LEN(4, 2, 2, bl);
   ::decode(size, bl);
   ::decode(negative, bl);
   ::decode(attrs, bl);
@@ -2779,6 +2781,14 @@ void ScrubMap::object::decode(bufferlist::iterator& bl)
     digest = 0;
     digest_present = false;
   }
+  if (struct_v >= 4) {
+    ::decode(nlinks, bl);
+    ::decode(snapcolls, bl);
+  } else {
+    /* Indicates that encoder was not aware of this field since stat must
+     * return nlink >= 1 */
+    nlinks = 0;
+  }
   DECODE_FINISH(bl);
 }
 
index 9eeb49af89b4f9407541f0241ed35d06dc2d8167..89c40b246c43a490ffe2ec6d706d6ae210558326 100644 (file)
@@ -1828,8 +1828,12 @@ struct ScrubMap {
     map<string,bufferptr> attrs;
     __u32 digest;
     bool digest_present;
+    uint32_t nlinks;
+    set<snapid_t> snapcolls;
 
-    object(): size(0), negative(false), digest(0), digest_present(false) {}
+    object() :
+      size(0), negative(false), digest(0), digest_present(false),
+      nlinks(0) {}
 
     void encode(bufferlist& bl) const;
     void decode(bufferlist::iterator& bl);