summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2018-08-24 11:31:26 -0700
committerJens Axboe <axboe@kernel.dk>2018-08-24 12:54:35 -0600
commitbd6b959a034cdcfcef010e56b139c609f56b83cf (patch)
treec86dd9b1514748840516991df88893eeefac0d62
parent6cc1a3d1ae6e574ac1773ec5dfa46caea4c3627d (diff)
downloadfio-bd6b959a034cdcfcef010e56b139c609f56b83cf.tar.gz
fio-bd6b959a034cdcfcef010e56b139c609f56b83cf.tar.bz2
Add two assert statements in mark_random_map()
Add two assert statements that verify whether mark_random_map() is used correctly. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_u.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/io_u.c b/io_u.c
index eed7d9d9..9b5f203c 100644
--- a/io_u.c
+++ b/io_u.c
@@ -41,9 +41,12 @@ static uint64_t mark_random_map(struct thread_data *td, struct io_u *io_u,
block = (offset - f->file_offset) / (uint64_t) min_bs;
nr_blocks = (buflen + min_bs - 1) / min_bs;
+ assert(nr_blocks > 0);
- if (!(io_u->flags & IO_U_F_BUSY_OK))
+ if (!(io_u->flags & IO_U_F_BUSY_OK)) {
nr_blocks = axmap_set_nr(f->io_axmap, block, nr_blocks);
+ assert(nr_blocks > 0);
+ }
if ((nr_blocks * min_bs) < buflen)
buflen = nr_blocks * min_bs;