]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: only adjust inode auth_pins if we have cum auth pins
authorSage Weil <sage@newdream.net>
Thu, 12 Mar 2009 18:57:26 +0000 (11:57 -0700)
committerSage Weil <sage@newdream.net>
Thu, 12 Mar 2009 21:20:05 +0000 (14:20 -0700)
Add some assertions to that effect.

src/mds/CDir.cc
src/mds/CInode.cc

index 0d2ece723fb6229ce31cc042504be3141e002f2e..635c84bcc5fce0d85e219bd238a217080d0f0d89 100644 (file)
@@ -1708,7 +1708,8 @@ void CDir::set_dir_auth(pair<int,int> a)
     dout(10) << " new subtree root, adjusting auth_pins" << dendl;
     
     // adjust nested auth pins
-    inode->adjust_nested_auth_pins(get_cum_auth_pins() ? -1:0);
+    if (get_cum_auth_pins())
+      inode->adjust_nested_auth_pins(-1);
     
     // unpin parent of frozen dir/tree?
     if (inode->is_auth() && (is_frozen_tree_root() || is_frozen_dir()))
@@ -1718,7 +1719,8 @@ void CDir::set_dir_auth(pair<int,int> a)
     dout(10) << " old subtree root, adjusting auth_pins" << dendl;
     
     // adjust nested auth pins
-    inode->adjust_nested_auth_pins(get_cum_auth_pins() ? 1:0);
+    if (get_cum_auth_pins())
+      inode->adjust_nested_auth_pins(1);
 
     // pin parent of frozen dir/tree?
     if (inode->is_auth() && (is_frozen_tree_root() || is_frozen_dir()))
@@ -1798,6 +1800,7 @@ void CDir::auth_unpin(void *by)
 
 void CDir::adjust_nested_auth_pins(int inc, int dirinc) 
 {
+  assert(inc);
   nested_auth_pins += inc;
   dir_auth_pins += dirinc;
   
@@ -1821,6 +1824,7 @@ void CDir::adjust_nested_auth_pins(int inc, int dirinc)
 
 void CDir::adjust_nested_anchors(int by)
 {
+  assert(by);
   nested_anchors += by;
   dout(20) << "adjust_nested_anchors by " << by << " -> " << nested_anchors << dendl;
   assert(nested_anchors >= 0);
index d848812a84dcf59ea0e1419349b0bfb6f4f389d9..b239990ac4ea6d447cc527cb64ba19ea6a8c5bef 100644 (file)
@@ -1169,6 +1169,7 @@ void CInode::auth_unpin(void *by)
 
 void CInode::adjust_nested_auth_pins(int a)
 {
+  assert(a);
   nested_auth_pins += a;
   dout(35) << "adjust_nested_auth_pins by " << a
           << " now " << auth_pins << "+" << nested_auth_pins
@@ -1181,6 +1182,7 @@ void CInode::adjust_nested_auth_pins(int a)
 
 void CInode::adjust_nested_anchors(int by)
 {
+  assert(by);
   nested_anchors += by;
   dout(20) << "adjust_nested_anchors by " << by << " -> " << nested_anchors << dendl;
   assert(nested_anchors >= 0);