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
|
static int
|
||||||
vioblkreq(Vdev *vd, int typ, void *a, long count, long secsize, uvlong lba)
|
vioblkreq(Vdev *vd, int typ, void *a, long count, long secsize, uvlong lba)
|
||||||
{
|
{
|
||||||
int free, head;
|
int need, free, head;
|
||||||
Vqueue *q;
|
Vqueue *q;
|
||||||
Vdesc *d;
|
Vdesc *d;
|
||||||
|
|
||||||
|
@ -337,14 +337,18 @@ vioblkreq(Vdev *vd, int typ, void *a, long count, long secsize, uvlong lba)
|
||||||
u64int lba;
|
u64int lba;
|
||||||
} req;
|
} req;
|
||||||
|
|
||||||
status = 0;
|
need = 2;
|
||||||
|
if(a != nil)
|
||||||
|
need = 3;
|
||||||
|
|
||||||
|
status = -1;
|
||||||
req.typ = typ;
|
req.typ = typ;
|
||||||
req.prio = 0;
|
req.prio = 0;
|
||||||
req.lba = lba;
|
req.lba = lba;
|
||||||
|
|
||||||
q = vd->queue[0];
|
q = vd->queue[0];
|
||||||
ilock(q);
|
ilock(q);
|
||||||
while(q->nfree < 3){
|
while(q->nfree < need){
|
||||||
iunlock(q);
|
iunlock(q);
|
||||||
|
|
||||||
if(!waserror())
|
if(!waserror())
|
||||||
|
@ -361,10 +365,12 @@ vioblkreq(Vdev *vd, int typ, void *a, long count, long secsize, uvlong lba)
|
||||||
d->len = sizeof(req);
|
d->len = sizeof(req);
|
||||||
d->flags = Next;
|
d->flags = Next;
|
||||||
|
|
||||||
d = &q->desc[free]; free = d->next;
|
if(a != nil){
|
||||||
d->addr = PADDR(a);
|
d = &q->desc[free]; free = d->next;
|
||||||
d->len = secsize*count;
|
d->addr = PADDR(a);
|
||||||
d->flags = typ ? Next : (Write|Next);
|
d->len = secsize*count;
|
||||||
|
d->flags = typ ? Next : (Write|Next);
|
||||||
|
}
|
||||||
|
|
||||||
d = &q->desc[free]; free = d->next;
|
d = &q->desc[free]; free = d->next;
|
||||||
d->addr = PADDR(&status);
|
d->addr = PADDR(&status);
|
||||||
|
@ -372,7 +378,7 @@ vioblkreq(Vdev *vd, int typ, void *a, long count, long secsize, uvlong lba)
|
||||||
d->flags = Write;
|
d->flags = Write;
|
||||||
|
|
||||||
q->free = free;
|
q->free = free;
|
||||||
q->nfree -= 3;
|
q->nfree -= need;
|
||||||
|
|
||||||
/* queue io, unlock and wait for completion */
|
/* queue io, unlock and wait for completion */
|
||||||
vqio(q, head);
|
vqio(q, head);
|
||||||
|
|
Loading…
Reference in a new issue