vhost: Create accessors for virtqueues private_data
Signed-off-by: Eugenio Pérez <eperezma@redhat.com> Link: https://lore.kernel.org/r/20200331192804.6019-2-eperezma@redhat.com Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
这个提交包含在:
@@ -452,7 +452,7 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
|
||||
unsigned out, in;
|
||||
int head, ret;
|
||||
|
||||
if (!vq->private_data) {
|
||||
if (!vhost_vq_get_backend(vq)) {
|
||||
vs->vs_events_missed = true;
|
||||
return;
|
||||
}
|
||||
@@ -892,7 +892,7 @@ vhost_scsi_get_req(struct vhost_virtqueue *vq, struct vhost_scsi_ctx *vc,
|
||||
} else {
|
||||
struct vhost_scsi_tpg **vs_tpg, *tpg;
|
||||
|
||||
vs_tpg = vq->private_data; /* validated at handler entry */
|
||||
vs_tpg = vhost_vq_get_backend(vq); /* validated at handler entry */
|
||||
|
||||
tpg = READ_ONCE(vs_tpg[*vc->target]);
|
||||
if (unlikely(!tpg)) {
|
||||
@@ -929,7 +929,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
|
||||
* We can handle the vq only after the endpoint is setup by calling the
|
||||
* VHOST_SCSI_SET_ENDPOINT ioctl.
|
||||
*/
|
||||
vs_tpg = vq->private_data;
|
||||
vs_tpg = vhost_vq_get_backend(vq);
|
||||
if (!vs_tpg)
|
||||
goto out;
|
||||
|
||||
@@ -1184,7 +1184,7 @@ vhost_scsi_ctl_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
|
||||
* We can handle the vq only after the endpoint is setup by calling the
|
||||
* VHOST_SCSI_SET_ENDPOINT ioctl.
|
||||
*/
|
||||
if (!vq->private_data)
|
||||
if (!vhost_vq_get_backend(vq))
|
||||
goto out;
|
||||
|
||||
memset(&vc, 0, sizeof(vc));
|
||||
@@ -1322,7 +1322,7 @@ static void vhost_scsi_evt_handle_kick(struct vhost_work *work)
|
||||
struct vhost_scsi *vs = container_of(vq->dev, struct vhost_scsi, dev);
|
||||
|
||||
mutex_lock(&vq->mutex);
|
||||
if (!vq->private_data)
|
||||
if (!vhost_vq_get_backend(vq))
|
||||
goto out;
|
||||
|
||||
if (vs->vs_events_missed)
|
||||
@@ -1460,7 +1460,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
|
||||
for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
|
||||
vq = &vs->vqs[i].vq;
|
||||
mutex_lock(&vq->mutex);
|
||||
vq->private_data = vs_tpg;
|
||||
vhost_vq_set_backend(vq, vs_tpg);
|
||||
vhost_vq_init_access(vq);
|
||||
mutex_unlock(&vq->mutex);
|
||||
}
|
||||
@@ -1547,7 +1547,7 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
|
||||
for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
|
||||
vq = &vs->vqs[i].vq;
|
||||
mutex_lock(&vq->mutex);
|
||||
vq->private_data = NULL;
|
||||
vhost_vq_set_backend(vq, NULL);
|
||||
mutex_unlock(&vq->mutex);
|
||||
}
|
||||
}
|
||||
|
在新工单中引用
屏蔽一个用户