]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mdstypes: add a same_sums() function to nest_info_t
authorGreg Farnum <greg@inktank.com>
Fri, 26 Sep 2014 01:02:58 +0000 (18:02 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Fri, 7 Nov 2014 19:48:43 +0000 (11:48 -0800)
operator== is checking equality of the version as well, but I want
something I can use to check that the internal sums match. This is useful
for eg comparing the sums of a set of dirfrags to the tally stored in
the inode.

Signed-off-by: Greg Farnum <greg@inktank.com>
src/mds/mdstypes.h

index 59d79cf0b3188b6495c4b8d1c9315c044aa9df6a..d9106fe75c59b7c5be76904acf72d3b24d1a9f5b 100644 (file)
@@ -202,6 +202,14 @@ struct nest_info_t : public scatter_info_t {
     rsnaprealms += cur.rsnaprealms - acc.rsnaprealms;
   }
 
+  bool same_sums(const nest_info_t &o) const {
+    return rctime == o.rctime &&
+        rbytes == o.rbytes &&
+        rfiles == o.rfiles &&
+        rsubdirs == o.rsubdirs &&
+        rsnaprealms == o.rsnaprealms;
+  }
+
   void encode(bufferlist &bl) const;
   void decode(bufferlist::iterator& bl);
   void dump(Formatter *f) const;