Recent changes (master)

Jens Axboe
2015-03-20T12:00:07Z

The following changes since commit d8f1f7d4ef536ea04a6a5fbd0399d46f69ff4e60:

Pack io_u/fio_file (2015-03-18 16:17:41 -0600)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to 6fb1bda0d0b61e2433f9ef34b4b979b2642d8706:

io_u_queue: add debug assert check on adding too many elements (2015-03-19 22:25:35 -0600)

----------------------------------------------------------------
Jens Axboe (1):
io_u_queue: add debug assert check on adding too many elements

io_u_queue.c | 1 +
io_u_queue.h | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)

---

Diff of recent changes:

diff --git a/io_u_queue.c b/io_u_queue.c
index 80a32ba..9994c78 100644
--- a/io_u_queue.c
+++ b/io_u_queue.c
@@ -8,6 +8,7 @@ int io_u_qinit(struct io_u_queue *q, unsigned int nr)
return 1;

q->nr = 0;
+ q->max = nr;
return 0;
}

diff --git a/io_u_queue.h b/io_u_queue.h
index bda40d5..118e593 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)