diff options
author | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-04-28 19:40:57 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-04-28 19:40:57 +0000 |
commit | d1a1034cbe1492a5b4cfdac5c3190dd5d069bc4f (patch) | |
tree | 716c15fb5221aa4180a82df3c791f9846f2832ce /sys/src/cmd/cwfs/iobuf.c | |
parent | c67c29952af0a50c265bf34fc317518fd43a8950 (diff) |
cwfs: reduce verbosity, added -d options if you want it anyway
Diffstat (limited to 'sys/src/cmd/cwfs/iobuf.c')
-rw-r--r-- | sys/src/cmd/cwfs/iobuf.c | 62 |
1 files changed, 11 insertions, 51 deletions
diff --git a/sys/src/cmd/cwfs/iobuf.c b/sys/src/cmd/cwfs/iobuf.c index 577cc7c38..c73f65aed 100644 --- a/sys/src/cmd/cwfs/iobuf.c +++ b/sys/src/cmd/cwfs/iobuf.c @@ -1,8 +1,6 @@ #include "all.h" #include "io.h" -enum { DEBUG = 0 }; - extern long nhiob; extern Hiob *hiob; @@ -13,7 +11,7 @@ getbuf(Device *d, Off addr, int flag) Hiob *hp; Off h; - if(DEBUG) + if(chatty > 1) print("getbuf %Z(%lld) f=%x\n", d, (Wideoff)addr, flag); h = addr + (Off)(uintptr)d*1009; if(h < 0) @@ -66,7 +64,7 @@ xloop: if(!canqlock(p)) { if(p == hp->link) { unlock(hp); - print("iobuf all locked\n"); + fprint(2, "iobuf all locked\n"); goto loop; } s = p; @@ -82,7 +80,7 @@ xloop: qunlock(p); if(p == hp->link) { unlock(hp); - print("iobuf all reserved\n"); + fprint(2, "iobuf all reserved\n"); goto loop; } s = p; @@ -102,7 +100,6 @@ xloop: p->addr = addr; p->dev = d; p->flags = flag; -// p->pc = getcallerpc(&d); unlock(hp); if(iobufmap(p)) if(flag & Brd) { @@ -112,7 +109,7 @@ xloop: } else return p; else - print("iobuf cant map buffer\n"); + fprint(2, "iobuf cant map buffer %Z(%lld)\n", p->dev, (Wideoff)p->addr); p->flags = 0; p->dev = devnone; p->addr = -1; @@ -176,11 +173,11 @@ sync(char *reason) { long i; - print("sync: %s\n", reason); + if(chatty) + print("sync: %s\n", reason); for(i=10*nhiob; i>0; i--) if(!syncblock()) return; - print("sync shorted\n"); } void @@ -188,10 +185,10 @@ putbuf(Iobuf *p) { if(canqlock(p)) - print("buffer not locked %Z(%lld)\n", p->dev, (Wideoff)p->addr); + fprint(2, "buffer not locked %Z(%lld)\n", p->dev, (Wideoff)p->addr); if(p->flags & Bimm) { if(!(p->flags & Bmod)) - print("imm and no mod %Z(%lld)\n", + fprint(2, "imm and no mod %Z(%lld)\n", p->dev, (Wideoff)p->addr); if(!devwrite(p->dev, p->addr, p->iobuf)) p->flags &= ~(Bmod|Bimm); @@ -212,43 +209,14 @@ checktag(Iobuf *p, int tag, Off qpath) pc = getcallerpc(&p); if(qpath == QPNONE){ - print("checktag pc=%lux %Z(%llux) tag/path=%G/%llud; expected %G\n", + fprint(2, "checktag pc=%lux %Z(%llux) tag/path=%G/%llud; expected %G\n", pc, p->dev, (Wideoff)p->addr, t->tag, (Wideoff)t->path, tag); } else { - print("checktag pc=%lux %Z(%llux) tag/path=%G/%llud; expected %G/%llud\n", + fprint(2, "checktag pc=%lux %Z(%llux) tag/path=%G/%llud; expected %G/%llud\n", pc, p->dev, (Wideoff)p->addr, t->tag, (Wideoff)t->path, tag, qpath); } return 1; - } - - /* - if(t->tag != tag) { - if(p->flags & Bmod) { - print("\t%llux: tag = %G/%llud; expected %G/%d -- not flushed\n", - t->tag, (Wideoff)t->path, (Wideoff)qpath, tag); - return 2; - } - if(p->dev != nil && p->dev->type == Devcw) - cwfree(p->dev, p->addr); - if(p->addr != lastaddr) - print("\t%llux: tag = %G/%llud; expected %G/%lld -- flushed\n", - (Wideoff)p->addr, t->tag, (Wideoff)t->path, tag, (Wideoff)qpath); - - lastaddr = p->addr; - p->dev = devnone; - p->addr = -1; - p->flags = 0; - return 2; - } - if(qpath != QPNONE) { - if(qpath ^ t->path) { - print("\t%llux: tag/path = %G/%llud; expected %G/%llux\n", - (Wideoff)p->addr, t->tag, (Wideoff)t->path, tag, (Wideoff)qpath); - return 0; - } - } - */ - + } return 0; } @@ -276,9 +244,7 @@ iobufql(QLock *q) { Iobuf *p, *s; Hiob *hp; - Tag *t; long h; - int tag; for(h=0; h<nhiob; h++) { hp = &hiob[h]; @@ -286,12 +252,6 @@ iobufql(QLock *q) s = hp->link; for(p=s;;) { if(qlmatch(q, p)) { - t = (Tag*)(p->iobuf+BUFSIZE); - tag = t->tag; - if(tag < 0 || tag >= MAXTAG) - tag = Tnone; - print("\tIobuf %Z(%lld) t=%s\n", - p->dev, (Wideoff)p->addr, tagnames[tag]); unlock(hp); return 1; } |