pc, pc64: fix sdvirtio descriptor count when sending flush
This commit is contained in:
parent
f5174e6fdf
commit
30a9d59070
1 changed files with 14 additions and 8 deletions
|
@ -326,7 +326,7 @@ vqio(Vqueue *q, int head)
|
|||
static int
|
||||
vioblkreq(Vdev *vd, int typ, void *a, long count, long secsize, uvlong lba)
|
||||
{
|
||||
int free, head;
|
||||
int need, free, head;
|
||||
Vqueue *q;
|
||||
Vdesc *d;
|
||||
|
||||
|
@ -337,14 +337,18 @@ vioblkreq(Vdev *vd, int typ, void *a, long count, long secsize, uvlong lba)
|
|||
u64int lba;
|
||||
} req;
|
||||
|
||||
status = 0;
|
||||
need = 2;
|
||||
if(a != nil)
|
||||
need = 3;
|
||||
|
||||
status = -1;
|
||||
req.typ = typ;
|
||||
req.prio = 0;
|
||||
req.lba = lba;
|
||||
|
||||
q = vd->queue[0];
|
||||
ilock(q);
|
||||
while(q->nfree < 3){
|
||||
while(q->nfree < need){
|
||||
iunlock(q);
|
||||
|
||||
if(!waserror())
|
||||
|
@ -361,10 +365,12 @@ vioblkreq(Vdev *vd, int typ, void *a, long count, long secsize, uvlong lba)
|
|||
d->len = sizeof(req);
|
||||
d->flags = Next;
|
||||
|
||||
d = &q->desc[free]; free = d->next;
|
||||
d->addr = PADDR(a);
|
||||
d->len = secsize*count;
|
||||
d->flags = typ ? Next : (Write|Next);
|
||||
if(a != nil){
|
||||
d = &q->desc[free]; free = d->next;
|
||||
d->addr = PADDR(a);
|
||||
d->len = secsize*count;
|
||||
d->flags = typ ? Next : (Write|Next);
|
||||
}
|
||||
|
||||
d = &q->desc[free]; free = d->next;
|
||||
d->addr = PADDR(&status);
|
||||
|
@ -372,7 +378,7 @@ vioblkreq(Vdev *vd, int typ, void *a, long count, long secsize, uvlong lba)
|
|||
d->flags = Write;
|
||||
|
||||
q->free = free;
|
||||
q->nfree -= 3;
|
||||
q->nfree -= need;
|
||||
|
||||
/* queue io, unlock and wait for completion */
|
||||
vqio(q, head);
|
||||
|
|
Loading…
Reference in a new issue