From patchwork Fri Apr 8 16:10:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 695181 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p38GBuTI005228 for ; Fri, 8 Apr 2011 16:11:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757233Ab1DHQLv (ORCPT ); Fri, 8 Apr 2011 12:11:51 -0400 Received: from mail-px0-f179.google.com ([209.85.212.179]:34981 "EHLO mail-px0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752656Ab1DHQLu (ORCPT ); Fri, 8 Apr 2011 12:11:50 -0400 Received: by pxi2 with SMTP id 2so1906952pxi.10 for ; Fri, 08 Apr 2011 09:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=JP+JRAVJge6Tq7qHT31SFvAPCDh+CDekzFHrJuAWCNQ=; b=qrD6Bb9gYDIygdl8G3lrQ8FHHV6saLm8aG2FAbpWwwIpvN/BiOOgiqmgEkvNf5oVIy OXRrn00XNoBL7xFxDCxlX4PR6d8+BiN0Spb2LgwxVmU7t7N8/a2t1ln7vN4VJ9BS9u7V 8PEaxlMGKLTNoH3T1vu4iFyu2v0Z6SaW1FD7A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=qXFQhfJSGRTcV/swmx2skuM7H5TF0vSKnAYmJbCJYwLu+N4qNe49p6Ab3fTDqoFtZ4 6KIJsBii1NCvB9O7gTFAMy9BgwBwrbuvJLrgGN22pJLWPu83pYmbFV3f7RF/0Rf8+z4X giRJxx62VEZwClNP1mn3gDgT/e5mmlMBWiiaY= Received: by 10.142.128.16 with SMTP id a16mr2005604wfd.282.1302279109992; Fri, 08 Apr 2011 09:11:49 -0700 (PDT) Received: from localhost.localdomain ([219.224.169.130]) by mx.google.com with ESMTPS id s39sm3812390wfc.16.2011.04.08.09.11.47 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Apr 2011 09:11:49 -0700 (PDT) From: Asias He To: Pekka Enberg , Cyrill Gorcunov , Ingo Molnar Cc: kvm@vger.kernel.org, Asias He Subject: [PATCH 4/5] kvm tools: drop virt_queue__get_used_elem virtio helper Date: Sat, 9 Apr 2011 00:10:06 +0800 Message-Id: <1302279007-15710-4-git-send-email-asias.hejun@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1302279007-15710-1-git-send-email-asias.hejun@gmail.com> References: <1302279007-15710-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 08 Apr 2011 16:11:56 +0000 (UTC) Use virt_queue__set_used_elem insted. Signed-off-by: Asias He --- 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; }