]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: make dirfrag thrashing join and split
authorSage Weil <sage@newdream.net>
Mon, 15 Nov 2010 21:24:24 +0000 (13:24 -0800)
committerSage Weil <sage@newdream.net>
Tue, 16 Nov 2010 20:09:00 +0000 (12:09 -0800)
Signed-off-by: Sage Weil <sage@newdream.net>
src/mds/MDBalancer.cc
src/mds/MDBalancer.h
src/mds/MDS.cc

index da08bf1949ebf34b371c48fc2316ae0ee84f4a19..9a932101f9260a05c9651077912693ac4699f0a6 100644 (file)
@@ -314,6 +314,11 @@ void MDBalancer::queue_split(CDir *dir)
   split_queue.insert(dir->dirfrag());
 }
 
+void MDBalancer::queue_merge(CDir *dir)
+{
+  merge_queue.insert(dir->dirfrag());
+}
+
 void MDBalancer::do_fragmenting()
 {
   if (split_queue.empty() && merge_queue.empty()) {
index e4eb530b4494afc03483e91c7e0b7a9eec92dc05..2b983787a07cb5517e3d35b64cdf34332dcf7dcd 100644 (file)
@@ -117,6 +117,7 @@ public:
   void dump_pop_map();  
 
   void queue_split(CDir *dir);
+  void queue_merge(CDir *dir);
 
 };
 
index af6e3afa5e1d39b2614e96e0ca52577d48dbea73..4e851fe005064b3f0cfb9b7157f8ab827f5d70ae 100644 (file)
@@ -1698,7 +1698,10 @@ do { \
     CDir *dir = ls.front();
     if (!dir->get_parent_dir()) continue;    // must be linked.
     if (!dir->is_auth()) continue;           // must be auth.
-    mdcache->split_dir(dir, 1);// + (rand() % 3));
+    if (dir->get_frag() == frag_t() || (rand() % 3 == 0)) {
+      mdcache->split_dir(dir, 1);
+    } else
+      balancer->queue_merge(dir);
   }
 
   // hack: force hash root?