hjfs: check: check a block if its ref count is _not_ zero. Also check all the ref counts of blocks of a directory and clean up messages

This commit is contained in:
spew 2017-03-27 17:57:10 -05:00
parent 4671df38fe
commit e02bc28aaf
2 changed files with 5 additions and 3 deletions

View file

@ -16,14 +16,16 @@ checkdir(FLoc *l, Buf *b)
d = getdent(l, b);
for(i = 0; i < d->size; i++){
if(getblk(fsmain, l, b, i, &r, GBREAD) <= 0) {
dprint("hjfs: directory %s in block %ulld at index %d has a bad block reference at %ulld\n", d->name, l->blk, l->deind, i);
dprint("hjfs: directory in block %ulld at index %d has a bad block %ulld at directory index %ulld\n", l->blk, l->deind, r, i);
continue;
}
c = getbuf(fsmain->d, r, TDENTRY, 0);
if(c == nil) {
dprint("hjfs: directory %s in block %ulld at index %d has a block %ulld that is not a directory entry\n", d->name, l->blk, l->deind, i);
dprint("hjfs: directory in block %ulld at index %d has a block %ulld at directory index %ulld that is not a directory entry\n", l->blk, l->deind, r, i);
continue;
}
if(chref(fsmain, r, 0) == 0)
dprint("hjfs: directory in block %ulld at index %d has a block %ulld at index %ulld whose reference count is 0");
}
}

View file

@ -127,7 +127,7 @@ cmdcheck(int, char**)
continue;
}
for(j = 0; j < REFPERBLK; j++, blk++)
if(b->refs[j] == 0)
if(b->refs[j] > 0)
checkblk(blk);
putbuf(b);
}