From owner-svn-src-stable-7@FreeBSD.ORG Sat Feb 14 22:24:05 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E09AF1065678; Sat, 14 Feb 2009 22:24:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C52258FC17; Sat, 14 Feb 2009 22:24:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1EMO4Fq031960; Sat, 14 Feb 2009 22:24:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1EMO4j9031957; Sat, 14 Feb 2009 22:24:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200902142224.n1EMO4j9031957@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 14 Feb 2009 22:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188618 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern ufs/ffs X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Feb 2009 22:24:05 -0000 Author: kib Date: Sat Feb 14 22:24:04 2009 New Revision: 188618 URL: http://svn.freebsd.org/changeset/base/188618 Log: MFC r183072: 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. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/vfs_bio.c stable/7/sys/ufs/ffs/ffs_softdep.c stable/7/sys/ufs/ffs/ffs_vfsops.c Modified: stable/7/sys/kern/vfs_bio.c ============================================================================== --- stable/7/sys/kern/vfs_bio.c Sat Feb 14 22:07:22 2009 (r188617) +++ stable/7/sys/kern/vfs_bio.c Sat Feb 14 22:24:04 2009 (r188618) @@ -3920,9 +3920,10 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) db_printf("b_flags = 0x%b\n", (u_int)bp->b_flags, PRINT_BUF_FLAGS); db_printf( "b_error = %d, b_bufsize = %ld, b_bcount = %ld, b_resid = %ld\n" - "b_bufobj = (%p), b_data = %p, b_blkno = %jd\n", + "b_bufobj = (%p), b_data = %p, b_blkno = %jd, b_dep = %p\n", bp->b_error, bp->b_bufsize, bp->b_bcount, bp->b_resid, - bp->b_bufobj, bp->b_data, (intmax_t)bp->b_blkno); + bp->b_bufobj, bp->b_data, (intmax_t)bp->b_blkno, + bp->b_dep.lh_first); if (bp->b_npages) { int i; db_printf("b_npages = %d, pages(OBJ, IDX, PA): ", bp->b_npages); @@ -3952,4 +3953,26 @@ DB_SHOW_COMMAND(lockedbufs, lockedbufs) } } } + +DB_SHOW_COMMAND(vnodebufs, db_show_vnodebufs) +{ + struct vnode *vp; + struct buf *bp; + + if (!have_addr) { + db_printf("usage: show vnodebufs \n"); + return; + } + vp = (struct vnode *)addr; + db_printf("Clean buffers:\n"); + TAILQ_FOREACH(bp, &vp->v_bufobj.bo_clean.bv_hd, b_bobufs) { + db_show_buffer((uintptr_t)bp, 1, 0, NULL); + db_printf("\n"); + } + db_printf("Dirty buffers:\n"); + TAILQ_FOREACH(bp, &vp->v_bufobj.bo_dirty.bv_hd, b_bobufs) { + db_show_buffer((uintptr_t)bp, 1, 0, NULL); + db_printf("\n"); + } +} #endif /* DDB */ Modified: stable/7/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_softdep.c Sat Feb 14 22:07:22 2009 (r188617) +++ stable/7/sys/ufs/ffs/ffs_softdep.c Sat Feb 14 22:24:04 2009 (r188618) @@ -41,6 +41,9 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ffs.h" +#include "opt_ddb.h" + /* * For now we want the safety net that DEBUG flags provide. */ @@ -77,7 +80,7 @@ __FBSDID("$FreeBSD$"); #include -#include "opt_ffs.h" +#include #include "opt_quota.h" #ifndef SOFTUPDATES @@ -6336,4 +6339,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 */ Modified: stable/7/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/7/sys/ufs/ffs/ffs_vfsops.c Sat Feb 14 22:07:22 2009 (r188617) +++ stable/7/sys/ufs/ffs/ffs_vfsops.c Sat Feb 14 22:24:04 2009 (r188618) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include "opt_quota.h" #include "opt_ufs.h" #include "opt_ffs.h" +#include "opt_ddb.h" #include #include @@ -71,6 +72,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + static uma_zone_t uma_inode, uma_ufs1, uma_ufs2; static int ffs_reload(struct mount *, struct thread *); @@ -1864,3 +1867,35 @@ ffs_geom_strategy(struct bufobj *bo, str } 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 */