From: Tomohiro Kusumi <tkusumi@xxxxxxxxxx> When selecting ddir for the next i/o, test td->io_issues[DDIR_WRITE] before division which is more expensive. if (x && y && !(y % x)) rather than if (x && !(y % x) && y) Signed-off-by: Tomohiro Kusumi <tkusumi@xxxxxxxxxx> --- io_u.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/io_u.c b/io_u.c index 5f01c1b..1de35c8 100644 --- a/io_u.c +++ b/io_u.c @@ -719,25 +719,25 @@ static enum fio_ddir get_rw_ddir(struct thread_data *td) /* * see if it's time to fsync */ - if (td->o.fsync_blocks && - !(td->io_issues[DDIR_WRITE] % td->o.fsync_blocks) && - td->io_issues[DDIR_WRITE] && should_fsync(td)) + if (td->o.fsync_blocks && td->io_issues[DDIR_WRITE] && + !(td->io_issues[DDIR_WRITE] % td->o.fsync_blocks) && + should_fsync(td)) return DDIR_SYNC; /* * see if it's time to fdatasync */ - if (td->o.fdatasync_blocks && - !(td->io_issues[DDIR_WRITE] % td->o.fdatasync_blocks) && - td->io_issues[DDIR_WRITE] && should_fsync(td)) + if (td->o.fdatasync_blocks && td->io_issues[DDIR_WRITE] && + !(td->io_issues[DDIR_WRITE] % td->o.fdatasync_blocks) && + should_fsync(td)) return DDIR_DATASYNC; /* * see if it's time to sync_file_range */ - if (td->sync_file_range_nr && - !(td->io_issues[DDIR_WRITE] % td->sync_file_range_nr) && - td->io_issues[DDIR_WRITE] && should_fsync(td)) + if (td->sync_file_range_nr && td->io_issues[DDIR_WRITE] && + !(td->io_issues[DDIR_WRITE] % td->sync_file_range_nr) && + should_fsync(td)) return DDIR_SYNC_FILE_RANGE; if (td_rw(td)) { -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe fio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html