]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: limit propagation of full auth_pin count up hierarchy
authorSage Weil <sage@newdream.net>
Tue, 24 Feb 2009 19:52:56 +0000 (11:52 -0800)
committerSage Weil <sage@newdream.net>
Tue, 24 Feb 2009 19:52:56 +0000 (11:52 -0800)
We only care if there are _some_ auth pins, not the exact count.  So only
propagation whether there are any pings from dir -> inode, to avoid walking
all the way up the hierarchy for each pin/unpin event.

src/mds/CDir.cc

index 67bfff54a42b615b8b8514dde7cb1ce518da0dec..c7972ddda72dea44b9613b3be93cb1c1ac39d79c 100644 (file)
@@ -1708,7 +1708,7 @@ 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());
+    inode->adjust_nested_auth_pins(get_cum_auth_pins() ? -1:0);
     
     // unpin parent of frozen dir/tree?
     if (inode->is_auth() && (is_frozen_tree_root() || is_frozen_dir()))
@@ -1718,7 +1718,7 @@ 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());
+    inode->adjust_nested_auth_pins(get_cum_auth_pins() ? 1:0);
 
     // pin parent of frozen dir/tree?
     if (inode->is_auth() && (is_frozen_tree_root() || is_frozen_dir()))
@@ -1768,7 +1768,8 @@ void CDir::auth_pin(void *by)
   if (is_subtree_root()) return;  // no.
   //assert(!is_import());
 
-  inode->adjust_nested_auth_pins(1);
+  if (get_cum_auth_pins() == 1)
+    inode->adjust_nested_auth_pins(1);
 }
 
 void CDir::auth_unpin(void *by) 
@@ -1793,7 +1794,8 @@ void CDir::auth_unpin(void *by)
   if (is_subtree_root()) return;  // no.
   //assert(!is_import());
 
-  inode->adjust_nested_auth_pins(-1);
+  if (get_cum_auth_pins() == 0)
+    inode->adjust_nested_auth_pins(-1);
 }
 
 void CDir::adjust_nested_auth_pins(int inc, int dirinc) 
@@ -1813,7 +1815,10 @@ void CDir::adjust_nested_auth_pins(int inc, int dirinc)
     return; // no, stop.
 
   // yes.
-  inode->adjust_nested_auth_pins(inc);
+  if (get_cum_auth_pins() == 0)
+    inode->adjust_nested_auth_pins(-1);
+  else if (get_cum_auth_pins() == inc)      
+    inode->adjust_nested_auth_pins(1);
 }
 
 void CDir::adjust_nested_anchors(int by)