diff options
author | mckusick <mckusick@FreeBSD.org> | 2000-07-06 02:03:11 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2000-07-06 02:03:11 +0000 |
commit | 61ae57db5644ea213c5f6e71034a210758481548 (patch) | |
tree | 5bfded644e81cd5a948de9bc77c23fea5fb4c941 /sbin/fsck_ffs/pass5.c | |
parent | fc37193d7575813e332e1faffa470fe104a69c99 (diff) | |
download | FreeBSD-src-61ae57db5644ea213c5f6e71034a210758481548.zip FreeBSD-src-61ae57db5644ea213c5f6e71034a210758481548.tar.gz |
Teach fsck about snapshot files. These changes should have no
effect on operation of fsck on filesystems without snapshots.
If you get compilation errors, be sure that you have copies of
/usr/include/sys/mount.h (1.94), /usr/include/sys/stat.h (1.21),
and /usr/include/ufs/ffs/fs.h (1.16) as of July 4, 2000 or later.
Diffstat (limited to 'sbin/fsck_ffs/pass5.c')
-rw-r--r-- | sbin/fsck_ffs/pass5.c | 70 |
1 files changed, 68 insertions, 2 deletions
diff --git a/sbin/fsck_ffs/pass5.c b/sbin/fsck_ffs/pass5.c index d5edaac..e395625 100644 --- a/sbin/fsck_ffs/pass5.c +++ b/sbin/fsck_ffs/pass5.c @@ -53,12 +53,12 @@ void pass5() { int c, blk, frags, basesize, sumsize, mapsize, savednrpos = 0; - int inomapsize, blkmapsize; + int inomapsize, blkmapsize, astart, aend, ustart, uend; struct fs *fs = &sblock; struct cg *cg = &cgrp; ufs_daddr_t dbase, dmax; ufs_daddr_t d; - long i, j, k; + long i, j, k, l, m, n; struct csum *cs; struct csum cstotal; struct inodesc idesc[3]; @@ -314,6 +314,72 @@ pass5() &cg_blktot(newcg)[0], (size_t)sumsize); cgdirty(); } + if (debug) { + for (i = 0; i < inomapsize; i++) { + j = cg_inosused(newcg)[i]; + k = cg_inosused(cg)[i]; + if (j == k) + continue; + for (m = 0, l = 1; m < NBBY; m++, l <<= 1) { + if ((j & l) == (k & l)) + continue; + n = c * fs->fs_ipg + i * NBBY + m; + if ((j & l) != 0) + pwarn("%s INODE %d MARKED %s\n", + "ALLOCATED", n, "FREE"); + else + pwarn("%s INODE %d MARKED %s\n", + "UNALLOCATED", n, "USED"); + } + } + astart = ustart = -1; + for (i = 0; i < blkmapsize; i++) { + j = cg_blksfree(cg)[i]; + k = cg_blksfree(newcg)[i]; + if (j == k) + continue; + for (m = 0, l = 1; m < NBBY; m++, l <<= 1) { + if ((j & l) == (k & l)) + continue; + n = c * fs->fs_fpg + i * NBBY + m; + if ((j & l) != 0) { + if (astart == -1) { + astart = aend = n; + continue; + } + if (aend + 1 == n) { + aend = n; + continue; + } + pwarn("%s FRAGS %d-%d %s\n", + "ALLOCATED", astart, aend, + "MARKED FREE"); + astart = aend = n; + } else { + if (ustart == -1) { + ustart = uend = n; + continue; + } + if (uend + 1 == n) { + uend = n; + continue; + } + pwarn("%s FRAGS %d-%d %s\n", + "UNALLOCATED", ustart, uend, + "MARKED USED"); + ustart = uend = n; + } + } + } + if (astart != -1) + pwarn("%s FRAGS %d-%d %s\n", + "ALLOCATED", astart, aend, + "MARKED FREE"); + if (ustart != -1) + pwarn("%s FRAGS %d-%d %s\n", + "UNALLOCATED", ustart, uend, + "MARKED USED"); + } if (usedsoftdep) { for (i = 0; i < inomapsize; i++) { j = cg_inosused(newcg)[i]; |