From owner-freebsd-arch@FreeBSD.ORG Sun Dec 7 16:26:09 2008 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74E4D1065672 for ; Sun, 7 Dec 2008 16:26:09 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from creme-brulee.marcuscom.com (marcuscom-pt.tunnel.tserv1.fmt.ipv6.he.net [IPv6:2001:470:1f00:ffff::1279]) by mx1.freebsd.org (Postfix) with ESMTP id 0983A8FC0C for ; Sun, 7 Dec 2008 16:26:08 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from [IPv6:2001:470:1f00:2464::4] (shumai.marcuscom.com [IPv6:2001:470:1f00:2464::4]) by creme-brulee.marcuscom.com (8.14.3/8.14.3) with ESMTP id mB7GRnGc022591 for ; Sun, 7 Dec 2008 11:27:49 -0500 (EST) (envelope-from marcus@FreeBSD.org) From: Joe Marcus Clarke To: arch@FreeBSD.org Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-tv//F06os/NUUK18nANr" Organization: FreeBSD, Inc. Date: Sun, 07 Dec 2008 11:26:08 -0500 Message-Id: <1228667168.69753.16.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on creme-brulee.marcuscom.com Cc: Subject: RFC: New VOP to translate vnode to its component name X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Dec 2008 16:26:09 -0000 --=-tv//F06os/NUUK18nANr Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Background: Procstat (i.e. kinfo_file) was a great addition which allows userland processes to get a list of open files for a process without the need for elevated privileges (e.g. kmem access). This feature uses the VFS cache to find component names from vnodes in a process' file descriptor table. Because of its ease of use, I quickly deployed it into libgtop so that it could provide an lsof-like feature for FreeBSD. Another need arose that seemed perfect for procstat: the ability to find out what process had the various mouse devices open. This was needed for X.Org's HAL integration. Unfortunately, due to the fact that devfs did not make use of the VFS cache, this was impossible to do without bringing it a lot of kvm code from fstat, or simply exec'ing fstat periodically. I chose the latter. The consequence is easier-to-read code, but a performance hit with default HAL configurations. Robert Watson suggested I teach the VFS cache lookup function to query file systems directly when cache lookups fail. After a few false starts, and with the help of kib, I think I have a committable implementation. Solution: Here is a patch to HEAD, along with a man page, for VOP_CNP. VOP_CNP translates a vnode to its component name. It is currently called from vn_fullpath1() to traverse a vnode hierarchy when cache lookups for those vnodes fail. I have currently implemented VOP_CNP for devfs and pseudofs. Kostik has thoroughly reviewed the devfs implementation. I only recently did the pseudofs implementation at his request. Additionally, the devfs implementation has gone through a Peter Holm stress test, and survives (the pseudofs implementation survives WITNESS and VFS lock debugging). I would like to commit this work with a possible MFC to RELENG_7 to come later. http://www.marcuscom.com/downloads/vop_cnp_10.diff http://www.marcuscom.com/downloads/VOP_CNP.9 Joe --=20 Joe Marcus Clarke FreeBSD GNOME Team :: gnome@FreeBSD.org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome --=-tv//F06os/NUUK18nANr Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkk7+R8ACgkQb2iPiv4Uz4fGFACgl7YfiCV7rZNjFeNpw+4Dvd2E 6ugAoIyZxSFvm4w62izH1j6w5Izj/t4a =PhJ+ -----END PGP SIGNATURE----- --=-tv//F06os/NUUK18nANr--