| plan 9 kernel history: overview | file list | diff list |
1999/1227/port/cache.c (diff list | history)
| 1999/1101/sys/src/9/port/cache.c:483,508 – 1999/1227/sys/src/9/port/cache.c:483,508 (short | long | prev | next) | ||
| 1998/0327 | offset = off; | |
| 1993/1014 | p = 0; for(f = m->list; f; f = f->next) { | |
| 1999/1227 | if(f->start > offset) | |
| 1993/1014 | break; p = f; } | |
| 1993/1015 | ||
| 1993/1014 |
| |
| 1999/1227 | /* trim if there is a successor */ eblock = offset+len; if(f != 0 && eblock > f->start) { len -= (eblock - f->start); if(len <= 0) { qunlock(m); return; | |
| 1993/1014 | } | |
| 1999/1227 | } if(p == 0) { /* at the head */ | |
| 1993/1014 | e = cchain(buf, offset, len, &tail); | |
| 1993/1016 | if(e != 0) { m->list = e; | |
| 1999/1227 | tail->next = f; | |
| 1993/1016 | } | |
| 1993/1014 | qunlock(m); return; | |
| 1999/1101/sys/src/9/port/cache.c:532,537 – 1999/1227/sys/src/9/port/cache.c:532,538 | ||
| 1993/1014 | len -= o; offset += o; if(len <= 0) { | |
| 1999/1227 | if (f && p->start + p->len > f->start) print("CACHE: p->start=%uld p->len=%d f->start=%uld\n", p->start, p->len, f->start); | |
| 1993/1014 | qunlock(m); return; } | |
| 1999/1101/sys/src/9/port/cache.c:538,568 – 1999/1227/sys/src/9/port/cache.c:539,549 | ||
| 1993/1014 | } | |
| 1993/1013 | } | |
| 1993/1014 |
| |
| 1993/1016 |
| |
| 1993/1014 |
| |
| 1993/1015 |
| |
| 1993/1014 |
| |
| 1999/1227 | e = cchain(buf, offset, len, &tail); if(e != 0) { p->next = e; | |
| 1993/1014 | tail->next = f; | |
| 1999/1227 | } | |
| 1993/1014 | qunlock(m); | |
| 1993/1015 | } | |
| 1999/1101/sys/src/9/port/cache.c:569,575 – 1999/1227/sys/src/9/port/cache.c:550,556 | ||
| 1993/1015 | void | |
| 1998/0327 | cwrite(Chan* c, uchar *buf, int len, vlong off) | |
| 1993/1015 | { | |
| 1996/0326 |
| |
| 1999/1227 | int o, eo; | |
| 1993/1015 | Mntcache *m; ulong eblock, ee; Extent *p, *f, *e, *tail; | |
| 1999/1101/sys/src/9/port/cache.c:599,648 – 1999/1227/sys/src/9/port/cache.c:580,605 | ||
| 1998/0512 | p = f; | |
| 1996/0326 | } | |
| 1996/0402 |
| |
| 1996/0326 |
| |
| 1996/0329 |
| |
| 1996/0326 |
| |
| 1993/1015 |
| |
| 1993/1016 |
| |
| 1993/1015 |
| |
| 1993/1018 |
| |
| 1993/1017 |
| |
| 1999/1227 | eo = offset - p->start; /* pack in predecessor if there is space */ if(offset <= ee && eo < BY2PG) { | |
| 1993/1017 | o = len; | |
| 1999/1227 | if(o > BY2PG - eo) o = BY2PG - eo; if(cpgmove(p, buf, eo, o)) { if(eo+o > p->len) p->len = eo+o; | |
| 1993/1017 | buf += o; len -= o; offset += o; | |
| 1993/1015 | } | |
| 1999/1227 | /* free the overlap -- it's a rare case */ | |
| 1993/1015 | eblock = offset+len; | |
| 1999/0508 | extentfree(f); | |
| 1999/1101/sys/src/9/port/cache.c:649,663 – 1999/1227/sys/src/9/port/cache.c:606,621 | ||
| 1993/1015 | f = e; } | |
| 1999/1227 | /* link the block (if any) into the middle */ | |
| 1993/1015 | e = cchain(buf, offset, len, &tail); | |
| 1993/1016 | if(e != 0) { | |
| 1993/1022 | ||
| 1993/1016 |
| |
| 1999/1227 | tail->next = f; f = e; | |
| 1993/1016 | } | |
| 1999/1227 | if(p == 0) m->list = f; else p->next = f; | |
| 1993/1015 | qunlock(m); | |
| 1993/1011 | } | |