summaryrefslogtreecommitdiff
path: root/io_u_queue.c
diff options
context:
space:
mode:
authorVincent Fu <vincent.fu@wdc.com>2018-10-17 12:03:23 -0400
committerJens Axboe <axboe@kernel.dk>2018-10-19 11:09:17 -0600
commit3114b675fd2b77ffa0f485b466811feb34dc57ed (patch)
tree75f55f54c2b399eae5c1b25c83e8f3fbce908efb /io_u_queue.c
parent1368d95b060802f3032bb662144faa99bd521b56 (diff)
fio: enable cross-thread overlap checking with processes
Overlap checking with io_submit_mode=offload requires relevant jobs to access each other's io_u's and io_u_all members. This patch modifies the fio_memalign and io_u_queue helpers to include an indicator signifying whether operations should use the shared memory pool. When fio is carrying out cross-job overlap checking in offload submission mode, these variables will be allocated from shared memory so that processes can be used and threads will no longer be required. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_u_queue.c')
-rw-r--r--io_u_queue.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/io_u_queue.c b/io_u_queue.c
index 8cf4c8c..41f98bc 100644
--- a/io_u_queue.c
+++ b/io_u_queue.c
@@ -1,9 +1,15 @@
#include <stdlib.h>
+#include <string.h>
#include "io_u_queue.h"
+#include "smalloc.h"
-bool io_u_qinit(struct io_u_queue *q, unsigned int nr)
+bool io_u_qinit(struct io_u_queue *q, unsigned int nr, bool shared)
{
- q->io_us = calloc(nr, sizeof(struct io_u *));
+ if (shared)
+ q->io_us = smalloc(nr * sizeof(struct io_u *));
+ else
+ q->io_us = calloc(nr, sizeof(struct io_u *));
+
if (!q->io_us)
return false;
@@ -12,9 +18,12 @@ bool io_u_qinit(struct io_u_queue *q, unsigned int nr)
return true;
}
-void io_u_qexit(struct io_u_queue *q)
+void io_u_qexit(struct io_u_queue *q, bool shared)
{
- free(q->io_us);
+ if (shared)
+ sfree(q->io_us);
+ else
+ free(q->io_us);
}
bool io_u_rinit(struct io_u_ring *ring, unsigned int nr)