X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=io_u_queue.h;h=118e59342b5da4bd814be51aa7f561d519603838;hp=bda40d5ea263920055f6d75c62bdca8e4559034c;hb=e155cb64ad042af42aafef26d1decf29c03e85d4;hpb=b220c6d6f37fc55760d66728f6f9f521ea2f9b46 diff --git a/io_u_queue.h b/io_u_queue.h index bda40d5e..118e5934 100644 --- a/io_u_queue.h +++ b/io_u_queue.h @@ -8,6 +8,7 @@ struct io_u; struct io_u_queue { struct io_u **io_us; unsigned int nr; + unsigned int max; }; static inline struct io_u *io_u_qpop(struct io_u_queue *q) @@ -25,7 +26,12 @@ static inline struct io_u *io_u_qpop(struct io_u_queue *q) static inline void io_u_qpush(struct io_u_queue *q, struct io_u *io_u) { - q->io_us[q->nr++] = io_u; + if (q->nr < q->max) { + q->io_us[q->nr++] = io_u; + return; + } + + assert(0); } static inline int io_u_qempty(const struct io_u_queue *q)