Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Sofin committed Aug 7, 2024
1 parent d38c6fb commit b1c0bb5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 7 additions & 7 deletions io_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,24 +744,23 @@ static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir)

static inline enum fio_ddir get_sync_ddir(const struct thread_data *td)
{
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))
!(td->io_issues[DDIR_WRITE] % td->o.fsync_blocks))
return DDIR_SYNC;

if (td->o.fdatasync_blocks && td->io_issues[DDIR_WRITE] &&
!(td->io_issues[DDIR_WRITE] % td->o.fdatasync_blocks))
!(td->io_issues[DDIR_WRITE] % td->o.fdatasync_blocks))
return DDIR_DATASYNC;

if (td->sync_file_range_nr && td->io_issues[DDIR_WRITE] &&
!(td->io_issues[DDIR_WRITE] % td->sync_file_range_nr))
!(td->io_issues[DDIR_WRITE] % td->sync_file_range_nr))
return DDIR_SYNC_FILE_RANGE;
}
return DDIR_INVAL;
}

bool time_to_ddir_sync(struct thread_data *td)
bool time_to_ddir_sync(const struct thread_data *td)
{
return get_sync_ddir(td) != DDIR_INVAL;
}
Expand All @@ -779,7 +778,8 @@ 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 ((ddir = get_sync_ddir(td)) != DDIR_INVAL)
ddir = get_sync_ddir(td);
if (ddir != DDIR_INVAL)
return ddir;

if (td_rw(td)) {
Expand Down
2 changes: 2 additions & 0 deletions io_u.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ bool queue_full(const struct thread_data *);
int do_io_u_sync(const struct thread_data *, struct io_u *);
int do_io_u_trim(struct thread_data *, struct io_u *);

bool time_to_ddir_sync(const struct thread_data *);

#ifdef FIO_INC_DEBUG
static inline void dprint_io_u(struct io_u *io_u, const char *p)
{
Expand Down

0 comments on commit b1c0bb5

Please sign in to comment.