From a191635ad42893a60d0a917b27e97e3fc73f7fee Mon Sep 17 00:00:00 2001 From: Vincent Fu Date: Fri, 11 Oct 2024 22:01:26 +0000 Subject: [PATCH] engines/io_uring_cmd: do not send data buffer for write zeroes For write zeroes commands, do not send a data bufffer address. If we do send an address, the driver will try to carry out DMA mapping and encounter driver mdts limitations which do not apply to write zeroes commands. This lets us send large write zeroes commands to deallocate the device with the deac=1. This is only done for the non-vectored IO case. For the vectored IO case, the driver requires data buffer addresses to be sent. Regardless it does not make sense to use vectored IO for write zeroes. Signed-off-by: Vincent Fu --- engines/nvme.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engines/nvme.c b/engines/nvme.c index 18010c0b55..37a31e2ff7 100644 --- a/engines/nvme.c +++ b/engines/nvme.c @@ -406,7 +406,11 @@ int fio_nvme_uring_cmd_prep(struct nvme_uring_cmd *cmd, struct io_u *io_u, cmd->addr = (__u64)(uintptr_t)iov; cmd->data_len = 1; } else { - cmd->addr = (__u64)(uintptr_t)io_u->xfer_buf; + /* no buffer for write zeroes */ + if (cmd->opcode != nvme_cmd_write_zeroes) + cmd->addr = (__u64)(uintptr_t)io_u->xfer_buf; + else + cmd->addr = (__u64)(uintptr_t)NULL; cmd->data_len = io_u->xfer_buflen; } if (data->lba_shift && data->ms) {