Re^2: 4BSD file system structure

Duncan McEwan duncan at helium.siesoft.co.uk
Fri Nov 17 03:56:30 AEST 1989


chris at mimsy.umd.edu (Chris Torek) writes:

>#define blksize(fs, ip, lbn) \
>	(((lbn) >= NDADDR || (ip)->i_size >= ((lbn) + 1) << (fs)->fs_bshift) \
>	    ? (fs)->fs_bsize \
>	    : (fragroundup(fs, blkoff(fs, (ip)->i_size))))
> ...
>
>(Thus, files >= 48K (4k/any) or 96K (8K/any) never end in a fragment.)

This last statement reminds me of something I have been puzzling over
recently.  Do the disk addresses kept in the inode and indirect blocks
address blocks or fragments?

The above seems to indicate blocks, since for the size of a file with 
indirect blocks (lbn >= NDADDR) to be >= 48K on a 4K/any filesystem
each of the NDADDR (12) pointers must address a 4K block.

A comment in the "Design and Implementation of 4.3BSD" backs this up.
There it says that to ensure files as large as 2^32 can be created with
only two levels of indirection, the minimum size of a file system block
is 4K.

So if as it seems, the pointers do address blocks rather than fragments,
how can the file system locate which fragments in a block belong to a
the file when the inode only contains a pointer to the block?

Answer by mail if the answer is so obvious that there will be many replys
to this.  I will post the answer if I don't see it here after a reasonable
interval.

---
Duncan (duncan at siesoft.co.uk, ...!ukc!siesoft!duncan)



More information about the Comp.unix.wizards mailing list