Skip to content

Commit e5e6b15

Browse files
Dongli Zhangmstsirkin
authored andcommitted
vhost-scsi: adjust vhost_scsi_get_desc() to log vring descriptors
Adjust vhost_scsi_get_desc() to facilitate logging of vring descriptors. Add new arguments to allow passing the log buffer and length to vhost_get_vq_desc(). In addition, reset 'log_num' since vhost_get_vq_desc() may reset it only after certain condition checks. Suggested-by: Joao Martins <joao.m.martins@oracle.com> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com> Reviewed-by: Mike Christie <michael.christie@oracle.com> Message-Id: <20250403063028.16045-6-dongli.zhang@oracle.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
1 parent 41cff02 commit e5e6b15

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/vhost/scsi.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,13 +1063,17 @@ vhost_scsi_send_bad_target(struct vhost_scsi *vs,
10631063

10641064
static int
10651065
vhost_scsi_get_desc(struct vhost_scsi *vs, struct vhost_virtqueue *vq,
1066-
struct vhost_scsi_ctx *vc)
1066+
struct vhost_scsi_ctx *vc,
1067+
struct vhost_log *log, unsigned int *log_num)
10671068
{
10681069
int ret = -ENXIO;
10691070

1071+
if (likely(log_num))
1072+
*log_num = 0;
1073+
10701074
vc->head = vhost_get_vq_desc(vq, vq->iov,
10711075
ARRAY_SIZE(vq->iov), &vc->out, &vc->in,
1072-
NULL, NULL);
1076+
log, log_num);
10731077

10741078
pr_debug("vhost_get_vq_desc: head: %d, out: %u in: %u\n",
10751079
vc->head, vc->out, vc->in);
@@ -1237,7 +1241,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
12371241
vhost_disable_notify(&vs->dev, vq);
12381242

12391243
do {
1240-
ret = vhost_scsi_get_desc(vs, vq, &vc);
1244+
ret = vhost_scsi_get_desc(vs, vq, &vc, NULL, NULL);
12411245
if (ret)
12421246
goto err;
12431247

@@ -1581,7 +1585,7 @@ vhost_scsi_ctl_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
15811585
vhost_disable_notify(&vs->dev, vq);
15821586

15831587
do {
1584-
ret = vhost_scsi_get_desc(vs, vq, &vc);
1588+
ret = vhost_scsi_get_desc(vs, vq, &vc, NULL, NULL);
15851589
if (ret)
15861590
goto err;
15871591

0 commit comments

Comments
 (0)