summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ffs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2008-09-16 11:19:38 +0000
committerkib <kib@FreeBSD.org>2008-09-16 11:19:38 +0000
commit0488506405edd848b205c59066a7f0b5d53e55e7 (patch)
tree5722b46dbcf6b76aa1eb0334df5da361e5c92f37 /sys/ufs/ffs
parent039c5da1b25fe16e767d26bf96a871642f599a7f (diff)
downloadFreeBSD-src-0488506405edd848b205c59066a7f0b5d53e55e7.zip
FreeBSD-src-0488506405edd848b205c59066a7f0b5d53e55e7.tar.gz
Add the ffs structures introspection functions for ddb.
Show the b_dep value for the buffer in the show buffer command. Add a comand to dump the dirty/clean buffer list for vnode. Reviewed by: tegge Tested and used by: pho MFC after: 1 month
Diffstat (limited to 'sys/ufs/ffs')
-rw-r--r--sys/ufs/ffs/ffs_softdep.c31
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c35
2 files changed, 65 insertions, 1 deletions
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index ae532b6..3c9a906 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -41,6 +41,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_ffs.h"
+#include "opt_ddb.h"
+
/*
* For now we want the safety net that the DEBUG flag provides.
*/
@@ -77,7 +80,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
-#include "opt_ffs.h"
+#include <ddb/ddb.h>
#ifndef SOFTUPDATES
@@ -6334,4 +6337,30 @@ softdep_error(func, error)
printf("%s: got error %d while accessing filesystem\n", func, error);
}
+#ifdef DDB
+
+DB_SHOW_COMMAND(inodedeps, db_show_inodedeps)
+{
+ struct inodedep_hashhead *inodedephd;
+ struct inodedep *inodedep;
+ struct fs *fs;
+ int cnt;
+
+ fs = have_addr ? (struct fs *)addr : NULL;
+ for (cnt = 0; cnt < inodedep_hash; cnt++) {
+ inodedephd = &inodedep_hashtbl[cnt];
+ LIST_FOREACH(inodedep, inodedephd, id_hash) {
+ if (fs != NULL && fs != inodedep->id_fs)
+ continue;
+ db_printf("%p fs %p st %x ino %jd inoblk %jd\n",
+ inodedep, inodedep->id_fs, inodedep->id_state,
+ (intmax_t)inodedep->id_ino,
+ (intmax_t)fsbtodb(inodedep->id_fs,
+ ino_to_fsba(inodedep->id_fs, inodedep->id_ino)));
+ }
+ }
+}
+
+#endif /* DDB */
+
#endif /* SOFTUPDATES */
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 67d4496..93e0b48 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include "opt_quota.h"
#include "opt_ufs.h"
#include "opt_ffs.h"
+#include "opt_ddb.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -71,6 +72,8 @@ __FBSDID("$FreeBSD$");
#include <geom/geom.h>
#include <geom/geom_vfs.h>
+#include <ddb/ddb.h>
+
static uma_zone_t uma_inode, uma_ufs1, uma_ufs2;
static int ffs_reload(struct mount *, struct thread *);
@@ -1863,3 +1866,35 @@ ffs_geom_strategy(struct bufobj *bo, struct buf *bp)
}
g_vfs_strategy(bo, bp);
}
+
+#ifdef DDB
+
+static void
+db_print_ffs(struct ufsmount *ump)
+{
+ db_printf("mp %p %s devvp %p fs %p su_wl %d su_wl_in %d su_deps %d "
+ "su_req %d\n",
+ ump->um_mountp, ump->um_mountp->mnt_stat.f_mntonname,
+ ump->um_devvp, ump->um_fs, ump->softdep_on_worklist,
+ ump->softdep_on_worklist_inprogress, ump->softdep_deps,
+ ump->softdep_req);
+}
+
+DB_SHOW_COMMAND(ffs, db_show_ffs)
+{
+ struct mount *mp;
+ struct ufsmount *ump;
+
+ if (have_addr) {
+ ump = VFSTOUFS((struct mount *)addr);
+ db_print_ffs(ump);
+ return;
+ }
+
+ TAILQ_FOREACH(mp, &mountlist, mnt_list) {
+ if (!strcmp(mp->mnt_stat.f_fstypename, ufs_vfsconf.vfc_name))
+ db_print_ffs(VFSTOUFS(mp));
+ }
+}
+
+#endif /* DDB */
OpenPOWER on IntegriCloud