Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44ed8089 authored by Richard W.M. Jones's avatar Richard W.M. Jones Committed by Martin K. Petersen
Browse files

scsi: virtio: Reduce BUG if total_sg > virtqueue size to WARN.



If using indirect descriptors, you can make the total_sg as large as you
want.  If not, BUG is too serious because the function later returns
-ENOSPC.

Signed-off-by: default avatarRichard W.M. Jones <rjones@redhat.com>
Reviewed-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 42d7c10f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -296,7 +296,6 @@ static inline int virtqueue_add(struct virtqueue *_vq,
	}
#endif

	BUG_ON(total_sg > vq->vring.num);
	BUG_ON(total_sg == 0);

	head = vq->free_head;
@@ -305,8 +304,10 @@ static inline int virtqueue_add(struct virtqueue *_vq,
	 * buffers, then go indirect. FIXME: tune this threshold */
	if (vq->indirect && total_sg > 1 && vq->vq.num_free)
		desc = alloc_indirect(_vq, total_sg, gfp);
	else
	else {
		desc = NULL;
		WARN_ON_ONCE(total_sg > vq->vring.num && !vq->indirect);
	}

	if (desc) {
		/* Use a single buffer which doesn't continue */