Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!dftsrv!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: Re^2: 4BSD file system structure Message-ID: <20893@mimsy.umd.edu> Date: 23 Nov 89 00:40:12 GMT References: <1727@neon.siesoft.co.uk> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 26 In article <1727@neon.siesoft.co.uk> duncan@helium.siesoft.co.uk (Duncan McEwan) writes: >.... Do the disk addresses kept in the inode and indirect blocks >address blocks or fragments? The things *in* ip->i_db[i] are in terms of fragments. The values i used to index into ip->i_db[] are in terms of blocks. That is: ip->i_db[howmany(offset, blksize)] is the fragment-wise block number of the disk-block-or-fragment that holds the bytes from floor(offset/blksize)*blksize to ceil(offset/blksize)*blksize-1. More specifically, on an 8k/1k file system, if you want to find the set of 1024-byte disk `blocks' that contain bytes 8192..16383 of a given file, you look at ip->i_db[1]. If this contains the number 2000, those bytes are in the eight consecutive 1024-byte fragments numbered 2000, 2001, 2002, ..., 2007. If, however, the file is only 10240 bytes long, then there are only two such 1024-byte blocks, namely 2000 and 2001. There are various implications here that I leave to the reader. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris