Skip to content

Commit

Permalink
io_u: Ensure fsync only after write(s)
Browse files Browse the repository at this point in the history
When using `--rw=write --fsync=N`, the FLUSH command is correctly
issued after N WRITE commands. However, if READ commands are mixed
in with --rw, fsync occurs after READ commands as well. This patch
ensures that fsync is only triggered after the specified number of
WRITE commands, regardless of READ commands.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
  • Loading branch information
minwooim committed Jul 11, 2024
1 parent e11046b commit 704a8cf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion io_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ static enum fio_ddir get_rw_ddir(struct thread_data *td)
* See if it's time to fsync/fdatasync/sync_file_range first,
* and if not then move on to check regular I/Os.
*/
if (should_fsync(td)) {
if (should_fsync(td) && td->last_ddir_issued == DDIR_WRITE) {
if (td->o.fsync_blocks && td->io_issues[DDIR_WRITE] &&
!(td->io_issues[DDIR_WRITE] % td->o.fsync_blocks))
return DDIR_SYNC;
Expand Down

0 comments on commit 704a8cf

Please sign in to comment.