about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-06-21 03:34:13 +0000
committerEric Wong <normalperson@yhbt.net>2013-06-25 21:25:23 +0000
commit2376ed3c3da3bd2c9e8326e7dd75be2188fffc35 (patch)
treeaafc7868e697e25bcda54b8db77b0cf4b89c7150
parente90b43119ff33fb591ffb3bc100cf847537ca5fb (diff)
downloadcmogstored-2376ed3c3da3bd2c9e8326e7dd75be2188fffc35.tar.gz
If the mogstored sidechannel is inactive (in HTTP-only mode), we should
still count the number of devices correctly to correctly scale the
number of worker threads.
-rw-r--r--dev.c10
-rw-r--r--svc_dev.c3
2 files changed, 8 insertions, 5 deletions
diff --git a/dev.c b/dev.c
index 92225a0..aa915b9 100644
--- a/dev.c
+++ b/dev.c
@@ -84,10 +84,16 @@ const struct mog_dev *dev, struct mog_svc *svc, int fd, struct statvfs *v)
 int mog_dev_mkusage(const struct mog_dev *dev, struct mog_svc *svc)
 {
         struct statvfs v;
-        char *usage_path = xasprintf("%s/usage", dev->prefix);
-        char *tmp_path = xasprintf("%s.%x", usage_path, (unsigned)getpid());
+        char *usage_path;
+        char *tmp_path;
         int fd = -1;
 
+        if (!svc->mgmt_mfd)
+                return 0;
+
+        usage_path = xasprintf("%s/usage", dev->prefix);
+        tmp_path = xasprintf("%s.%x", usage_path, (unsigned)getpid());
+
         if (mog_unlink(svc, tmp_path) < 0 && errno != ENOENT) goto out;
 
         errno = 0;
diff --git a/svc_dev.c b/svc_dev.c
index 566602c..68d8e3b 100644
--- a/svc_dev.c
+++ b/svc_dev.c
@@ -108,9 +108,6 @@ static int svc_scandev(struct mog_svc *svc, size_t *nr, mog_scandev_cb cb)
         struct dirent *ent;
         int rc = 0;
 
-        if (svc->mgmt_mfd == NULL)
-                return 0;
-
         CHECK(int, 0, pthread_mutex_lock(&svc->devstats_lock));
         svc_init_dev_hash(svc);
         rewinddir(svc->dir);