FIO with fsync option issues more DDIR_SYNC commands than expected
authorcelestinechen <166680286+celestinechen@users.noreply.github.com>
Fri, 19 Apr 2024 06:22:15 +0000 (06:22 +0000)
committercelestinechen <166680286+celestinechen@users.noreply.github.com>
Fri, 19 Apr 2024 06:22:15 +0000 (06:22 +0000)
commit673159e61b745adbee5135b710e59d7cef54e9d3
tree480a37380e81d8f58dc70f222b10fc9babde4622
parent420415dd1180c14ec0f55f65a05e57ea1fd85f9f
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
1. FIO issues 1 write command
2. After write completes, FIO sets last_was_sync variable to false
3. FIO issues 1 flush command
4. FIO keeps issuing flush commands since last_was_sync is still false
and this causes more flush commands to be issued than expected
5. 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.

Signed-off-by: Celestine Chen celestinechen@google.com
io_u.c
ioengines.c