about summary refs log tree commit homepage
path: root/mgmt_fn.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-11-09 04:46:43 +0000
committerEric Wong <normalperson@yhbt.net>2012-11-12 20:29:12 +0000
commit5c73abe7d6acc66ff7177e31dd0c75f67c53d9f0 (patch)
tree295819f818fc64dc1074745fc700efeed4cfd315 /mgmt_fn.c
parent1d7604267fc661f45a95e3d4ebda5bababe7bb8a (diff)
downloadcmogstored-5c73abe7d6acc66ff7177e31dd0c75f67c53d9f0.tar.gz
mgmt: support "server aio_threads = <digit>"
This allows tunable thread counts at runtime like regular
mogstored (using Perlbal).
Diffstat (limited to 'mgmt_fn.c')
-rw-r--r--mgmt_fn.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mgmt_fn.c b/mgmt_fn.c
index db0c4f7..b2e2939 100644
--- a/mgmt_fn.c
+++ b/mgmt_fn.c
@@ -178,3 +178,25 @@ void mog_mgmt_fn_watch_err(struct mog_mgmt *mgmt)
         IOV_STR(&iov, "ERR iostat unavailable\r\n");
         mog_mgmt_writev(mgmt, &iov, 1);
 }
+
+void mog_mgmt_fn_aio_threads(struct mog_mgmt *mgmt, char *buf)
+{
+        char *end;
+        unsigned long long nr;
+        struct mog_queue *q = mgmt->svc->queue;
+        char *nptr = buf + mgmt->mark[0];
+        char *eor = nptr + mgmt->mark[1] - mgmt->mark[0];
+        struct iovec iov;
+
+        assert((*eor == '\n' || *eor == '\r') && "missing end-of-record");
+        *eor = 0;
+
+        nr = strtoull(nptr, &end, 10);
+        assert(*end == 0 && "ragel misfed mog_mgmt_fn_set_aio_threads");
+
+        if (nr > 0 && nr <= 100)
+                mog_thrpool_set_n_threads(q, nr);
+
+        IOV_STR(&iov, "\r\n");
+        mog_mgmt_writev(mgmt, &iov, 1);
+}