Recent changes (master)
The following changes since commit 6eaa6422fccf857e6b1a88492db805dafca8ee85:
windows: don't define strtoll for 32-bit builds (2024-06-28 18:48:43 -0400)
are available in the Git repository at:
git://git.kernel.dk/fio.git master
for you to fetch changes up to 89fc4019e2a5ecb23be181a6a1dcda1902cdcfcc:
Merge branch 'io-uring-cmd/nvme/add-flush' of https://github.com/minwooim/fio (2024-07-11 09:59:48 -0400)
----------------------------------------------------------------
Minwoo Im (6):
io_uring: Add support FLUSH command
td: Rename last_ddir to last_ddir_completed
td: Replace last_was_sync with last_ddir_issued
io_u: Ensure fsync only after write(s)
io_u: Support fsync for --rw=trimwrite t/nvmept.py: Add test cases for FLUSH
Vincent Fu (1):
Merge branch 'io-uring-cmd/nvme/add-flush' of https://github.com/minwooim/fio
engines/nvme.c | 5 ++++ engines/nvme.h | 1 + fio.h | 7 +++-- io_u.c | 10 +++---- ioengines.c | 4 +-- libfio.c | 1 - t/nvmept.py | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 108 insertions(+), 11 deletions(-)
---
Diff of recent changes:
engines/nvme.c +5 -0
@@ -381,6 +381,11 @@ int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u,case DDIR_TRIM :fio_nvme_uring_cmd_trim_prep (cmd, io_u, dsm);return 0 ; +case DDIR_SYNC : +case DDIR_DATASYNC : + cmd->opcode = nvme_cmd_flush; + cmd->nsid = data->nsid; +return 0 ;default :return -ENOTSUP ; }
engines/nvme.h +1 -0
@@ -73,6 +73,7 @@ enum nvme_admin_opcode { };enum nvme_io_opcode { + nvme_cmd_flush =0x00 , nvme_cmd_write =0x01 , nvme_cmd_read =0x02 , nvme_cmd_write_uncor =0x04 ,
fio.h +4 -3
@@ -258,8 +258,9 @@ struct thread_data {size_t orig_buffer_size;volatile int runstate;volatile bool terminate; -bool last_was_sync; -enum fio_ddir last_ddir; + +enum fio_ddir last_ddir_completed; +enum fio_ddir last_ddir_issued;int mmapfd;
@@ -629,7 +630,7 @@ static inline bool multi_range_trim(struct thread_data *td, struct io_u *io_u)static inline bool should_fsync (struct thread_data *td) { -if (td->last_was_sync) +if (ddir_sync (td->last_ddir_issued))return false;if (td_write (td) || td->o.override_sync)return true;
io_u.c +5 -5
@@ -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 ;
@@ -815,7 +815,7 @@ static void set_rw_ddir(struct thread_data *td, struct io_u *io_u)if (td->o.zone_mode ==ZONE_MODE_ZBD ) ddir =zbd_adjust_ddir (td, io_u, ddir); -if (td_trimwrite (td)) { +if (td_trimwrite (td) && !ddir_sync (ddir)) {struct fio_file *f = io_u->file;if (f->last_start[DDIR_WRITE ] == f->last_start[DDIR_TRIM ]) ddir =DDIR_TRIM ;
@@ -1757,7 +1757,7 @@ static bool check_get_trim(struct thread_data *td, struct io_u *io_u)if (get_next_trim (td, io_u))return true; }else if (!(td->io_hist_len % td->o.trim_backlog) && - td->last_ddir !=DDIR_READ ) { + td->last_ddir_completed !=DDIR_READ ) { td->trim_batch = td->o.trim_batch;if (!td->trim_batch) td->trim_batch = td->o.trim_backlog;
@@ -1779,7 +1779,7 @@ static bool check_get_verify(struct thread_data *td, struct io_u *io_u)if (td->verify_batch) get_verify =1 ;else if (!(td->io_hist_len % td->o.verify_backlog) && - td->last_ddir !=DDIR_READ ) { + td->last_ddir_completed !=DDIR_READ ) { td->verify_batch = td->o.verify_batch;if (!td->verify_batch) td->verify_batch = td->o.verify_backlog;
@@ -2122,7 +2122,7 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,return ; } - td->last_ddir = ddir; + td->last_ddir_completed = ddir;if (!io_u->error &&ddir_rw (ddir)) {unsigned long long bytes = io_u->xfer_buflen - io_u->resid;
ioengines.c +2 -2
@@ -437,7 +437,7 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u) td->ts.total_io_u[io_u->ddir]++; } - td->last_was_sync =ddir_sync (io_u->ddir); + td->last_ddir_issued = ddir; }else if (ret ==FIO_Q_QUEUED ) { td->io_u_queued++;
@@ -448,7 +448,7 @@ enum fio_q_status td_io_queue(struct thread_data *td, struct io_u *io_u)if (td->io_u_queued >= td->o.iodepth_batch)td_io_commit (td); - td->last_was_sync =ddir_sync (io_u->ddir); + td->last_ddir_issued = ddir; } if (!td_ioengine_flagged(td, FIO_SYNCIO) &&
libfio.c +0 -1
@@ -101,7 +101,6 @@ static void reset_io_counters(struct thread_data *td, int all) td->zone_bytes =0 ; - td->last_was_sync = false; td->rwmix_issues =0 ;/*
t/nvmept.py +91 -0
103 lines not on this page · raw message