]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "mds: adjust export size after renaming directory into freezing subtree" 24050/head
authorYan, Zheng <zyan@redhat.com>
Tue, 11 Sep 2018 09:04:10 +0000 (17:04 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 10 Oct 2018 23:34:13 +0000 (07:34 +0800)
This reverts commit a7076fae36fe085faed2f4a7eeade7cfcd1a2f2e.

Previous commit changes the way to freeze subtree. If a directory get
renamed into into freezing subtree, the renamed inode's dirfrags do not
become freezing. So this commit is no longer needed.

 Conflicts:
src/mds/Migrator.cc
src/mds/Migrator.h

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/CDir.cc
src/mds/CDir.h
src/mds/MDSRank.h
src/mds/Migrator.cc
src/mds/Migrator.h
src/mds/Server.cc

index 8d0307a336d3745b6964cb06fd0a6eae3c825b69..3973fd6b432a6eccdca09c019f1224c1f07fc8f9 100644 (file)
@@ -3053,23 +3053,6 @@ bool CDir::can_auth_pin(int *err_ret) const
   return !err;
 }
 
-CDir *CDir::get_freezing_tree_root()
-{
-  if (num_freezing_trees == 0)
-    return nullptr;
-  CDir *dir = this;
-  while (true) {
-    if (dir->is_freezing_tree_root())
-      return dir;
-    if (dir->is_subtree_root())
-      return nullptr;
-    if (dir->inode->parent)
-      dir = dir->inode->parent->dir;
-    else
-      return nullptr;
-  }
-}
-
 class C_Dir_AuthUnpin : public CDirContext {
   public:
   explicit C_Dir_AuthUnpin(CDir *d) : CDirContext(d) {}
index a4490e062f044fdef8ca7a56e0aa5791e1547070..6b03e063b42ba7c00559d2d4a55ecbe9a26814e5 100644 (file)
@@ -747,7 +747,6 @@ public:
   }
   bool is_freezing_tree_root() const { return state & STATE_FREEZINGTREE; }
   bool is_freezing_dir() const { return state & STATE_FREEZINGDIR; }
-  CDir *get_freezing_tree_root();
 
   bool is_frozen() const override { return is_frozen_dir() || is_frozen_tree(); }
   bool is_frozen_tree() const {
index b5b5579f8eb55ef4bcde6d3a26c037ff61979840..f88ee4caf33f5c0ad182894723f45ffda6c7a2aa 100644 (file)
@@ -309,10 +309,6 @@ class MDSRank {
       finished_queue.push_back(c);
       progress_thread.signal();
     }
-    void queue_waiter_front(MDSInternalContextBase *c) {
-      finished_queue.push_back(c);
-      progress_thread.signal();
-    }
     void queue_waiters(MDSInternalContextBase::vec& ls) {
       MDSInternalContextBase::vec v;
       v.swap(ls);
index 1b06e344ff79337f514db5d611a922776be8648c..db82bc3cf1c626167f4b8e47a27170d5cd013974 100644 (file)
@@ -1105,7 +1105,6 @@ void Migrator::dispatch_export_dir(MDRequestRef& mdr, int count)
 
     it->second.last_cum_auth_pins_change = ceph_clock_now();
     it->second.approx_size = results.front().second;
-    it->second.orig_size = it->second.approx_size;
     total_exporting_size += it->second.approx_size;
 
     // start the freeze, but hold it up with an auth_pin.
@@ -1156,95 +1155,6 @@ void Migrator::dispatch_export_dir(MDRequestRef& mdr, int count)
   export_try_cancel(dir);
 }
 
-void Migrator::restart_export_dir(CDir *dir, uint64_t tid)
-{
-  auto it = export_state.find(dir);
-  if (it == export_state.end() || it->second.tid != tid)
-    return;
-  if (it->second.state != EXPORT_DISCOVERING &&
-      it->second.state != EXPORT_FREEZING)
-    return;
-
-  dout(7) << "restart_export_dir " << *dir << dendl;
-
-  std::shared_ptr<export_base_t> parent;
-  parent.swap(it->second.parent);
-  if (!parent)
-     export_queue.emplace_front(dir->dirfrag(), it->second.peer);
-
-  export_try_cancel(dir);
-
-  if (parent)
-    child_export_finish(parent, true);
-}
-
-class C_MDC_RestartExportDir : public MigratorContext {
-  CDir *dir;
-  uint64_t tid;
-public:
-  C_MDC_RestartExportDir(Migrator *m, CDir *d, uint64_t t) :
-    MigratorContext(m), dir(d), tid(t) {}
-  void finish(int r) override {
-    mig->restart_export_dir(dir, tid);
-  }
-};
-
-bool Migrator::adjust_export_size(export_state_t &stat, CDir *dir)
-{
-  if (dir->state_test(CDir::STATE_EXPORTING) ||
-      dir->is_freezing_dir() || dir->is_frozen_dir())
-    return false;
-
-  if (stat.approx_size >= max_export_size &&
-      stat.approx_size >= stat.orig_size * 2)
-    return false;
-
-  vector<pair<CDir*, size_t> > results;
-  maybe_split_export(dir, max_export_size, true, results);
-  if (results.size() == 1 && results.front().first == dir) {
-    auto size = results.front().second;
-    stat.approx_size += size;
-    total_exporting_size += size;
-    return true;
-  }
-
-  return false;
-}
-
-void Migrator::adjust_export_after_rename(CInode* diri, CDir *olddir)
-{
-  CDir *newdir = diri->get_parent_dir();
-  if (newdir == olddir)
-    return;
-
-  CDir *freezing_dir = newdir->get_freezing_tree_root();
-  CDir *old_freezing_dir = olddir->get_freezing_tree_root();
-  if (!freezing_dir || freezing_dir == old_freezing_dir)
-    return;
-
-  dout(7) << "adjust_export_after_rename " << *diri << dendl;
-
-  auto &stat = export_state.at(freezing_dir);
-  ceph_assert(stat.state == EXPORT_DISCOVERING ||
-              stat.state == EXPORT_FREEZING);
-
-  if (g_conf()->mds_thrash_exports) {
-    if (rand() % 3 == 0) {
-      mds->queue_waiter_front(new C_MDC_RestartExportDir(this, freezing_dir, stat.tid));
-      return;
-    }
-  }
-
-  vector<CDir*> ls;
-  diri->get_nested_dirfrags(ls);
-  for (auto d : ls) {
-    if (!adjust_export_size(stat, d)) {
-      mds->queue_waiter_front(new C_MDC_RestartExportDir(this, freezing_dir, stat.tid));
-      return;
-    }
-  }
-}
-
 void Migrator::child_export_finish(std::shared_ptr<export_base_t>& parent, bool success)
 {
   if (success)
index de1638d776a5484dc1b0b9adfde6ade3b289cd3e..6a0095a802d01043e6aea9919bd683502946931b 100644 (file)
@@ -130,7 +130,6 @@ protected:
     map<inodeno_t,map<client_t,Capability::Import> > peer_imported;
     MutationRef mut;
     size_t approx_size = 0;
-    size_t orig_size = 0;
     // for freeze tree deadlock detection
     utime_t last_cum_auth_pins_change;
     int last_cum_auth_pins = 0;
@@ -319,9 +318,6 @@ public:
   
   void maybe_split_export(CDir* dir, uint64_t max_size, bool null_okay,
                          vector<pair<CDir*, size_t> >& results);
-  void restart_export_dir(CDir *dir, uint64_t tid);
-  bool adjust_export_size(export_state_t &stat, CDir *dir);
-  void adjust_export_after_rename(CInode* diri, CDir *olddir);
   void child_export_finish(std::shared_ptr<export_base_t>& parent, bool success);
 
   void get_export_lock_set(CDir *dir, MutationImpl::LockOpVec& lov);
index f88724d252e83b03e1eb2b6b55efe82902404ffb..ba2508d119d51984ffec977acbb7cce9939d684a 100644 (file)
@@ -8122,13 +8122,9 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C
   mdr->apply();
 
   // update subtree map?
-  if (destdnl->is_primary() && in->is_dir()) {
+  if (destdnl->is_primary() && in->is_dir())
     mdcache->adjust_subtree_after_rename(in, srcdn->get_dir(), true);
 
-    if (destdn->is_auth())
-      mdcache->migrator->adjust_export_after_rename(in, srcdn->get_dir());
-  }
-
   if (straydn && oldin->is_dir())
     mdcache->adjust_subtree_after_rename(oldin, destdn->get_dir(), true);