From patchwork Tue Aug 28 11:54:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1381141 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 822DA3FDF5 for ; Tue, 28 Aug 2012 11:56:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753108Ab2H1LzW (ORCPT ); Tue, 28 Aug 2012 07:55:22 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:40722 "EHLO mail-yx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956Ab2H1LzS (ORCPT ); Tue, 28 Aug 2012 07:55:18 -0400 Received: by yenl14 with SMTP id l14so1058226yen.19 for ; Tue, 28 Aug 2012 04:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=EN7HfhYD/zTjxjbt+l0QIiMkttkLjGOwsxa7SJi2Kjk=; b=GFtkZBLYpsSs+oZV8d1el0+IqXf+WxHB+W7HlC/cmprBvlyYXXnqK1a0GBXAzIcd2O 8zoMYu5ksQYbVnsW0czfwjQLFc9p7tAj5BAUEollUChetu40hZq4NvuKF8yTcoV8hq3w d91NfzUVkdyYomePsC+SMCPBTIou7rme3w2UzwijGUlxapZulHlCU7HJzubulvXqcu9C ks6hfWlf+/XjU8/+yrMAApbQOYtPBfBXAuGc60YM/p2ZhK39CnTYck51TpXeMWoennuB U8sGSG0iFX4VBWrRzG8QsrpiSGQNTC7NoKDAKxtUi7OlInfVjXx7dh2nJQBtMLqASvvV 4U+w== Received: by 10.100.84.18 with SMTP id h18mr4252490anb.57.1346154917801; Tue, 28 Aug 2012 04:55:17 -0700 (PDT) Received: from yakj.usersys.redhat.com (93-34-169-1.ip50.fastwebnet.it. [93.34.169.1]) by mx.google.com with ESMTPS id n5sm19461435ang.18.2012.08.28.04.55.08 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Aug 2012 04:55:16 -0700 (PDT) From: Paolo Bonzini To: linux-kernel@vger.kernel.org Cc: linux-scsi@vger.kernel.org, kvm@vger.kernel.org, rusty@rustcorp.com.au, jasowang@redhat.com, mst@redhat.com, virtualization@lists.linux-foundation.org Subject: [PATCH 4/5] virtio-scsi: pass struct virtio_scsi to virtqueue completion function Date: Tue, 28 Aug 2012 13:54:16 +0200 Message-Id: <1346154857-12487-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1346154857-12487-1-git-send-email-pbonzini@redhat.com> References: <1346154857-12487-1-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org This will be needed soon in order to retrieve the per-target struct. Signed-off-by: Paolo Bonzini --- drivers/scsi/virtio_scsi.c | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c index 62fec04..6414ea0 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c @@ -107,7 +107,7 @@ static void virtscsi_compute_resid(struct scsi_cmnd *sc, u32 resid) * * Called with vq_lock held. */ -static void virtscsi_complete_cmd(void *buf) +static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf) { struct virtio_scsi_cmd *cmd = buf; struct scsi_cmnd *sc = cmd->sc; @@ -168,7 +168,8 @@ static void virtscsi_complete_cmd(void *buf) sc->scsi_done(sc); } -static void virtscsi_vq_done(struct virtqueue *vq, void (*fn)(void *buf)) +static void virtscsi_vq_done(struct virtio_scsi *vscsi, struct virtqueue *vq, + void (*fn)(struct virtio_scsi *vscsi, void *buf)) { void *buf; unsigned int len; @@ -176,7 +177,7 @@ static void virtscsi_vq_done(struct virtqueue *vq, void (*fn)(void *buf)) do { virtqueue_disable_cb(vq); while ((buf = virtqueue_get_buf(vq, &len)) != NULL) - fn(buf); + fn(vscsi, buf); } while (!virtqueue_enable_cb(vq)); } @@ -187,11 +188,11 @@ static void virtscsi_req_done(struct virtqueue *vq) unsigned long flags; spin_lock_irqsave(&vscsi->req_vq.vq_lock, flags); - virtscsi_vq_done(vq, virtscsi_complete_cmd); + virtscsi_vq_done(vscsi, vq, virtscsi_complete_cmd); spin_unlock_irqrestore(&vscsi->req_vq.vq_lock, flags); }; -static void virtscsi_complete_free(void *buf) +static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf) { struct virtio_scsi_cmd *cmd = buf; @@ -208,7 +209,7 @@ static void virtscsi_ctrl_done(struct virtqueue *vq) unsigned long flags; spin_lock_irqsave(&vscsi->ctrl_vq.vq_lock, flags); - virtscsi_vq_done(vq, virtscsi_complete_free); + virtscsi_vq_done(vscsi, vq, virtscsi_complete_free); spin_unlock_irqrestore(&vscsi->ctrl_vq.vq_lock, flags); }; @@ -331,7 +332,7 @@ static void virtscsi_handle_event(struct work_struct *work) virtscsi_kick_event(vscsi, event_node); } -static void virtscsi_complete_event(void *buf) +static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf) { struct virtio_scsi_event_node *event_node = buf; @@ -346,7 +347,7 @@ static void virtscsi_event_done(struct virtqueue *vq) unsigned long flags; spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); - virtscsi_vq_done(vq, virtscsi_complete_event); + virtscsi_vq_done(vscsi, vq, virtscsi_complete_event); spin_unlock_irqrestore(&vscsi->event_vq.vq_lock, flags); };