diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-04-08 09:31:38 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2013-04-08 09:36:49 -0400 |
commit | 7f82b3c9158f3ce8eb9eaf0320a359de9ab6392c (patch) | |
tree | 06c48ccd88cba35cf12198836ea863df77877675 /drivers/scsi | |
parent | 5c370194df9a97248ca69e05bfbd2d21b4886fe5 (diff) |
virtio-scsi: pass struct virtio_scsi to virtqueue completion function
This will be needed soon in order to retrieve the per-target
struct.
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Reviewed-by: Asias He <asias@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | 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 ffa03e8cb19c..c23560c6a32e 100644 --- a/drivers/scsi/virtio_scsi.c +++ b/drivers/scsi/virtio_scsi.c | |||
@@ -104,7 +104,7 @@ static void virtscsi_compute_resid(struct scsi_cmnd *sc, u32 resid) | |||
104 | * | 104 | * |
105 | * Called with vq_lock held. | 105 | * Called with vq_lock held. |
106 | */ | 106 | */ |
107 | static void virtscsi_complete_cmd(void *buf) | 107 | static void virtscsi_complete_cmd(struct virtio_scsi *vscsi, void *buf) |
108 | { | 108 | { |
109 | struct virtio_scsi_cmd *cmd = buf; | 109 | struct virtio_scsi_cmd *cmd = buf; |
110 | struct scsi_cmnd *sc = cmd->sc; | 110 | struct scsi_cmnd *sc = cmd->sc; |
@@ -165,7 +165,8 @@ static void virtscsi_complete_cmd(void *buf) | |||
165 | sc->scsi_done(sc); | 165 | sc->scsi_done(sc); |
166 | } | 166 | } |
167 | 167 | ||
168 | static void virtscsi_vq_done(struct virtqueue *vq, void (*fn)(void *buf)) | 168 | static void virtscsi_vq_done(struct virtio_scsi *vscsi, struct virtqueue *vq, |
169 | void (*fn)(struct virtio_scsi *vscsi, void *buf)) | ||
169 | { | 170 | { |
170 | void *buf; | 171 | void *buf; |
171 | unsigned int len; | 172 | unsigned int len; |
@@ -173,7 +174,7 @@ static void virtscsi_vq_done(struct virtqueue *vq, void (*fn)(void *buf)) | |||
173 | do { | 174 | do { |
174 | virtqueue_disable_cb(vq); | 175 | virtqueue_disable_cb(vq); |
175 | while ((buf = virtqueue_get_buf(vq, &len)) != NULL) | 176 | while ((buf = virtqueue_get_buf(vq, &len)) != NULL) |
176 | fn(buf); | 177 | fn(vscsi, buf); |
177 | } while (!virtqueue_enable_cb(vq)); | 178 | } while (!virtqueue_enable_cb(vq)); |
178 | } | 179 | } |
179 | 180 | ||
@@ -184,11 +185,11 @@ static void virtscsi_req_done(struct virtqueue *vq) | |||
184 | unsigned long flags; | 185 | unsigned long flags; |
185 | 186 | ||
186 | spin_lock_irqsave(&vscsi->req_vq.vq_lock, flags); | 187 | spin_lock_irqsave(&vscsi->req_vq.vq_lock, flags); |
187 | virtscsi_vq_done(vq, virtscsi_complete_cmd); | 188 | virtscsi_vq_done(vscsi, vq, virtscsi_complete_cmd); |
188 | spin_unlock_irqrestore(&vscsi->req_vq.vq_lock, flags); | 189 | spin_unlock_irqrestore(&vscsi->req_vq.vq_lock, flags); |
189 | }; | 190 | }; |
190 | 191 | ||
191 | static void virtscsi_complete_free(void *buf) | 192 | static void virtscsi_complete_free(struct virtio_scsi *vscsi, void *buf) |
192 | { | 193 | { |
193 | struct virtio_scsi_cmd *cmd = buf; | 194 | struct virtio_scsi_cmd *cmd = buf; |
194 | 195 | ||
@@ -205,7 +206,7 @@ static void virtscsi_ctrl_done(struct virtqueue *vq) | |||
205 | unsigned long flags; | 206 | unsigned long flags; |
206 | 207 | ||
207 | spin_lock_irqsave(&vscsi->ctrl_vq.vq_lock, flags); | 208 | spin_lock_irqsave(&vscsi->ctrl_vq.vq_lock, flags); |
208 | virtscsi_vq_done(vq, virtscsi_complete_free); | 209 | virtscsi_vq_done(vscsi, vq, virtscsi_complete_free); |
209 | spin_unlock_irqrestore(&vscsi->ctrl_vq.vq_lock, flags); | 210 | spin_unlock_irqrestore(&vscsi->ctrl_vq.vq_lock, flags); |
210 | }; | 211 | }; |
211 | 212 | ||
@@ -329,7 +330,7 @@ static void virtscsi_handle_event(struct work_struct *work) | |||
329 | virtscsi_kick_event(vscsi, event_node); | 330 | virtscsi_kick_event(vscsi, event_node); |
330 | } | 331 | } |
331 | 332 | ||
332 | static void virtscsi_complete_event(void *buf) | 333 | static void virtscsi_complete_event(struct virtio_scsi *vscsi, void *buf) |
333 | { | 334 | { |
334 | struct virtio_scsi_event_node *event_node = buf; | 335 | struct virtio_scsi_event_node *event_node = buf; |
335 | 336 | ||
@@ -344,7 +345,7 @@ static void virtscsi_event_done(struct virtqueue *vq) | |||
344 | unsigned long flags; | 345 | unsigned long flags; |
345 | 346 | ||
346 | spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); | 347 | spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); |
347 | virtscsi_vq_done(vq, virtscsi_complete_event); | 348 | virtscsi_vq_done(vscsi, vq, virtscsi_complete_event); |
348 | spin_unlock_irqrestore(&vscsi->event_vq.vq_lock, flags); | 349 | spin_unlock_irqrestore(&vscsi->event_vq.vq_lock, flags); |
349 | }; | 350 | }; |
350 | 351 | ||