diff options
author | Jens Axboe <axboe@kernel.dk> | 2018-09-16 21:43:56 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-09-16 21:43:56 -0600 |
commit | 39c56bc010a609f6c89955cbcfa289834ffef336 (patch) | |
tree | 0f3a28ae746f0ac450a1b23d7e1114900aebd3c8 /lib | |
parent | 604d3f5bd9f2b985568593c23f8292cbc7f4044c (diff) | |
download | fio-39c56bc010a609f6c89955cbcfa289834ffef336.tar.gz fio-39c56bc010a609f6c89955cbcfa289834ffef336.tar.bz2 |
axmap: use 64-bit index for the handlers
Most important one here is axmap_handler_topdown(), in which the
first iteration could end up truncating the index calculation.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/axmap.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/axmap.c b/lib/axmap.c index 767a7317..ecd46970 100644 --- a/lib/axmap.c +++ b/lib/axmap.c @@ -165,7 +165,7 @@ free_axmap: * returns true. */ static bool axmap_handler(struct axmap *axmap, uint64_t bit_nr, - bool (*func)(struct axmap_level *, unsigned long, unsigned int, + bool (*func)(struct axmap_level *, uint64_t, unsigned int, void *), void *data) { struct axmap_level *al; @@ -194,12 +194,12 @@ static bool axmap_handler(struct axmap *axmap, uint64_t bit_nr, * returns true. */ static bool axmap_handler_topdown(struct axmap *axmap, uint64_t bit_nr, - bool (*func)(struct axmap_level *, unsigned long, unsigned int, void *)) + bool (*func)(struct axmap_level *, uint64_t, unsigned int, void *)) { int i; for (i = axmap->nr_levels - 1; i >= 0; i--) { - unsigned long index = bit_nr >> (UNIT_SHIFT * i); + uint64_t index = bit_nr >> (UNIT_SHIFT * i); unsigned long offset = index >> UNIT_SHIFT; unsigned int bit = index & BLOCKS_PER_UNIT_MASK; @@ -220,7 +220,7 @@ struct axmap_set_data { * the boundary of the element at offset @offset. Return the number of bits * that have been set in @__data->set_bits if @al->level == 0. */ -static bool axmap_set_fn(struct axmap_level *al, unsigned long offset, +static bool axmap_set_fn(struct axmap_level *al, uint64_t offset, unsigned int bit, void *__data) { struct axmap_set_data *data = __data; @@ -322,7 +322,7 @@ unsigned int axmap_set_nr(struct axmap *axmap, uint64_t bit_nr, return set_bits; } -static bool axmap_isset_fn(struct axmap_level *al, unsigned long offset, +static bool axmap_isset_fn(struct axmap_level *al, uint64_t offset, unsigned int bit, void *unused) { return (al->map[offset] & (1UL << bit)) != 0; |