aboutsummaryrefslogtreecommitdiff
path: root/sbin/ffsinfo
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>2007-02-14 23:20:30 +0000
committerBrian Somers <brian@FreeBSD.org>2007-02-14 23:20:30 +0000
commit30e3c0fa2555882b1d18e5be45107521b043493d (patch)
treeb98b564232e9a0d6fa1e1f2b0643d931f1b995a3 /sbin/ffsinfo
parent89f0730d6b608ee8c05ea68a11b17085c73a7b4a (diff)
downloadsrc-30e3c0fa2555882b1d18e5be45107521b043493d.tar.gz
src-30e3c0fa2555882b1d18e5be45107521b043493d.zip
Only go through our cylinder group and inode info when we need to.
This allows ``ffsinfo -o - -l1 /tmp'' to run a lot quicker.
Notes
Notes: svn path=/head/; revision=166725
Diffstat (limited to 'sbin/ffsinfo')
-rw-r--r--sbin/ffsinfo/ffsinfo.c94
1 files changed, 49 insertions, 45 deletions
diff --git a/sbin/ffsinfo/ffsinfo.c b/sbin/ffsinfo/ffsinfo.c
index 4ec0176659b9..50bb70afdd03 100644
--- a/sbin/ffsinfo/ffsinfo.c
+++ b/sbin/ffsinfo/ffsinfo.c
@@ -186,7 +186,7 @@ main(int argc, char **argv)
device = *argv;
if (out_file == NULL)
errx(1, "out_file not specified");
-
+
/*
* Now we try to guess the (raw)device name.
*/
@@ -270,56 +270,60 @@ main(int argc, char **argv)
}
}
- /* for each requested cylinder group ... */
- for (cylno = cg_start; cylno < cg_stop; cylno++) {
- snprintf(dbg_line, sizeof(dbg_line), "cgr %d", cylno);
- if (cfg_lv & 0x002) {
- /* dump the superblock copies */
+ if (cfg_lv & 0xf8) {
+ /* for each requested cylinder group ... */
+ for (cylno = cg_start; cylno < cg_stop; cylno++) {
+ snprintf(dbg_line, sizeof(dbg_line), "cgr %d", cylno);
+ if (cfg_lv & 0x002) {
+ /* dump the superblock copies */
+ if (bread(&disk, fsbtodb(&sblock,
+ cgsblock(&sblock, cylno)),
+ (void *)&osblock, SBLOCKSIZE) == -1)
+ err(1, "bread: %s", disk.d_error);
+ DBG_DUMP_FS(&osblock, dbg_line);
+ }
+
+ /*
+ * Read the cylinder group and dump whatever was
+ * requested.
+ */
if (bread(&disk, fsbtodb(&sblock,
- cgsblock(&sblock, cylno)),
- (void *)&osblock, SBLOCKSIZE) == -1)
+ cgtod(&sblock, cylno)), (void *)&acg,
+ (size_t)sblock.fs_cgsize) == -1)
err(1, "bread: %s", disk.d_error);
- DBG_DUMP_FS(&osblock, dbg_line);
- }
-
- /*
- * Read the cylinder group and dump whatever was
- * requested.
- */
- if (bread(&disk, fsbtodb(&sblock,
- cgtod(&sblock, cylno)), (void *)&acg,
- (size_t)sblock.fs_cgsize) == -1)
- err(1, "bread: %s", disk.d_error);
- if (cfg_lv & 0x008)
- DBG_DUMP_CG(&sblock, dbg_line, &acg);
- if (cfg_lv & 0x010)
- DBG_DUMP_INMAP(&sblock, dbg_line, &acg);
- if (cfg_lv & 0x020)
- DBG_DUMP_FRMAP(&sblock, dbg_line, &acg);
- if (cfg_lv & 0x040) {
- DBG_DUMP_CLMAP(&sblock, dbg_line, &acg);
- DBG_DUMP_CLSUM(&sblock, dbg_line, &acg);
+ if (cfg_lv & 0x008)
+ DBG_DUMP_CG(&sblock, dbg_line, &acg);
+ if (cfg_lv & 0x010)
+ DBG_DUMP_INMAP(&sblock, dbg_line, &acg);
+ if (cfg_lv & 0x020)
+ DBG_DUMP_FRMAP(&sblock, dbg_line, &acg);
+ if (cfg_lv & 0x040) {
+ DBG_DUMP_CLMAP(&sblock, dbg_line, &acg);
+ DBG_DUMP_CLSUM(&sblock, dbg_line, &acg);
+ }
+ #ifdef NOT_CURRENTLY
+ /*
+ * See the comment in sbin/growfs/debug.c for why this
+ * is currently disabled, and what needs to be done to
+ * re-enable it.
+ */
+ if (disk.d_ufs == 1 && cfg_lv & 0x080)
+ DBG_DUMP_SPTBL(&sblock, dbg_line, &acg);
+ #endif
}
-#ifdef NOT_CURRENTLY
- /*
- * See the comment in sbin/growfs/debug.c for why this
- * is currently disabled, and what needs to be done to
- * re-enable it.
- */
- if (disk.d_ufs == 1 && cfg_lv & 0x080)
- DBG_DUMP_SPTBL(&sblock, dbg_line, &acg);
-#endif
}
- /* Dump the requested inode(s) */
- if (cfg_in != -2)
- DUMP_WHOLE_INODE((ino_t)cfg_in, cfg_lv);
- else {
- for (in = cg_start * sblock.fs_ipg;
- in < (ino_t)cg_stop * sblock.fs_ipg;
- in++)
- DUMP_WHOLE_INODE(in, cfg_lv);
+ if (cfg_lv & 0x300) {
+ /* Dump the requested inode(s) */
+ if (cfg_in != -2)
+ DUMP_WHOLE_INODE((ino_t)cfg_in, cfg_lv);
+ else {
+ for (in = cg_start * sblock.fs_ipg;
+ in < (ino_t)cg_stop * sblock.fs_ipg;
+ in++)
+ DUMP_WHOLE_INODE(in, cfg_lv);
+ }
}
DBG_CLOSE;