scsi: storvsc: Fix calculation of sub-channel count
authorMichael Kelley <mikelley@microsoft.com>
Mon, 1 Apr 2019 16:10:52 +0000 (16:10 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 8 May 2019 05:22:52 +0000 (07:22 +0200)
commit24d73473cc92e687f200a5590bc3afa8f3452848
tree3e5a3c7a330e32d9a90de0a63b587059d897bd9d
parentebaa9d86f25b6941e7309c9d717576c267b6717d
scsi: storvsc: Fix calculation of sub-channel count

[ Upstream commit 382e06d11e075a40b4094b6ef809f8d4bcc7ab2a ]

When the number of sub-channels offered by Hyper-V is >= the number of CPUs
in the VM, calculate the correct number of sub-channels.  The current code
produces one too many.

This scenario arises only when the number of CPUs is artificially
restricted (for example, with maxcpus=<n> on the kernel boot line), because
Hyper-V normally offers a sub-channel count < number of CPUs.  While the
current code doesn't break, the extra sub-channel is unbalanced across the
CPUs (for example, a total of 5 channels on a VM with 4 CPUs).

Signed-off-by: Michael Kelley <mikelley@microsoft.com>
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
drivers/scsi/storvsc_drv.c