Drivers: hv: ring_buffer: eliminate hv_ringbuffer_peek()
commit940b68e2c3e4ebf032885203c3970e9649f814af
authorVitaly Kuznetsov <vkuznets@redhat.com>
Tue, 15 Dec 2015 03:02:01 +0000 (14 19:02 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 15 Dec 2015 03:27:30 +0000 (14 19:27 -0800)
tree3f6da80644a206f45d67c2ef8bc892a5c5351d1f
parent667d374064b0cc48b6122101b287908d1b392bdb
Drivers: hv: ring_buffer: eliminate hv_ringbuffer_peek()

Currently, there is only one user for hv_ringbuffer_read()/
hv_ringbuffer_peak() functions and the usage of these functions is:
- insecure as we drop ring_lock between them, someone else (in theory
  only) can acquire it in between;
- non-optimal as we do a number of things (acquire/release the above
  mentioned lock, calculate available space on the ring, ...) twice and
  this path is performance-critical.

Remove hv_ringbuffer_peek() moving the logic from __vmbus_recvpacket() to
hv_ringbuffer_read().

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/channel.c
drivers/hv/hyperv_vmbus.h
drivers/hv/ring_buffer.c