summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspew <devnull@localhost>2017-03-27 17:57:10 -0500
committerspew <devnull@localhost>2017-03-27 17:57:10 -0500
commite02bc28aaf0acd21195914dc1f116651ade2b7b5 (patch)
treebcae4d7c46d6a27df6a41304d603c6f4d86283de
parent4671df38fe8b526e7f72c494e093563e1d744d74 (diff)
downloadplan9front-e02bc28aaf0acd21195914dc1f116651ade2b7b5.tar.xz
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
-rw-r--r--sys/src/cmd/hjfs/check.c6
-rw-r--r--sys/src/cmd/hjfs/cons.c2
2 files changed, 5 insertions, 3 deletions
diff --git a/sys/src/cmd/hjfs/check.c b/sys/src/cmd/hjfs/check.c
index edb11b75e..4e540e70c 100644
--- a/sys/src/cmd/hjfs/check.c
+++ b/sys/src/cmd/hjfs/check.c
@@ -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");
}
}
diff --git a/sys/src/cmd/hjfs/cons.c b/sys/src/cmd/hjfs/cons.c
index e2bff60ba..b8b9278f1 100644
--- a/sys/src/cmd/hjfs/cons.c
+++ b/sys/src/cmd/hjfs/cons.c
@@ -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);
}