[PATCH 4/5] kvm tools: drop virt_queue__get_used_elem virtio helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use virt_queue__set_used_elem insted.

Signed-off-by: Asias He <asias.hejun@xxxxxxxxx>
---
 tools/kvm/include/kvm/virtio.h |    6 ------
 tools/kvm/virtio-blk.c         |    5 +----
 2 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/tools/kvm/include/kvm/virtio.h b/tools/kvm/include/kvm/virtio.h
index 075387d..9f892a1 100644
--- a/tools/kvm/include/kvm/virtio.h
+++ b/tools/kvm/include/kvm/virtio.h
@@ -26,12 +26,6 @@ static inline struct vring_desc *virt_queue__get_desc(struct virt_queue *queue,
 	return &queue->vring.desc[desc_ndx];
 }
 
-static inline struct vring_used_elem *virt_queue__get_used_elem(struct virt_queue *queue)
-{
-	return &queue->vring.used->ring[queue->vring.used->idx++ % queue->vring.num];
-}
-
-
 static inline bool virt_queue__available(struct virt_queue *vq)
 {
 	return vq->vring.avail->idx !=  vq->last_avail_idx;
diff --git a/tools/kvm/virtio-blk.c b/tools/kvm/virtio-blk.c
index a41d5ac..8351e7a 100644
--- a/tools/kvm/virtio-blk.c
+++ b/tools/kvm/virtio-blk.c
@@ -100,7 +100,6 @@ static bool virtio_blk_pci_io_in(struct kvm *self, uint16_t port, void *data, in
 
 static bool virtio_blk_request(struct kvm *self, struct virt_queue *queue)
 {
-	struct vring_used_elem *used_elem;
 	struct virtio_blk_outhdr *req;
 	uint16_t desc_block_last;
 	struct vring_desc *desc;
@@ -190,9 +189,7 @@ static bool virtio_blk_request(struct kvm *self, struct virt_queue *queue)
 
 	*status			= err_cnt ? VIRTIO_BLK_S_IOERR : VIRTIO_BLK_S_OK;
 
-	used_elem		= virt_queue__get_used_elem(queue);
-	used_elem->id		= desc_hdr;
-	used_elem->len		= block_cnt;
+	virt_queue__set_used_elem(queue, desc_hdr, block_cnt);
 
 	return true;
 }
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux