X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u_queue.c;h=41f98bc4fa1036496539b50ea84eb6fa51cda390;hp=8cf4c8c3d702234a1cc0b0ba5ffee83ef3a4687a;hb=de5ed0e4d398bc9d4576f9b2b82d7686989c27e1;hpb=358ffaa6c37acb26e0f507934ba8a6f98f34ffee diff --git a/io_u_queue.c b/io_u_queue.c index 8cf4c8c3..41f98bc4 100644 --- a/io_u_queue.c +++ b/io_u_queue.c @@ -1,9 +1,15 @@ #include +#include #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)