aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan D. Brunelle <alan.brunelle@hp.com>2009-02-11 16:16:12 -0500
committerAlan D. Brunelle <alan.brunelle@hp.com>2009-02-11 16:16:12 -0500
commit3b552a2d1ff8ecccbbb82668f73d1cb134fca1e9 (patch)
tree410f5b6a67d5018c32554b441427c086b77128ae
parente6855475478967e7cf92f8beece05ea55d31e6f1 (diff)
downloadblktrace-3b552a2d1ff8ecccbbb82668f73d1cb134fca1e9.tar.gz
Moved starting of tracing after tracers are going
Hold off BLKTRACESTART to threads are ready to consume tracers.
-rw-r--r--blktrace.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/blktrace.c b/blktrace.c
index 00ce045..d27ab05 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -933,19 +933,29 @@ static void setup_buts(void)
if (ioctl(dpp->fd, BLKTRACESETUP, &buts) < 0) {
fprintf(stderr, "BLKTRACESETUP(2) %s failed: %d/%s\n",
dpp->path, errno, strerror(errno));
- continue;
- } else if (ioctl(dpp->fd, BLKTRACESTART) < 0) {
+ }
+ else {
+ dpp->ncpus = ncpus;
+ dpp->buts_name = strdup(buts.name);
+ if (dpp->stats)
+ free(dpp->stats);
+ dpp->stats = calloc(dpp->ncpus, sizeof(*dpp->stats));
+ memset(dpp->stats, 0, dpp->ncpus * sizeof(*dpp->stats));
+ }
+ }
+}
+
+static void start_buts(void)
+{
+ struct list_head *p;
+
+ __list_for_each(p, &devpaths) {
+ struct devpath *dpp = list_entry(p, struct devpath, head);
+
+ if (ioctl(dpp->fd, BLKTRACESTART) < 0) {
fprintf(stderr, "BLKTRACESTART %s failed: %d/%s\n",
dpp->path, errno, strerror(errno));
- continue;
}
-
- dpp->ncpus = ncpus;
- dpp->buts_name = strdup(buts.name);
- if (dpp->stats)
- free(dpp->stats);
- dpp->stats = calloc(dpp->ncpus, sizeof(*dpp->stats));
- memset(dpp->stats, 0, dpp->ncpus * sizeof(*dpp->stats));
}
}
@@ -2557,6 +2567,8 @@ int main(int argc, char *argv[])
pthread_cond_broadcast(&ub_cond);
pthread_mutex_unlock(&ub_mutex);
+ start_buts();
+
if (net_mode == Net_client)
printf("blktrace: connected!\n");