From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 1 00:32:45 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1B14116A41F; Tue, 1 Nov 2005 00:32:45 +0000 (GMT) (envelope-from markir@paradise.net.nz) Received: from linda-2.paradise.net.nz (bm-2a.paradise.net.nz [203.96.152.181]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77CCF43D80; Tue, 1 Nov 2005 00:32:34 +0000 (GMT) (envelope-from markir@paradise.net.nz) Received: from smtp-1.paradise.net.nz (tclsnelbe2-src-nat-1 [203.96.152.177]) by linda-2.paradise.net.nz (Paradise.net.nz) with ESMTP id <0IP9001CF198B7@linda-2.paradise.net.nz>; Tue, 01 Nov 2005 12:58:20 +1300 (NZDT) Received: from [192.168.1.11] (218-101-13-31.paradise.net.nz [218.101.13.31]) by smtp-1.paradise.net.nz (Postfix) with ESMTP id 2BB25AFBF79; Tue, 01 Nov 2005 12:58:20 +1300 (NZDT) Date: Tue, 01 Nov 2005 12:58:19 +1300 From: Mark Kirkwood In-reply-to: <20051031154701.C80645@fledge.watson.org> To: Robert Watson Message-id: <4366AF9B.6050503@paradise.net.nz> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050726) References: <43633948.5030801@paradise.net.nz> <43663443.2090802@centtech.com> <43663B6C.5020804@samsco.org> <20051031154701.C80645@fledge.watson.org> Cc: freebsd-hackers@freebsd.org, Scott Long , Eric Anderson Subject: Re: Display files currently in the buffer cache X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Nov 2005 00:32:45 -0000 Robert Watson wrote: > On Mon, 31 Oct 2005, Scott Long wrote: > >>>> Assuming not, is it feasible to write one to do this? (if so, any >>>> pointers appreciated - massive FreeBSD internals newbie here....). >>> >>> >>> This would be a cool tool! I've been thinking of that too, and also >>> would like to have a lkdump tool - which dumps information about >>> currently locked files. >> >> >> Does the FreeBSD VM really have a concept of filenames at all? I >> thought that all it understood was buffer objects and vnodes. And >> since there isn't a strong correlation between vnodes and the >> filesystem namespace, it would be hard to provide such information. > > > The usual work-arounds are either to assume this explicitly, showing > device numbers and inodes, or to give it a best effort shot (use the > name cache). Either way, the results are still likely to be useful. > You'll get some obvious messes, such as the results of installworld > deleting old libraries and running processes continuing to use the > deleted ones, resulting in an inode number that doesn't have a name that > can be found. The same approach is taken in lsof, whereby "good enough" > is generally good enough. The problems start when assumptions are made > that paths can always be found. > Yeah - this is what I had in mind. The application is this: I want to be able to show files and pages that a database (Postgres in this case) has cached. So a list of inodes and pages (or page offsets) is fine, as I can pass these to the (postgres) specific part of the utility and it can figure out which inodes correspond to its own files. Maybe the name cache lookup will be good enough for me... Ok, so, ahem, if I were to start on this, what bits of the src should I delve into first? Any other newbie pointers will also be much appreciated :-). (Was meaning to start this yesterday, but got sidetracked with a Promise SX4060 that I can't get to work...). Cheers Mark