]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: always use get_snap_context() accessor
authorSage Weil <sage@newdream.net>
Wed, 22 Jun 2011 19:45:35 +0000 (12:45 -0700)
committerSage Weil <sage@newdream.net>
Wed, 22 Jun 2011 20:57:25 +0000 (13:57 -0700)
There were a few places where we were using the member directly and not the
accessor, which rebuilds the internal value when needed.  This caused
inconsistent behavior based on whether debugging was enabled or not, since
we used the accessor to print the regenerated value.

Passes all snaps workunits with debugging off.

Signed-off-by: Sage Weil <sage@newdream.net>
src/client/Client.cc
src/client/Client.h

index b521d4eecc9fbe14cd0070e43103548384b40b96..59d3311e1e7caaf692de6f913cfa70023685f6f7 100644 (file)
@@ -2055,7 +2055,7 @@ void Client::queue_cap_snap(Inode *in, snapid_t seq)
             (dirty & CEPH_CAP_ANY_WR)) {
     in->get();
     CapSnap *capsnap = &in->cap_snaps[seq];
-    capsnap->context = in->snaprealm->cached_snap_context;
+    capsnap->context = in->snaprealm->get_snap_context();
     capsnap->issued = in->caps_issued();
     capsnap->dirty = in->caps_dirty();  // a bit conservative?
     
@@ -2582,7 +2582,7 @@ inodeno_t Client::update_snap_trace(bufferlist& bl, bool flush)
          while (!p.end()) {
            Inode *in = *p;
            ++p;
-           queue_cap_snap(in, realm->cached_snap_context.seq);
+           queue_cap_snap(in, realm->get_snap_context().seq);
          }
          
          for (set<SnapRealm*>::iterator p = realm->pchildren.begin(); 
@@ -2656,7 +2656,7 @@ void Client::handle_snap(MClientSnap *m)
        dout(10) << " moving " << *in << " from " << *in->snaprealm << dendl;
 
        // queue for snap writeback
-       queue_cap_snap(in, in->snaprealm->cached_snap_context.seq);
+       queue_cap_snap(in, in->snaprealm->get_snap_context().seq);
 
        put_snap_realm(in->snaprealm);
        in->snaprealm_item.remove_myself();
index 11db91ded17ee2b7d7be0484492e34b96fbdaa7a..81af6b4893f089c2854e83195961471868f18aa4 100644 (file)
@@ -302,8 +302,11 @@ struct SnapRealm {
   SnapRealm *pparent;
   set<SnapRealm*> pchildren;
 
+private:
   SnapContext cached_snap_context;  // my_snaps + parent snaps + past_parent_snaps
+  friend ostream& operator<<(ostream& out, const SnapRealm& r);
 
+public:
   xlist<Inode*> inodes_with_caps;
 
   SnapRealm(inodeno_t i) :