]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: journal open srci frags on srci import (master)
authorSage Weil <sage.weil@dreamhost.com>
Wed, 8 Jun 2011 03:46:42 +0000 (20:46 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 8 Jun 2011 03:46:42 +0000 (20:46 -0700)
If we are importing the renamed inode, and it is a directory, journal a
list of all open dirfrags (currently, this is actually all frags) so that
we can open them up during journal replay.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/mds/Server.cc
src/mds/events/EMetaBlob.h

index 877505ccedc391b597064a7a76d65241981e6755..332eb2cb242192d1cb7d9440b118f8cfda09a270 100644 (file)
@@ -5186,8 +5186,21 @@ void Server::_rename_prepare(MDRequest *mdr,
       version_t oldpv;
       if (srcdn->is_auth())
        oldpv = srci->get_projected_version();
-      else
+      else {
        oldpv = _rename_prepare_import(mdr, srcdn, client_map_bl);
+
+       // note which dirfrags have child subtrees in the journal
+       // event, so that we can open those (as bounds) during replay.
+       if (srci->is_dir()) {
+         list<CDir*> ls;
+         srci->get_dirfrags(ls);
+         for (list<CDir*>::iterator p = ls.begin(); p != ls.end(); ++p) {
+           CDir *dir = *p;
+           metablob->renamed_dir_frags.push_back(dir->get_frag());
+         }
+         dout(10) << " noting renamed dir open frags " << metablob->renamed_dir_frags << dendl;
+       }
+      }
       pi = srci->project_inode(); // project snaprealm if srcdnl->is_primary
                                                  // & srcdnl->snaprealm
       pi->version = mdr->more()->pvmap[destdn] = destdn->pre_dirty(oldpv);
index 3eee2d0243ff3213d2615c99bf6fda0284477dce..313c60404cceb7414719b4d26401706e7fef991a 100644 (file)
@@ -354,6 +354,7 @@ private:
   inodeno_t opened_ino;
 public:
   inodeno_t renamed_dirino;
+  list<frag_t> renamed_dir_frags;
 private:
   
   // ino (pre)allocation.  may involve both inotable AND session state.
@@ -395,6 +396,7 @@ private:
     ::encode(destroyed_inodes, bl);
     ::encode(client_reqs, bl);
     ::encode(renamed_dirino, bl);
+    ::encode(renamed_dir_frags, bl);
   } 
   void decode(bufferlist::iterator &bl) {
     __u8 struct_v;
@@ -428,8 +430,10 @@ private:
        r.pop_front();
       }
     }
-    if (struct_v >= 3)
+    if (struct_v >= 3) {
       ::decode(renamed_dirino, bl);
+      ::decode(renamed_dir_frags, bl);
+    }
   }