[PATCH] Misc: stall progress ouput during file creation, ini_file frees.
[fio.git] / fio.c
diff --git a/fio.c b/fio.c
index 65d94980cd2feca2c2050f390961c6a731a72dc1..b53a58ebe1883bbc9ad17f83fd598ce0c81c0c3c 100644 (file)
--- a/fio.c
+++ b/fio.c
@@ -43,6 +43,7 @@ int thread_number = 0;
 static char run_str[MAX_JOBS + 1];
 int shm_id = 0;
 static struct timeval genesis;
+static int temp_stall_ts;
 
 static void print_thread_status(void);
 
@@ -960,6 +961,8 @@ static int create_file(struct thread_data *td, unsigned long long size,
                return 1;
        }
 
+       temp_stall_ts = 1;
+
        if (!extend) {
                oflags = O_CREAT | O_TRUNC;
                fprintf(f_out, "%s: Laying out IO file (%LuMiB)\n", td->name, size >> 20);
@@ -971,11 +974,13 @@ static int create_file(struct thread_data *td, unsigned long long size,
        td->fd = open(td->file_name, O_WRONLY | oflags, 0644);
        if (td->fd < 0) {
                td_verror(td, errno);
+               temp_stall_ts = 0;
                return 1;
        }
 
        if (!extend && ftruncate(td->fd, td->file_size) == -1) {
                td_verror(td, errno);
+               temp_stall_ts = 0;
                return 1;
        }
 
@@ -1009,6 +1014,7 @@ static int create_file(struct thread_data *td, unsigned long long size,
        else if (td->create_fsync)
                fsync(td->fd);
 
+       temp_stall_ts = 0;
        close(td->fd);
        td->fd = -1;
        free(b);
@@ -1552,7 +1558,7 @@ static int thread_eta(struct thread_data *td, unsigned long elapsed)
                else if (t_eta)
                        eta_sec = t_eta;
                else
-                       eta_sec = INT_MAX;
+                       eta_sec = 0;
        } else {
                /*
                 * thread is already done or waiting for fsync
@@ -1570,6 +1576,9 @@ static void print_thread_status(void)
        char eta_str[32];
        double perc = 0.0;
 
+       if (temp_stall_ts)
+               return;
+
        eta_secs = malloc(thread_number * sizeof(int));
        memset(eta_secs, 0, thread_number * sizeof(int));
 
@@ -1803,7 +1812,6 @@ static void run_threads(void)
                 * Wait for the started threads to transition to
                 * TD_INITIALIZED.
                 */
-               printf("fio: Waiting for threads to initialize...\n");
                gettimeofday(&this_start, NULL);
                left = this_jobs;
                while (left) {
@@ -1842,7 +1850,6 @@ static void run_threads(void)
                /*
                 * start created threads (TD_INITIALIZED -> TD_RUNNING).
                 */
-               printf("fio: Go for launch\n");
                for (i = 0; i < thread_number; i++) {
                        td = &threads[i];