diff options
author | jeff <jeff@FreeBSD.org> | 2010-04-24 07:05:35 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2010-04-24 07:05:35 +0000 |
commit | a57449541074720475dfc21dfb8b025695b573eb (patch) | |
tree | e551aa2ab43f7f11c3646b241ebf3f582988d375 /sbin/fsdb | |
parent | 671efe7b2286fbfddcd385e966f431f529ca6376 (diff) | |
download | FreeBSD-src-a57449541074720475dfc21dfb8b025695b573eb.zip FreeBSD-src-a57449541074720475dfc21dfb8b025695b573eb.tar.gz |
- Merge soft-updates journaling from projects/suj/head into head. This
brings in support for an optional intent log which eliminates the need
for background fsck on unclean shutdown.
Sponsored by: iXsystems, Yahoo!, and Juniper.
With help from: McKusick and Peter Holm
Diffstat (limited to 'sbin/fsdb')
-rw-r--r-- | sbin/fsdb/fsdb.c | 11 | ||||
-rw-r--r-- | sbin/fsdb/fsdbutil.c | 26 |
2 files changed, 20 insertions, 17 deletions
diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index f7354e8..5622cbb 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -396,7 +396,8 @@ const char *typename[] = { "unregistered #13", "whiteout", }; - + +int diroff; int slot; int @@ -404,9 +405,10 @@ scannames(struct inodesc *idesc) { struct direct *dirp = idesc->id_dirp; - printf("slot %d ino %d reclen %d: %s, `%.*s'\n", - slot++, dirp->d_ino, dirp->d_reclen, typename[dirp->d_type], - dirp->d_namlen, dirp->d_name); + printf("slot %d off %d ino %d reclen %d: %s, `%.*s'\n", + slot++, diroff, dirp->d_ino, dirp->d_reclen, + typename[dirp->d_type], dirp->d_namlen, dirp->d_name); + diroff += dirp->d_reclen; return (KEEPON); } @@ -416,6 +418,7 @@ CMDFUNCSTART(ls) checkactivedir(); /* let it go on anyway */ slot = 0; + diroff = 0; idesc.id_number = curinum; idesc.id_func = scannames; idesc.id_type = DATA; diff --git a/sbin/fsdb/fsdbutil.c b/sbin/fsdb/fsdbutil.c index d50c6c0..2c5710a 100644 --- a/sbin/fsdb/fsdbutil.c +++ b/sbin/fsdb/fsdbutil.c @@ -52,7 +52,7 @@ static const char rcsid[] = #include "fsck.h" static int charsperline(void); -static int printindir(ufs2_daddr_t blk, int level, char *bufp); +static void printindir(ufs2_daddr_t blk, int level, char *bufp); static void printblocks(ino_t inum, union dinode *dp); char ** @@ -226,7 +226,7 @@ charsperline(void) /* * Recursively print a list of indirect blocks. */ -static int +static void printindir(ufs2_daddr_t blk, int level, char *bufp) { struct bufarea buf, *bp; @@ -234,6 +234,9 @@ printindir(ufs2_daddr_t blk, int level, char *bufp) int i, j, cpl, charssofar; ufs2_daddr_t blkno; + if (blk == 0) + return; + printf("%jd (%d) =>\n", (intmax_t)blk, level); if (level == 0) { /* for the final indirect level, don't use the cache */ bp = &buf; @@ -251,11 +254,8 @@ printindir(ufs2_daddr_t blk, int level, char *bufp) blkno = bp->b_un.b_indir1[i]; else blkno = bp->b_un.b_indir2[i]; - if (blkno == 0) { - if (level == 0) - putchar('\n'); - return 0; - } + if (blkno == 0) + continue; j = sprintf(tempbuf, "%jd", (intmax_t)blkno); if (level == 0) { charssofar += j; @@ -270,13 +270,14 @@ printindir(ufs2_daddr_t blk, int level, char *bufp) charssofar += 2; } else { printf(" =>\n"); - if (printindir(blkno, level - 1, bufp) == 0) - return 0; + printindir(blkno, level - 1, bufp); + printf("\n"); + charssofar = 0; } } if (level == 0) putchar('\n'); - return 1; + return; } @@ -309,7 +310,7 @@ printblocks(ino_t inum, union dinode *dp) } } putchar('\n'); - if (DIP(dp, di_ib[0]) == 0) + if (ndb == 0) return; bufp = malloc((unsigned int)sblock.fs_bsize); @@ -317,8 +318,7 @@ printblocks(ino_t inum, union dinode *dp) errx(EEXIT, "cannot allocate indirect block buffer"); printf("Indirect blocks:\n"); for (i = 0; i < NIADDR; i++) - if (printindir(DIP(dp, di_ib[i]), i, bufp) == 0) - break; + printindir(DIP(dp, di_ib[i]), i, bufp); free(bufp); } |