That's intentional I think - we need both.+EXPORT_SYMBOL_GPL(vhost_get_vq_desc);So unfetch_descs() has decreased last_avail_idx.
/* Reverse the effect of vhost_get_vq_desc. Useful for error handling. */
void vhost_discard_vq_desc(struct vhost_virtqueue *vq, int n)
{
+ unfetch_descs(vq);
vq->last_avail_idx -= n;
Can we fix this by letting unfetch_descs() return the number and then we can
do:
int d = unfetch_descs(vq);
vq->last_avail_idx -= (n > d) ? n - d: 0;
Thanks
Unfetch_descs drops the descriptors in the cache that were
*not returned to caller* through get_vq_desc.
vhost_discard_vq_desc drops the ones that were returned through get_vq_desc.
Did I miss anything?