* NAME: block->dumpcache() * DESCRIPTION: dump the cache tables for a volume */
| 104 | * DESCRIPTION: dump the cache tables for a volume |
| 105 | */ |
| 106 | void b_dumpcache(const bcache *cache) |
| 107 | { |
| 108 | const bucket *b; |
| 109 | int i; |
| 110 | |
| 111 | fprintf(stderr, "BLOCK CACHE DUMP:\n"); |
| 112 | |
| 113 | for (i = 0, b = cache->tail->cnext; i < HFS_CACHESZ; ++i, b = b->cnext) |
| 114 | { |
| 115 | if (INUSE(b)) |
| 116 | { |
| 117 | fprintf(stderr, "\t %lu", b->bnum); |
| 118 | if (DIRTY(b)) |
| 119 | fprintf(stderr, "*"); |
| 120 | |
| 121 | fprintf(stderr, ":%u", b->count); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | fprintf(stderr, "\n"); |
| 126 | |
| 127 | fprintf(stderr, "BLOCK HASH DUMP:\n"); |
| 128 | |
| 129 | for (i = 0; i < HFS_HASHSZ; ++i) |
| 130 | { |
| 131 | int seen = 0; |
| 132 | |
| 133 | for (b = cache->hash[i]; b; b = b->hnext) |
| 134 | { |
| 135 | if (! seen) |
| 136 | fprintf(stderr, " %d:", i); |
| 137 | |
| 138 | if (INUSE(b)) |
| 139 | { |
| 140 | fprintf(stderr, " %lu", b->bnum); |
| 141 | if (DIRTY(b)) |
| 142 | fprintf(stderr, "*"); |
| 143 | |
| 144 | fprintf(stderr, ":%u", b->count); |
| 145 | } |
| 146 | |
| 147 | seen = 1; |
| 148 | } |
| 149 | |
| 150 | if (seen) |
| 151 | fprintf(stderr, "\n"); |
| 152 | } |
| 153 | } |
| 154 | # endif |
| 155 | |
| 156 | /* |