diff options
author | Long Li <longli@microsoft.com> | 2018-03-28 02:48:38 +0200 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2018-04-19 01:32:51 +0200 |
commit | 63273cb40101b6f303a5493f1bdf629d4ab3746b (patch) | |
tree | 34076c5b51b7acf623d5275e3aa96e726aadf5ad /drivers/hv/ring_buffer.c | |
parent | scsi: libsas: add transport class for ATA devices (diff) | |
download | linux-63273cb40101b6f303a5493f1bdf629d4ab3746b.tar.xz linux-63273cb40101b6f303a5493f1bdf629d4ab3746b.zip |
scsi: vmbus: Add function to report available ring buffer to write in total ring size percentage
Netvsc has a function to calculate how much ring buffer in percentage is
available to write. This function is also useful for storvsc and other
vmbus devices.
Define a similar function in vmbus to be used by other vmbus devices.
Signed-off-by: Long Li <longli@microsoft.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/hv/ring_buffer.c')
-rw-r--r-- | drivers/hv/ring_buffer.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 8699bb969e7e..3c836c099a8f 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -227,6 +227,8 @@ int hv_ringbuffer_init(struct hv_ring_buffer_info *ring_info, ring_info->ring_buffer->feature_bits.value = 1; ring_info->ring_size = page_cnt << PAGE_SHIFT; + ring_info->ring_size_div10_reciprocal = + reciprocal_value(ring_info->ring_size / 10); ring_info->ring_datasize = ring_info->ring_size - sizeof(struct hv_ring_buffer); |