From patchwork Tue Jan 5 19:05:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 563284 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1E75C1402C0 for ; Wed, 6 Jan 2016 06:34:23 +1100 (AEDT) Received: from localhost ([::1]:51218 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGXN6-0000Jr-Uz for incoming@patchwork.ozlabs.org; Tue, 05 Jan 2016 14:34:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGXL1-0004GC-8s for qemu-devel@nongnu.org; Tue, 05 Jan 2016 14:32:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGXKy-00012L-0e for qemu-devel@nongnu.org; Tue, 05 Jan 2016 14:32:11 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:40706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGXKx-0000yz-Ig for qemu-devel@nongnu.org; Tue, 05 Jan 2016 14:32:07 -0500 X-IronPort-AV: E=Sophos;i="5.20,525,1444694400"; d="scan'208";a="329177167" From: Wei Liu To: Date: Tue, 5 Jan 2016 19:05:57 +0000 Message-ID: <1452020761-24457-19-git-send-email-wei.liu2@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452020761-24457-1-git-send-email-wei.liu2@citrix.com> References: <1452020761-24457-1-git-send-email-wei.liu2@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: Greg Kurz , Wei Liu , "Aneesh Kumar K.V" , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH 18/22] 9pfs: factor out pdu_push_and_notify X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Wei Liu --- hw/9pfs/virtio-9p.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c index db79a48..5475f29 100644 --- a/hw/9pfs/virtio-9p.c +++ b/hw/9pfs/virtio-9p.c @@ -63,6 +63,17 @@ ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...) return ret; } +static void pdu_push_and_notify(V9fsPDU *pdu) +{ + V9fsState *s = pdu->s; + + /* push onto queue and notify */ + virtqueue_push(s->vq, &pdu->elem, pdu->size); + + /* FIXME: we should batch these completions */ + virtio_notify(VIRTIO_DEVICE(s), s->vq); +} + static int omode_to_uflags(int8_t mode) { int ret = 0; @@ -653,11 +664,7 @@ static void pdu_complete(V9fsPDU *pdu, ssize_t len) pdu->size = len; pdu->id = id; - /* push onto queue and notify */ - virtqueue_push(s->vq, &pdu->elem, len); - - /* FIXME: we should batch these completions */ - virtio_notify(VIRTIO_DEVICE(s), s->vq); + pdu_push_and_notify(pdu); /* Now wakeup anybody waiting in flush for this request */ qemu_co_queue_next(&pdu->complete);