From: Vincent Fu Date: Tue, 27 Jun 2023 19:19:11 +0000 (+0000) Subject: engines/io_uring: remove dead code related to trim X-Git-Tag: fio-3.36~71 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=7f57e30f54078b36667afefdf6ea5794b6142b27;p=fio.git engines/io_uring: remove dead code related to trim Now that we are no longer using an NVMe IOCTL to send io_uring_cmd trim commands we can just use the existing pathway to carry out synchronous trim commands for zoned devices. So we no longer need this code. Signed-off-by: Vincent Fu --- diff --git a/engines/io_uring.c b/engines/io_uring.c index 7cdbdafa..5021239e 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 2901803a..b18ad4c2 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 34be2de1..238471dd 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);