From cd775e06bb369a23b9c7aab259127f38e8027ca5 Mon Sep 17 00:00:00 2001 From: Damien Le Moal Date: Wed, 29 Aug 2018 10:29:02 +0900 Subject: [PATCH] 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 --- zbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.25.1