From 42fd89a759340ab25c64c4fc743a071b9681c2b8 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 27 Oct 2005 12:44:08 +0200 Subject: [PATCH] [PATCH] fio: serialize client file creating to avoid bad fs layout --- fio.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/fio.c b/fio.c index 07b08a2..42b7b03 100644 --- a/fio.c +++ b/fio.c @@ -948,6 +948,8 @@ static int create_file(struct thread_data *td) return 1; } + printf("Client%d: Laying out IO file\n", td->thread_number); + td->fd = open(td->file_name, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (td->fd < 0) { td->error = errno; @@ -1101,9 +1103,6 @@ static void *thread_main(int shm_id, int offset, char *argv[]) } } - if (setup_file(td)) - goto err; - sem_post(&startup_sem); sem_wait(&td->mutex); @@ -1975,6 +1974,16 @@ static void run_threads(char *argv[]) continue; } + /* + * do file setup here so it happens sequentially, + * we don't want X number of threads getting their + * client data interspersed on disk + */ + if (setup_file(td)) { + td->terminate = 1; + continue; + } + td->runstate = TD_CREATED; run_str[td->thread_number - 1] = 'C'; sem_init(&startup_sem, 1, 1); -- 2.25.1