engines/io_uring: remove dead code related to trim
authorVincent Fu <vincent.fu@samsung.com>
Tue, 27 Jun 2023 19:19:11 +0000 (19:19 +0000)
committerVincent Fu <vincent.fu@samsung.com>
Wed, 5 Jul 2023 19:51:09 +0000 (15:51 -0400)
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 <vincent.fu@samsung.com>
engines/io_uring.c
engines/nvme.c
engines/nvme.h

index 7cdbdafaec960e65ae35e3f58eca8d6905242d65..5021239e147d2cf1dcd851a6dcffe2335307114a 100644 (file)
@@ -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);
index 2901803a17b04971033a55d79e4660434138c01b..b18ad4c28a054db6a4d6d93bc2904650fd3599b4 100644 (file)
@@ -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)
 {
index 34be2de16edc0d7ea113af071bf37f69acc5c11f..238471dd76b94f1dd063eee7449ed9e2354a6abd 100644 (file)
@@ -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);