From: Damien Le Moal Date: Wed, 29 Aug 2018 01:29:02 +0000 (+0900) Subject: zbd: Fix zbd_zone_idx() X-Git-Tag: fio-3.9~1^2~1 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=cd775e06bb369a23b9c7aab259127f38e8027ca5 zbd: Fix zbd_zone_idx() For a zone size that is not a power of 2 number of sectors, f->zbd_info->zone_size_log2 is set to -1. So use bit shift in zbd_zone_idx() only if zone_size_log2 is not negative. Signed-off-by: Damien Le Moal Reviewed-by: Bart Van Assche --- diff --git a/zbd.c b/zbd.c index 93f14410..eb474f6e 100644 --- a/zbd.c +++ b/zbd.c @@ -31,7 +31,7 @@ static uint32_t zbd_zone_idx(const struct fio_file *f, uint64_t offset) { uint32_t zone_idx; - if (f->zbd_info->zone_size_log2) + if (f->zbd_info->zone_size_log2 > 0) zone_idx = offset >> f->zbd_info->zone_size_log2; else zone_idx = (offset >> 9) / f->zbd_info->zone_size;