The following changes since commit 2c0b784a12172da1533dfd40b66a0e4e5609065f: Merge branch 'thinkcycles-parameter' of https://github.com/cloehle/fio (2023-11-03 11:21:22 -0400) are available in the Git repository at: git://git.kernel.dk/fio.git master for you to fetch changes up to 05fce19c7d2668adb38243636a1781c0f8fae523: docs: add warning to per_job_logs option (2023-11-06 13:46:30 -0500) ---------------------------------------------------------------- Vincent Fu (2): client/server: enable per_job_logs option docs: add warning to per_job_logs option HOWTO.rst | 8 +++++--- client.c | 18 ++++++++++++++---- fio.1 | 6 ++++-- server.c | 1 + server.h | 3 ++- 5 files changed, 26 insertions(+), 10 deletions(-) --- Diff of recent changes: diff --git a/HOWTO.rst b/HOWTO.rst index 42b2b119..d173702b 100644 --- a/HOWTO.rst +++ b/HOWTO.rst @@ -3968,9 +3968,11 @@ Measurements and reporting .. option:: per_job_logs=bool - If set, this generates bw/clat/iops log with per file private filenames. If - not set, jobs with identical names will share the log filename. Default: - true. + If set to true, fio generates bw/clat/iops logs with per job unique + filenames. If set to false, jobs with identical names will share a log + filename. Note that when this option is set to false log files will be + opened in append mode and if log files already exist the previous + contents will not be overwritten. Default: true. .. option:: group_reporting diff --git a/client.c b/client.c index 345fa910..699a2e5b 100644 --- a/client.c +++ b/client.c @@ -1452,10 +1452,13 @@ static int fio_client_handle_iolog(struct fio_client *client, if (store_direct) { ssize_t wrote; size_t sz; - int fd; + int fd, flags; - fd = open((const char *) log_pathname, - O_WRONLY | O_CREAT | O_TRUNC, 0644); + if (pdu->per_job_logs) + flags = O_WRONLY | O_CREAT | O_TRUNC; + else + flags = O_WRONLY | O_CREAT | O_APPEND; + fd = open((const char *) log_pathname, flags, 0644); if (fd < 0) { log_err("fio: open log %s: %s\n", log_pathname, strerror(errno)); @@ -1476,7 +1479,13 @@ static int fio_client_handle_iolog(struct fio_client *client, ret = 0; } else { FILE *f; - f = fopen((const char *) log_pathname, "w"); + const char *mode; + + if (pdu->per_job_logs) + mode = "w"; + else + mode = "a"; + f = fopen((const char *) log_pathname, mode); if (!f) { log_err("fio: fopen log %s : %s\n", log_pathname, strerror(errno)); @@ -1695,6 +1704,7 @@ static struct cmd_iolog_pdu *convert_iolog(struct fio_net_cmd *cmd, ret->log_offset = le32_to_cpu(ret->log_offset); ret->log_prio = le32_to_cpu(ret->log_prio); ret->log_hist_coarseness = le32_to_cpu(ret->log_hist_coarseness); + ret->per_job_logs = le32_to_cpu(ret->per_job_logs); if (*store_direct) return ret; diff --git a/fio.1 b/fio.1 index d62da688..8f659f1d 100644 --- a/fio.1 +++ b/fio.1 @@ -3667,8 +3667,10 @@ interpreted in seconds. .SS "Measurements and reporting" .TP .BI per_job_logs \fR=\fPbool -If set, this generates bw/clat/iops log with per file private filenames. If -not set, jobs with identical names will share the log filename. Default: +If set to true, fio generates bw/clat/iops logs with per job unique filenames. +If set to false, jobs with identical names will share a log filename. Note that +when this option is set to false log files will be opened in append mode and if +log files already exist the previous contents will not be overwritten. Default: true. .TP .BI group_reporting diff --git a/server.c b/server.c index 27332e32..06eac584 100644 --- a/server.c +++ b/server.c @@ -2260,6 +2260,7 @@ int fio_send_iolog(struct thread_data *td, struct io_log *log, const char *name) .thread_number = cpu_to_le32(td->thread_number), .log_type = cpu_to_le32(log->log_type), .log_hist_coarseness = cpu_to_le32(log->hist_coarseness), + .per_job_logs = cpu_to_le32(td->o.per_job_logs), }; struct sk_entry *first; struct flist_head *entry; diff --git a/server.h b/server.h index ad706118..0eb594ce 100644 --- a/server.h +++ b/server.h @@ -51,7 +51,7 @@ struct fio_net_cmd_reply { }; enum { - FIO_SERVER_VER = 101, + FIO_SERVER_VER = 102, FIO_SERVER_MAX_FRAGMENT_PDU = 1024, FIO_SERVER_MAX_CMD_MB = 2048, @@ -198,6 +198,7 @@ struct cmd_iolog_pdu { uint32_t log_offset; uint32_t log_prio; uint32_t log_hist_coarseness; + uint32_t per_job_logs; uint8_t name[FIO_NET_NAME_MAX]; struct io_sample samples[0]; };