From owner-freebsd-fs@FreeBSD.ORG Wed Sep 10 01:30:33 2003 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3EEE516A4BF for ; Wed, 10 Sep 2003 01:30:33 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8A8B743FD7 for ; Wed, 10 Sep 2003 01:30:32 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfl2g.dialup.mindspring.com ([165.247.212.80] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19x0Mw-0002xH-00; Wed, 10 Sep 2003 01:30:31 -0700 Message-ID: <3F5EE0E8.40BF5801@mindspring.com> Date: Wed, 10 Sep 2003 01:29:28 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Eno Thereska References: <3F5D0663.7020902@andrew.cmu.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4b640fbc401a98c39e1d7cbb67e53e9dc667c3043c0873f7e350badd9bab72f9c350badd9bab72f9c cc: freebsd-fs@freebsd.org Subject: Re: free block bitmap X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2003 08:30:33 -0000 Eno Thereska wrote: > I am using FreeBSD4.4 with FFS as the underlying file system. > I need to examine which blocks in the file system > are currently in use. These blocks can be metadata or data blocks. > > I have looked at the FFS code and it seems the only way to get > the list of free blocks (or busy blocks) is by querying > each cylinder group's (cg) bitmap of free blocks. > > Is there a global bitmap that keeps track of busy/free blocks > over the entire file system or is the only option > the cg-by-cg lookup? You can do it two ways: 1) Iterate over every file in the filesystem, and examine their direct and indirect blocks. 2) Use the CG bitmaps. Out of curiosity, why aren't the CG bitmaps global enough for you? Is your problem that they are logically rather than physically contiguous? -- Terry