static FLIST_HEAD(arg_list);
-static struct thread_stat client_ts;
-static struct group_run_stats client_gs;
-static int sum_stat_clients;
+struct thread_stat client_ts;
+struct group_run_stats client_gs;
+int sum_stat_clients;
+
static int sum_stat_nr;
#define FIO_CLIENT_HASH_BITS 7
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 NULL;
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);
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)
{
client->fd = -1;
client->ops = ops;
+ client->refs = 1;
__fio_client_add_cmd_option(client, "fio");
client->fd = -1;
client->ops = ops;
+ client->refs = 1;
__fio_client_add_cmd_option(client, "fio");
retval = 1;
} else if (client->error)
retval = 1;
+ put_client(client);
}
}