diff --git a/engines/io_uring.c b/engines/io_uring.c index 7cdbdafaec..5021239e14 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -564,27 +564,6 @@ static inline void fio_ioring_cmdprio_prep(struct thread_data *td, ld->sqes[io_u->index].ioprio = io_u->ioprio; } -static int fio_ioring_cmd_io_u_trim(struct thread_data *td, - struct io_u *io_u) -{ - struct fio_file *f = io_u->file; - int ret; - - if (td->o.zone_mode == ZONE_MODE_ZBD) { - ret = zbd_do_io_u_trim(td, io_u); - if (ret == io_u_completed) - return io_u->xfer_buflen; - if (ret) - goto err; - } - - return fio_nvme_trim(td, f, io_u->offset, io_u->xfer_buflen); - -err: - io_u->error = ret; - return 0; -} - static enum fio_q_status fio_ioring_queue(struct thread_data *td, struct io_u *io_u) { @@ -601,10 +580,7 @@ static enum fio_q_status fio_ioring_queue(struct thread_data *td, if (ld->queued) return FIO_Q_BUSY; - if (!strcmp(td->io_ops->name, "io_uring_cmd")) - fio_ioring_cmd_io_u_trim(td, io_u); - else - do_io_u_trim(td, io_u); + do_io_u_trim(td, io_u); io_u_mark_submit(td, 1); io_u_mark_complete(td, 1); diff --git a/engines/nvme.c b/engines/nvme.c index 2901803a17..b18ad4c28a 100644 --- a/engines/nvme.c +++ b/engines/nvme.c @@ -83,45 +83,6 @@ int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u, return 0; } -static int nvme_trim(int fd, __u32 nsid, __u32 nr_range, __u32 data_len, - void *data) -{ - struct nvme_passthru_cmd cmd = { - .opcode = nvme_cmd_dsm, - .nsid = nsid, - .addr = (__u64)(uintptr_t)data, - .data_len = data_len, - .cdw10 = nr_range - 1, - .cdw11 = NVME_ATTRIBUTE_DEALLOCATE, - }; - - return ioctl(fd, NVME_IOCTL_IO_CMD, &cmd); -} - -int fio_nvme_trim(const struct thread_data *td, struct fio_file *f, - unsigned long long offset, unsigned long long len) -{ - struct nvme_data *data = FILE_ENG_DATA(f); - struct nvme_dsm_range dsm; - int ret; - - if (data->lba_ext) { - dsm.nlb = len / data->lba_ext; - dsm.slba = offset / data->lba_ext; - } else { - dsm.nlb = len >> data->lba_shift; - dsm.slba = offset >> data->lba_shift; - } - - ret = nvme_trim(f->fd, data->nsid, 1, sizeof(struct nvme_dsm_range), - &dsm); - if (ret) - log_err("%s: nvme_trim failed for offset %llu and len %llu, err=%d\n", - f->file_name, offset, len, ret); - - return ret; -} - static int nvme_identify(int fd, __u32 nsid, enum nvme_identify_cns cns, enum nvme_csi csi, void *data) { diff --git a/engines/nvme.h b/engines/nvme.h index 34be2de16e..238471dd76 100644 --- a/engines/nvme.h +++ b/engines/nvme.h @@ -216,9 +216,6 @@ struct nvme_dsm_range { __le64 slba; }; -int fio_nvme_trim(const struct thread_data *td, struct fio_file *f, - unsigned long long offset, unsigned long long len); - int fio_nvme_iomgmt_ruhs(struct thread_data *td, struct fio_file *f, struct nvme_fdp_ruh_status *ruhs, __u32 bytes);