Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Mar 20, 2015

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

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:

io_u_queue.c +1 -0
index 80a32ba..9994c78 100644
@@ -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;
 }
 
io_u_queue.h +7 -1
index bda40d5..118e593 100644
@@ -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)