From fc1a471326fb5248a74ed3a206d37884b812c853 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 30 May 2006 13:04:05 +0200 Subject: [PATCH] [PATCH] Add end_fsync option --- README | 1 + fio-ini.c | 5 +++++ fio.c | 2 +- fio.h | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README b/README index 92cf5c49..bc2574e7 100644 --- a/README +++ b/README @@ -73,6 +73,7 @@ The format is as follows: bwavgtime=x Average bandwidth stats over an x msec window. create_serialize=x If 'x', serialize file creation. create_fsync=x If 'x', run fsync() after file creation. + end_fsync=x If 'x', run fsync() after end-of-job. loops=x Run the job 'x' number of times. verify=x If 'x' == md5, use md5 for verifies. If 'x' == crc32, use crc32 for verifies. md5 is 'safer', but crc32 is diff --git a/fio-ini.c b/fio-ini.c index 109bc149..a8ed6d5b 100644 --- a/fio-ini.c +++ b/fio-ini.c @@ -726,6 +726,7 @@ int parse_jobs_ini(char *file) } if (!check_int(p, "fsync", &td->fsync_blocks)) { fgetpos(f, &off); + td->end_fsync = 1; continue; } if (!check_int(p, "startdelay", &td->start_delay)) { @@ -760,6 +761,10 @@ int parse_jobs_ini(char *file) fgetpos(f, &off); continue; } + if (!check_int(p, "end_fsync", &td->end_fsync)) { + fgetpos(f, &off); + continue; + } if (!check_int(p, "loops", &td->loops)) { fgetpos(f, &off); continue; diff --git a/fio.c b/fio.c index 9510dee4..3c35039a 100644 --- a/fio.c +++ b/fio.c @@ -1136,7 +1136,7 @@ static void do_io(struct thread_data *td) if (td->cur_depth) cleanup_pending_aio(td); - if (should_fsync(td) && td->fsync_blocks) + if (should_fsync(td) && td->end_fsync) sync_td(td); } diff --git a/fio.h b/fio.h index fe7efbdc..4f87fb77 100644 --- a/fio.h +++ b/fio.h @@ -134,6 +134,7 @@ struct thread_data { unsigned int bw_avg_time; unsigned int create_serialize; unsigned int create_fsync; + unsigned int end_fsync; unsigned int loops; unsigned long long file_size; unsigned long long real_file_size; -- 2.25.1