[PATCH] Add end_fsync option
diff --git a/README b/README
index 92cf5c4..bc2574e 100644
--- a/README
+++ b/README
@@ -73,6 +73,7 @@
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 109bc14..a8ed6d5 100644
--- a/fio-ini.c
+++ b/fio-ini.c
@@ -726,6 +726,7 @@
}
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 @@
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 9510dee..3c35039 100644
--- a/fio.c
+++ b/fio.c
@@ -1136,7 +1136,7 @@
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 fe7efbd..4f87fb7 100644
--- a/fio.h
+++ b/fio.h
@@ -134,6 +134,7 @@
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;