client: use temp buffer for client text output
authorJens Axboe <axboe@kernel.dk>
Fri, 7 Sep 2018 18:04:14 +0000 (12:04 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 7 Sep 2018 18:04:14 +0000 (12:04 -0600)
Don't split it into pieces, log it into a local buffer and then
flush it all at once.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
client.c

index 31c7c6495790e91018cface694803ff9bfcefa1e..2d8a2bb151fbc52db553cf5cca5c59871181cac7 100644 (file)
--- a/client.c
+++ b/client.c
@@ -1144,13 +1144,16 @@ static void handle_text(struct fio_client *client, struct fio_net_cmd *cmd)
        const char *buf = (const char *) pdu->buf;
        const char *name;
        int fio_unused ret;
+       struct buf_output out;
+
+       buf_output_init(&out);
 
        name = client->name ? client->name : client->hostname;
 
        if (!client->skip_newline && !(output_format & FIO_OUTPUT_TERSE))
-               fprintf(f_out, "<%s> ", name);
-       ret = fwrite(buf, pdu->buf_len, 1, f_out);
-       fflush(f_out);
+               log_buf(&out, "<%s> ", name);
+       log_buf(&out, "%s", buf);
+       log_info_buf(out.buf, out.buflen);
        client->skip_newline = strchr(buf, '\n') == NULL;
 }