*/
#include <stdio.h>
#include <stdlib.h>
+#include <libgen.h>
#include <assert.h>
-#include "list.h"
+#include "flist.h"
#include "fio.h"
static const char iolog_ver2[] = "fio version 2 iolog";
void queue_io_piece(struct thread_data *td, struct io_piece *ipo)
{
- list_add_tail(&ipo->list, &td->io_log_list);
+ flist_add_tail(&ipo->list, &td->io_log_list);
td->total_io_size += ipo->len;
}
if (!td->o.write_iolog_file)
return;
+
+ /*
+ * this happens on the pre-open/close done before the job starts
+ */
+ if (!td->iolog_f)
+ return;
+
fprintf(td->iolog_f, "%s %s\n", f->file_name, act[what]);
}
{
struct io_piece *ipo;
- while (!list_empty(&td->io_log_list)) {
+ while (!flist_empty(&td->io_log_list)) {
int ret;
- ipo = list_entry(td->io_log_list.next, struct io_piece, list);
- list_del(&ipo->list);
+ ipo = flist_entry(td->io_log_list.next, struct io_piece, list);
+ flist_del(&ipo->list);
ret = ipo_special(td, ipo);
if (ret < 0) {
free(ipo);
}
- while (!list_empty(&td->io_hist_list)) {
- ipo = list_entry(td->io_hist_list.next, struct io_piece, list);
- list_del(&ipo->list);
+ while (!flist_empty(&td->io_hist_list)) {
+ ipo = flist_entry(td->io_hist_list.next, struct io_piece, list);
+ flist_del(&ipo->list);
free(ipo);
}
}
* wrote it out is the fastest.
*/
if (!td_random(td) || !td->o.overwrite) {
- INIT_LIST_HEAD(&ipo->list);
- list_add_tail(&ipo->list, &td->io_hist_list);
+ INIT_FLIST_HEAD(&ipo->list);
+ flist_add_tail(&ipo->list, &td->io_hist_list);
return;
}
*/
ipo = malloc(sizeof(*ipo));
memset(ipo, 0, sizeof(*ipo));
- INIT_LIST_HEAD(&ipo->list);
+ INIT_FLIST_HEAD(&ipo->list);
ipo->offset = offset;
ipo->len = bytes;
ipo->ddir = rw;
return 0;
}
-/*
- * Read version 1 iolog data.
- */
-static int read_iolog(struct thread_data *td, FILE *f)
-{
- log_err("fio: iolog version 1 is no longer supported\n");
- return 1;
-}
-
/*
* open iolog, check version, and call appropriate parser
*/
if (!strncmp(iolog_ver2, buffer, strlen(iolog_ver2)))
ret = read_iolog2(td, f);
else {
- /*
- * seek back to the beginning
- */
- if (fseek(f, 0, SEEK_SET) < 0) {
- td_verror(td, errno, "iolog read");
- log_err("fio: unable to read iolog\n");
- return 1;
- }
-
- ret = read_iolog(td, f);
+ log_err("fio: iolog version 1 is no longer supported\n");
+ ret = 1;
}
fclose(f);
void finish_log(struct thread_data *td, struct io_log *log, const char *name)
{
- char file_name[256];
+ char file_name[256], *p;
snprintf(file_name, 200, "%s_%s.log", td->o.name, name);
- __finish_log(log, file_name);
+ p = basename(file_name);
+ __finish_log(log, p);
}