]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: maintain dirty_rstat list
authorSage Weil <sage@newdream.net>
Thu, 23 Sep 2010 20:05:06 +0000 (13:05 -0700)
committerSage Weil <sage@newdream.net>
Fri, 24 Sep 2010 18:44:22 +0000 (11:44 -0700)
Add on fetch or import of dirty_rstat; clear on export of dirty_rstat.

src/mds/CDentry.cc
src/mds/CDir.cc
src/mds/Migrator.cc
src/mds/mdstypes.h

index b6aee128a0be50346b71f10dd0083692290d2884..8c87d97dc79d2de74ea68a47329eaf6153d5ce7a 100644 (file)
@@ -295,8 +295,16 @@ void CDentry::unlink_remote(CDentry::linkage_t *dnl)
 
 void CDentry::push_projected_linkage(CInode *inode)
 {
+  // dirty rstat tracking is in the projected plane
+  bool dirty_rstat = inode->is_dirty_rstat();
+  if (dirty_rstat)
+    inode->clear_dirty_rstat();
+
   _project_linkage()->inode = inode;
   inode->push_projected_parent(this);
+
+  if (dirty_rstat)
+    inode->mark_dirty_rstat();
 }
 
 CDentry::linkage_t *CDentry::pop_projected_linkage()
index b76746c9b4446a9be8fb41d35c15f0510ab5eb99..359835a1afa6ed93102197e146c927ca2f35e8ba 100644 (file)
@@ -1298,6 +1298,9 @@ void CDir::_fetched(bufferlist &bl, const string& want_dn)
          dn = add_primary_dentry(dname, in, first, last);
          dout(12) << "_fetched  got " << *dn << " " << *in << dendl;
 
+         if (in->inode.is_dirty_rstat())
+           in->mark_dirty_rstat();
+
          //in->hack_accessed = false;
          //in->hack_load_stamp = g_clock.now();
          //num_new_inodes_loaded++;
index d36745befe5cb41260e0756ea6cc7bc957d811ec..8d4b2a8d8043656a6a9545049463a73cfb673aef 100644 (file)
@@ -997,6 +997,8 @@ void Migrator::finish_export_inode(CInode *in, utime_t now, list<Context*>& fini
   in->state_clear(CInode::STATE_AUTH);
   in->replica_nonce = CInode::EXPORT_NONCE;
   
+  in->clear_dirty_rstat();
+
   // waiters
   in->take_waiting(CInode::WAIT_ANY_MASK, finished);
   
@@ -2124,6 +2126,9 @@ void Migrator::decode_import_inode(CDentry *dn, bufferlist::iterator& blp, int o
   } else {
     dout(10) << "  had " << *in << dendl;
   }
+
+  if (in->inode.is_dirty_rstat())
+    in->mark_dirty_rstat();
   
   // clear if dirtyscattered, since we're going to journal this
   //  but not until we _actually_ finish the import...
index 5bbbe610baa851d68b0b94b72092fe3986db4912..f33c85a89ea7bf7358c9d2ad775611a64ab03265 100644 (file)
@@ -961,6 +961,8 @@ struct inode_t {
     return layout.fl_object_size * layout.fl_stripe_count;
   }
 
+  bool is_dirty_rstat() const { return !(rstat == accounted_rstat); }
+
   uint64_t get_max_size() const {
     uint64_t max = 0;
       for (map<client_t,client_writeable_range_t>::const_iterator p = client_ranges.begin();