]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSDMonitor: be a little nicer about letting users do pg splitting
authorGreg Farnum <greg@inktank.com>
Fri, 1 Nov 2013 22:45:02 +0000 (15:45 -0700)
committerGreg Farnum <greg@inktank.com>
Fri, 1 Nov 2013 23:33:37 +0000 (16:33 -0700)
We were previously blocking pg splits whenever pg creations were in-
progress, but we only really need to avoid splitting any pgs which are
currently being created. Let the user set a different pg_num if there
are no creating PGs on the pool in question.

Fixes: #6673, take two
Signed-off-by: Greg Farnum <greg@inktank.com>
src/mon/OSDMonitor.cc

index d56953ba069913ccd23f34f05f42e50539a2c25b..07775fce2bf9a58d24c66770dbbb42931418dca3 100644 (file)
@@ -2781,10 +2781,15 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
     }
     if (n <= (int)p.get_pg_num()) {
       ss << "specified pg_num " << n << " <= current " << p.get_pg_num();
-    } else if (!mon->pgmon()->pg_map.creating_pgs.empty()) {
-      ss << "currently creating pgs, wait";
-      return -EAGAIN;
     } else {
+      for(set<pg_t>::iterator i = mon->pgmon()->pg_map.creating_pgs.begin();
+         i != mon->pgmon()->pg_map.creating_pgs.end();
+         ++i) {
+       if (i->m_pool == static_cast<uint64_t>(pool)) {
+         ss << "currently creating pgs, wait";
+         return -EAGAIN;
+       }
+      }
       p.set_pg_num(n);
       ss << "set pool " << pool << " pg_num to " << n;
     }
@@ -2797,10 +2802,15 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
       ss << "specified pgp_num must > 0, but you set to " << n;
     } else if (n > (int)p.get_pg_num()) {
       ss << "specified pgp_num " << n << " > pg_num " << p.get_pg_num();
-    } else if (!mon->pgmon()->pg_map.creating_pgs.empty()) {
-      ss << "still creating pgs, wait";
-      return -EAGAIN;
     } else {
+      for(set<pg_t>::iterator i = mon->pgmon()->pg_map.creating_pgs.begin();
+         i != mon->pgmon()->pg_map.creating_pgs.end();
+         ++i) {
+       if (i->m_pool == static_cast<uint64_t>(pool)) {
+         ss << "currently creating pgs, wait";
+         return -EAGAIN;
+       }
+      }
       p.set_pgp_num(n);
       ss << "set pool " << pool << " pgp_num to " << n;
     }