t/io_uring: avoid unused `nr_batch` warning
authorJens Axboe <axboe@kernel.dk>
Fri, 11 Feb 2022 13:42:13 +0000 (06:42 -0700)
committerJens Axboe <axboe@kernel.dk>
Fri, 11 Feb 2022 13:42:13 +0000 (06:42 -0700)
If we have libaio support, but not an appropriate CPU clock, then the
build throws a warning on nr_batch being assigned but never used.

Mirror what was done on the io_uring init path and only defined and
set `nr_batch` if we have CPU clock support.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
t/io_uring.c

index faf5978c4abfdb7611fc3daa300141c4b0a83dd6..4520de436e1558d891f5f500f1b169850bb2ee60 100644 (file)
@@ -714,12 +714,15 @@ static int reap_events_aio(struct submitter *s, struct io_event *events, int evs
 static void *submitter_aio_fn(void *data)
 {
        struct submitter *s = data;
-       int i, ret, prepped, nr_batch;
+       int i, ret, prepped;
        struct iocb **iocbsptr;
        struct iocb *iocbs;
        struct io_event *events;
-
-       nr_batch = submitter_init(s);
+#ifdef ARCH_HAVE_CPU_CLOCK
+       int nr_batch = submitter_init(s);
+#else
+       submitter_init(s);
+#endif
 
        iocbsptr = calloc(depth, sizeof(struct iocb *));
        iocbs = calloc(depth, sizeof(struct iocb));