Commit e4bfb3d1 authored by Ziye Yang's avatar Ziye Yang Committed by Daniel Verkamp
Browse files

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: default avatarZiye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/393437


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatar <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 6129c63a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
		}
	}