Browse Source

Avoid unnecessary retries in sdiahci

We get the retry because ci is cleared between the time it's set and we test it before sleeping.  We don't clear ci manually, but it can be cleared if the ST flag on p->cmd is cleared (and probably for other reasons too).  We clear the st flag at various points throughout the sdiahci code

This is a little hacky, but ensures we always sleep, which would always happen in the usual case anyway.

Signed-off-by: Graham MacDonald <grahamamacdonald@gmail.com>
Graham MacDonald 5 years ago
parent
commit
db7f6855d8
2 changed files with 28 additions and 2 deletions
  1. 8 2
      sys/src/9/amd64/sdiahci.c
  2. 20 0
      util/img/prepfs

+ 8 - 2
sys/src/9/amd64/sdiahci.c

@@ -202,6 +202,7 @@ struct Ctlr {
 struct Asleep {
 	Aport	*p;
 	int	i;
+	int	slept;
 };
 
 extern SDifc sdiahciifc;
@@ -279,9 +280,13 @@ esleep(int ms)
 static int
 ahciclear(void *v)
 {
-	Asleep *s;
+	Asleep *s = v;
+
+	if (!s->slept) {
+		s->slept = 1;
+		return 0;
+	}
 
-	s = v;
 	return (s->p->ci & s->i) == 0;
 }
 
@@ -1897,6 +1902,7 @@ retry:
 
 		as.p = p;
 		as.i = 1;
+		as.slept = 0;
 		d->intick = sys->ticks;
 		d->active++;
 

+ 20 - 0
util/img/prepfs

@@ -0,0 +1,20 @@
+#!/bin/rc
+venti=127.0.0.1
+
+disk/prep -w -a^(nvram fossil arenas bloom isect) /dev/sdE0/plan9
+
+venti/fmtarenas arenas0 /dev/sdE0/arenas
+venti/fmtisect isect0 /dev/sdE0/isect
+venti/fmtindex /util/img/venti.conf
+venti/conf -w /dev/sdE0/arenas < /util/img/venti.conf
+venti/venti -c /dev/sdE0/arenas
+fossil/flfmt /dev/sdE0/fossil
+fossil/conf -w /dev/sdE0/fossil < /util/img/fossil.conf
+fossil/fossil -f /dev/sdE0/fossil
+
+mount -c /srv/fossil /n/fossil
+
+cd /n/fossil
+mkdir x
+cd x
+dircp /root/amd64 .