bdev: Convert the type to avoid overflow

bdev_ch->io_outstanding - NOMEM_THRESHOLD_COUNT

can be negative, so change the type, then
we can make the comparision correct.

Change-Id: I823ceb3dd053f71c1902ee66cf4caba719a7ae7d
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/393437
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ziye Yang 2018-01-03 10:25:31 +08:00 committed by Daniel Verkamp
parent 6129c63a2b
commit e4bfb3d153

View File

@ -1817,8 +1817,8 @@ spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, enum spdk_bdev_io_status sta
* NOMEM_THRESHOLD_COUNT I/O to complete but for low queue
* depth channels we will instead wait for half to complete.
*/
bdev_ch->nomem_threshold = spdk_max(bdev_ch->io_outstanding / 2,
bdev_ch->io_outstanding - NOMEM_THRESHOLD_COUNT);
bdev_ch->nomem_threshold = spdk_max((int64_t)bdev_ch->io_outstanding / 2,
(int64_t)bdev_ch->io_outstanding - NOMEM_THRESHOLD_COUNT);
return;
}
}