projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Windows fio: implement some more POSIX functions
[fio.git]
/
client.c
diff --git
a/client.c
b/client.c
index 8c85d2b5c6a673f433f2930fbb41c6a70e8b354b..7c9910961e7dee6685cd473b5d2193c0cd8a0391 100644
(file)
--- a/
client.c
+++ b/
client.c
@@
-37,6
+37,7
@@
struct fio_client {
char *hostname;
int port;
int fd;
char *hostname;
int port;
int fd;
+ unsigned int refs;
char *name;
char *name;
@@
-119,8
+120,10
@@
static struct fio_client *find_client_by_fd(int fd)
flist_for_each(entry, &client_hash[bucket]) {
client = flist_entry(entry, struct fio_client, hash_list);
flist_for_each(entry, &client_hash[bucket]) {
client = flist_entry(entry, struct fio_client, hash_list);
- if (client->fd == fd)
+ if (client->fd == fd) {
+ client->refs++;
return client;
return client;
+ }
}
return NULL;
}
return NULL;
@@
-128,6
+131,11
@@
static struct fio_client *find_client_by_fd(int fd)
static void remove_client(struct fio_client *client)
{
static void remove_client(struct fio_client *client)
{
+ assert(client->refs);
+
+ if (--client->refs)
+ return;
+
dprint(FD_NET, "client: removed <%s>\n", client->hostname);
flist_del(&client->list);
dprint(FD_NET, "client: removed <%s>\n", client->hostname);
flist_del(&client->list);
@@
-149,6
+157,11
@@
static void remove_client(struct fio_client *client)
sum_stat_clients--;
}
sum_stat_clients--;
}
+static void put_client(struct fio_client *client)
+{
+ remove_client(client);
+}
+
static void __fio_client_add_cmd_option(struct fio_client *client,
const char *opt)
{
static void __fio_client_add_cmd_option(struct fio_client *client,
const char *opt)
{
@@
-215,6
+228,7
@@
int fio_client_add(const char *hostname, void **cookie)
return -1;
client->fd = -1;
return -1;
client->fd = -1;
+ client->refs = 1;
__fio_client_add_cmd_option(client, "fio");
__fio_client_add_cmd_option(client, "fio");
@@
-330,6
+344,11
@@
static void sig_int(int sig)
fio_clients_terminate();
}
fio_clients_terminate();
}
+static void sig_show_status(int sig)
+{
+ show_running_run_stats();
+}
+
static void client_signal_handler(void)
{
struct sigaction act;
static void client_signal_handler(void)
{
struct sigaction act;
@@
-343,6
+362,11
@@
static void client_signal_handler(void)
act.sa_handler = sig_int;
act.sa_flags = SA_RESTART;
sigaction(SIGTERM, &act, NULL);
act.sa_handler = sig_int;
act.sa_flags = SA_RESTART;
sigaction(SIGTERM, &act, NULL);
+
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = sig_show_status;
+ act.sa_flags = SA_RESTART;
+ sigaction(SIGUSR1, &act, NULL);
}
static void probe_client(struct fio_client *client)
}
static void probe_client(struct fio_client *client)
@@
-701,6
+725,7
@@
static void convert_jobs_eta(struct jobs_eta *je)
je->elapsed_sec = le64_to_cpu(je->elapsed_sec);
je->eta_sec = le64_to_cpu(je->eta_sec);
je->elapsed_sec = le64_to_cpu(je->elapsed_sec);
je->eta_sec = le64_to_cpu(je->eta_sec);
+ je->is_pow2 = le32_to_cpu(je->is_pow2);
}
static void sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je)
}
static void sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je)
@@
-792,9
+817,9
@@
static void handle_probe(struct fio_client *client, struct fio_net_cmd *cmd)
sprintf(bit, "%d-bit", probe->bpp * 8);
sprintf(bit, "%d-bit", probe->bpp * 8);
- log_info("hostname=%s, be=%u, %s, os=%s, arch=%s, fio=%
u.%u.%u
\n",
+ log_info("hostname=%s, be=%u, %s, os=%s, arch=%s, fio=%
s
\n",
probe->hostname, probe->bigendian, bit, os, arch,
probe->hostname, probe->bigendian, bit, os, arch,
- probe->fio_
major, probe->fio_minor, probe->fio_patch
);
+ probe->fio_
version
);
if (!client->name)
client->name = strdup((char *) probe->hostname);
if (!client->name)
client->name = strdup((char *) probe->hostname);
@@
-1055,6
+1080,7
@@
int fio_handle_clients(void)
retval = 1;
} else if (client->error)
retval = 1;
retval = 1;
} else if (client->error)
retval = 1;
+ put_client(client);
}
}
}
}