*BSD News Article 71200


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!howland.reston.ans.net!newsfeed.internetmci.com!info.ucla.edu!nnrp.info.ucla.edu!nntp.club.cc.cmu.edu!cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!margo
From: margo@eecs.harvard.edu (Margo Seltzer)
Newsgroups: comp.unix.bsd.misc
Subject: Re: Q: fast file system
Date: 17 Jun 1996 12:44:54 GMT
Organization: Harvard University EECS Machines
Lines: 35
Message-ID: <4q3k06$ao3@necco.harvard.edu>
References: <31BDB7F7.41C67EA6@uiuc.edu> <31C10FB0.41C67EA6@uiuc.edu> <4prv02$j36@necco.harvard.edu> <31C22DE5.41C67EA6@uiuc.edu>
NNTP-Posting-Host: cognac.harvard.edu

In article <31C22DE5.41C67EA6@uiuc.edu>, Vlad  <roubtsov@uiuc.edu> wrote:
>Margo Seltzer wrote:
>> 
>
>> Consider an 11 KB file.  It would have two block pointers, the first
>> would point to a whole 8KB block; the second would point to 3, 1KB
>> fragments, contiguously allocated.
>> 
>	Let's say this was our only file so far and it has 2 "block" pointers,
>they are equal to (ignore inodes reserved for any purposes) 0 and 1
>(8k-block #0 taken completely and first 3 1k-fragments of block #1 are
>taken too). Possible so far ? Or would they be equal to 0 and 4 (whole
>block starting at fragment #0 is taken + 3 fragments starting at
>fragment #4) ? 
>	It looks like 2nd scenario is the only one possible. Please confirm.

Very close.  Recall that the disk is addressed by fragments.  So, if the
address of the first block (the full, 8 KB block) is #0, in the
bitmap, 8 bits have been marked as "in-use", because each bit represents
one fragment or 1 KB.  Therefore the next available address is #8.  The
second address in the inode then is #8 and only three bits have been
marked "in-use" in the bitmaps.

By examining the bitmaps, all you know is that 11 fragments have been
allocated; there is no way to determine that they were allocated as
1 full block and a 3-fragment chunk.  From the point of view of the
bitmaps, it could just as likely be that eleven 1 KB files have been
allocated.  Only by traversing through the inodes, using both the
block pointers and the file size can you really tell what is going on
(this is one reason why fsck must examine all the inodes on a file
system to complete file system checking).

Hope this is helpful.

- Margo