engines/xnvme: allocate iovecs only if vectored I/O is enabled
authorAnkit Kumar <ankit.kumar@samsung.com>
Tue, 13 Feb 2024 15:33:11 +0000 (21:03 +0530)
committerVincent Fu <vincent.fu@samsung.com>
Tue, 13 Feb 2024 19:24:59 +0000 (14:24 -0500)
Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Link: https://lore.kernel.org/r/20240213153315.134202-2-ankit.kumar@samsung.com
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
engines/xnvme.c

index 2a0b3520bd3c068c80a120bae6e937622a492a24..88bbba4e26f2b04b7db55b7e55c05871bd7e74ae 100644 (file)
@@ -325,6 +325,7 @@ failure:
 static int xnvme_fioe_init(struct thread_data *td)
 {
        struct xnvme_fioe_data *xd = NULL;
+       struct xnvme_fioe_options *o = td->eo;
        struct fio_file *f;
        unsigned int i;
 
@@ -347,12 +348,14 @@ static int xnvme_fioe_init(struct thread_data *td)
                return 1;
        }
 
-       xd->iovec = calloc(td->o.iodepth, sizeof(*xd->iovec));
-       if (!xd->iovec) {
-               free(xd->iocq);
-               free(xd);
-               log_err("ioeng->init(): !calloc(xd->iovec), err(%d)\n", errno);
-               return 1;
+       if (o->xnvme_iovec) {
+               xd->iovec = calloc(td->o.iodepth, sizeof(*xd->iovec));
+               if (!xd->iovec) {
+                       free(xd->iocq);
+                       free(xd);
+                       log_err("ioeng->init(): !calloc(xd->iovec), err(%d)\n", errno);
+                       return 1;
+               }
        }
 
        xd->prev = -1;