X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=io_u_queue.h;h=118e59342b5da4bd814be51aa7f561d519603838;hb=6fb1bda0d0b61e2433f9ef34b4b979b2642d8706;hp=bda40d5ea263920055f6d75c62bdca8e4559034c;hpb=d8f1f7d4ef536ea04a6a5fbd0399d46f69ff4e60;p=fio.git 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)