X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=iolog.c;h=82b2b8a3ec40084853655a42d5494a4e9bbf91bf;hp=b867583a27bc1f11e649ab8d88936507affcee53;hb=18dc4295f53c83af3feba6861b5bdbaf09d720fe;hpb=3b1ff869610c5efcf683e0d5f5e84accb0f7cb1a diff --git a/iolog.c b/iolog.c index b867583a..82b2b8a3 100644 --- a/iolog.c +++ b/iolog.c @@ -291,6 +291,18 @@ void unlog_io_piece(struct thread_data *td, struct io_u *io_u) { struct io_piece *ipo = io_u->ipo; + if (td->ts.nr_block_infos) { + uint32_t *info = io_u_block_info(td, io_u); + if (BLOCK_INFO_STATE(*info) < BLOCK_STATE_TRIM_FAILURE) { + if (io_u->ddir == DDIR_TRIM) + *info = BLOCK_INFO_SET_STATE(*info, + BLOCK_STATE_TRIM_FAILURE); + else if (io_u->ddir == DDIR_WRITE) + *info = BLOCK_INFO_SET_STATE(*info, + BLOCK_STATE_WRITE_FAILURE); + } + } + if (!ipo) return; @@ -876,10 +888,12 @@ int iolog_file_inflate(const char *file) if (ret < 0) { perror("fread"); fclose(f); + free(buf); return 1; } else if (ret != 1) { log_err("fio: short read on reading log\n"); fclose(f); + free(buf); return 1; } @@ -931,12 +945,15 @@ int iolog_file_inflate(const char *file) #endif -void flush_log(struct io_log *log) +void flush_log(struct io_log *log, int do_append) { void *buf; FILE *f; - f = fopen(log->filename, "w"); + if (!do_append) + f = fopen(log->filename, "w"); + else + f = fopen(log->filename, "a"); if (!f) { perror("fopen log"); return; @@ -966,7 +983,7 @@ static int finish_log(struct thread_data *td, struct io_log *log, int trylock) if (td->client_type == FIO_CLIENT_TYPE_GUI) fio_send_iolog(td, log, log->filename); else - flush_log(log); + flush_log(log, !td->o.per_job_logs); fio_unlock_file(log->filename); free_log(log);