FIO with fsync option issues more DDIR_SYNC commands than expected
Issue and root cause
When fsync option is used, the number of flush (or DDIR_SYNC) commands
issued is more than the expected number of flush commands.
To elaborate:
In the fio config file, consider fsync=1
FIO issues 1 write command
After write completes, FIO sets last_was_sync variable to false
FIO issues 1 flush command
FIO keeps issuing flush commands since last_was_sync is still false
and this causes more flush commands to be issued than expected
last_was_sync is set to true after the flush command completes
The above steps repeats until the workload is completed.
Fix
Instead of setting last_was_sync to true after flush command is completed
and setting last_was_sync to false after write command is completed,
set last_was_sync to true after flush command is issued and set
last_was_sync to false after write command is issued.
FIO with fsync option issues more DDIR_SYNC commands than expected
Issue and root cause
When fsync option is used, the number of flush (or DDIR_SYNC) commands issued is more than the expected number of flush commands. To elaborate:
Fix
Instead of setting last_was_sync to true after flush command is completed and setting last_was_sync to false after write command is completed, set last_was_sync to true after flush command is issued and set last_was_sync to false after write command is issued.
Signed-off-by: Celestine Chen celestinechen@google.com