]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
msg/async: avoid set out of range ms_async_op_threads option 11200/head
authorHaomai Wang <haomai@xsky.com>
Thu, 22 Sep 2016 15:15:58 +0000 (23:15 +0800)
committerHaomai Wang <haomai@xsky.com>
Thu, 22 Sep 2016 17:23:29 +0000 (01:23 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/msg/async/Event.h
src/msg/async/Stack.cc

index eb3397623c2550922f87669eb015f047d03c1ec6..925425ae121e31640e2e78d02c9d2e281f434d12 100644 (file)
@@ -84,11 +84,13 @@ class EventDriver {
  * EventCenter maintain a set of file descriptor and handle registered events.
  */
 class EventCenter {
-
-  using clock_type = ceph::coarse_mono_clock;
+ public:
   // should be enough;
   static const int MAX_EVENTCENTER = 24;
 
+ private:
+  using clock_type = ceph::coarse_mono_clock;
+
   struct AssociatedCenters {
     EventCenter *centers[MAX_EVENTCENTER];
     AssociatedCenters(CephContext *c) {
index 25e1d5862f1a9046eb260751452012eef93e9a53..8462443895051bd983565aa59e3135eb325bd731 100644 (file)
@@ -69,6 +69,14 @@ NetworkStack::NetworkStack(CephContext *c, const string &t): type(t), started(fa
 {
   const uint64_t InitEventNumber = 5000;
   num_workers = cct->_conf->ms_async_op_threads;
+  if (num_workers >= EventCenter::MAX_EVENTCENTER) {
+    ldout(cct, 0) << __func__ << " max thread limit is "
+                  << EventCenter::MAX_EVENTCENTER << ", switching to this now. "
+                  << "Higher thread values are unnecessary and currently unsupported."
+                  << dendl;
+    num_workers = EventCenter::MAX_EVENTCENTER;
+  }
+
   for (unsigned i = 0; i < num_workers; ++i) {
     Worker *w = create_worker(cct, type, i);
     w->center.init(InitEventNumber, i);