Message ID | 20231026195451.32587-2-yuxuan.luo@canonical.com |
---|---|
State | New |
Headers | show |
Series | [SRU,J/L/M,1/1] vringh: don't use vringh_kiov_advance() in vringh_iov_xfer() | expand |
diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c index 786876af0a73a..13b75213ebaae 100644 --- a/drivers/vhost/vringh.c +++ b/drivers/vhost/vringh.c @@ -123,8 +123,18 @@ static inline ssize_t vringh_iov_xfer(struct vringh *vrh, done += partlen; len -= partlen; ptr += partlen; + iov->consumed += partlen; + iov->iov[iov->i].iov_len -= partlen; + iov->iov[iov->i].iov_base += partlen; - vringh_kiov_advance(iov, partlen); + if (!iov->iov[iov->i].iov_len) { + /* Fix up old iov element then increment. */ + iov->iov[iov->i].iov_len = iov->consumed; + iov->iov[iov->i].iov_base -= iov->consumed; + + iov->consumed = 0; + iov->i++; + } } return done; }