b 41 bio.c struct buf *b; b 49 bio.c for(b = bcache.buf; b < bcache.buf+NBUF; b++){ b 50 bio.c b->next = bcache.head.next; b 51 bio.c b->prev = &bcache.head; b 52 bio.c initsleeplock(&b->lock, "buffer"); b 53 bio.c bcache.head.next->prev = b; b 54 bio.c bcache.head.next = b; b 64 bio.c struct buf *b; b 69 bio.c for(b = bcache.head.next; b != &bcache.head; b = b->next){ b 70 bio.c if(b->dev == dev && b->blockno == blockno){ b 71 bio.c b->refcnt++; b 73 bio.c acquiresleep(&b->lock); b 74 bio.c return b; b 81 bio.c for(b = bcache.head.prev; b != &bcache.head; b = b->prev){ b 82 bio.c if(b->refcnt == 0 && (b->flags & B_DIRTY) == 0) { b 83 bio.c b->dev = dev; b 84 bio.c b->blockno = blockno; b 85 bio.c b->flags = 0; b 86 bio.c b->refcnt = 1; b 88 bio.c acquiresleep(&b->lock); b 89 bio.c return b; b 99 bio.c struct buf *b; b 101 bio.c b = bget(dev, blockno); b 102 bio.c if((b->flags & B_VALID) == 0) { b 103 bio.c iderw(b); b 105 bio.c return b; b 110 bio.c bwrite(struct buf *b) b 112 bio.c if(!holdingsleep(&b->lock)) b 114 bio.c b->flags |= B_DIRTY; b 115 bio.c iderw(b); b 121 bio.c brelse(struct buf *b) b 123 bio.c if(!holdingsleep(&b->lock)) b 126 bio.c releasesleep(&b->lock); b 129 bio.c b->refcnt--; b 130 bio.c if (b->refcnt == 0) { b 132 bio.c b->next->prev = b->prev; b 133 bio.c b->prev->next = b->next; b 134 bio.c b->next = bcache.head.next; b 135 bio.c b->prev = &bcache.head; b 136 bio.c bcache.head.next->prev = b; b 137 bio.c bcache.head.next = b; b 24 fs.c #define min(a, b) ((a) < (b) ? (a) : (b)) b 59 fs.c int b, bi, m; b 63 fs.c for(b = 0; b < sb.size; b += BPB){ b 64 fs.c bp = bread(dev, BBLOCK(b, sb)); b 65 fs.c for(bi = 0; bi < BPB && b + bi < sb.size; bi++){ b 71 fs.c bzero(dev, b + bi); b 72 fs.c return b + bi; b 82 fs.c bfree(int dev, uint b) b 87 fs.c bp = bread(dev, BBLOCK(b, sb)); b 88 fs.c bi = b % BPB; b 48 fs.h #define BBLOCK(b, sb) (b/BPB + sb.bmapstart) b 74 ide.c idestart(struct buf *b) b 76 ide.c if(b == 0) b 78 ide.c if(b->blockno >= FSSIZE) b 81 ide.c int sector = b->blockno * sector_per_block; b 93 ide.c outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((sector>>24)&0x0f)); b 94 ide.c if(b->flags & B_DIRTY){ b 96 ide.c outsl(0x1f0, b->data, BSIZE/4); b 106 ide.c struct buf *b; b 111 ide.c if((b = idequeue) == 0){ b 115 ide.c idequeue = b->qnext; b 118 ide.c if(!(b->flags & B_DIRTY) && idewait(1) >= 0) b 119 ide.c insl(0x1f0, b->data, BSIZE/4); b 122 ide.c b->flags |= B_VALID; b 123 ide.c b->flags &= ~B_DIRTY; b 124 ide.c wakeup(b); b 138 ide.c iderw(struct buf *b) b 142 ide.c if(!holdingsleep(&b->lock)) b 144 ide.c if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) b 146 ide.c if(b->dev != 0 && !havedisk1) b 152 ide.c b->qnext = 0; b 155 ide.c *pp = b; b 158 ide.c if(idequeue == b) b 159 ide.c idestart(b); b 162 ide.c while((b->flags & (B_VALID|B_DIRTY)) != B_VALID){ b 163 ide.c sleep(b, &idelock); b 214 log.c log_write(struct buf *b) b 225 log.c if (log.lh.block[i] == b->blockno) // log absorbtion b 228 log.c log.lh.block[i] = b->blockno; b 231 log.c b->flags |= B_DIRTY; // prevent eviction b 39 memide.c iderw(struct buf *b) b 43 memide.c if(!holdingsleep(&b->lock)) b 45 memide.c if((b->flags & (B_VALID|B_DIRTY)) == B_VALID) b 47 memide.c if(b->dev != 1) b 49 memide.c if(b->blockno >= disksize) b 52 memide.c p = memdisk + b->blockno*BSIZE; b 54 memide.c if(b->flags & B_DIRTY){ b 55 memide.c b->flags &= ~B_DIRTY; b 56 memide.c memmove(p, b->data, BSIZE); b 58 memide.c memmove(b->data, p, BSIZE); b 59 memide.c b->flags |= B_VALID; b 15 mkfs.c #define static_assert(a, b) do { switch (0) case 0: case (a): ; } while (0) b 253 mkfs.c #define min(a, b) ((a) < (b) ? (a) : (b)) b 1418 usertests.c char *a, *b, *c, *lastaddr, *oldbrk, *p, scratch; b 1428 usertests.c b = sbrk(1); b 1429 usertests.c if(b != a){ b 1430 usertests.c printf(stdout, "sbrk test failed %d %x %x\n", i, a, b); b 1433 usertests.c *b = 1; b 1434 usertests.c a = b + 1;