Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jul 2006 10:10:29 -0500
From:      "Rick C. Petty" <rick-freebsd@kiwi-computer.com>
To:        freebsd-fs@FreeBSD.ORG
Subject:   Re: Advice for hacking on ufs/ffs
Message-ID:  <20060728151029.GB58252@megan.kiwi-computer.com>
In-Reply-To: <200607280927.k6S9RG2B072245@lurza.secnetix.de>
References:  <20060727175436.GA48057@megan.kiwi-computer.com> <200607280927.k6S9RG2B072245@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jul 28, 2006 at 11:27:16AM +0200, Oliver Fromme wrote:
> Rick C. Petty wrote:
> 
>  > Not necessarily.  If you install a variant of windoze, the installer will
>  > format the disk first, writing zeros (and metadata) sequentially, and
>  > thus the allocation will not be fragmented.
> 
> Not true.  Last time I installed Windows, it did not
> overwrite the whole disk.  If it did that, it would
> have taken _way_ too long (hours instead of minutes).

XP?  I've certainly tried this with 2000 and it did precisely that.  It
certainly took hours to format 8+G NTFS partitions at install time.  I'll
check this out again today in qemu.  Certainly qemu formats are
significantly faster than native formats, due to FreeBSD's caching
mechanisms.

>  > In the case of UFS newfs
>  > only the metadata will be written for each cylinder group
> 
> No.  Only the superblock copies and block bitmaps are
> written during newfs, nothing else.

For each cylinder group, the following is written:  the superblock, the
cylinder group map (summaries + block free bitmap), and "two blocks worth
of inodes" (for UFS2..  in UFS1, all inode blocks are written).  What else
do you consider is the "metadata" for a filesystem?

>  > and thus the
>  > logical blocks for all metadata will be contiguous.
> 
> Nope.  As soon as you start writing to such a file system,
> it will start allocating space for inodes, indirect block
> lists, directories and file data, which will probably lead
> to massive fragmentation.

Things like indirect blocks will be allocated near the rest of the blocks
for that file.  So in allocation order: the first 12 direct blocks, the
first indirect block, the blocks for that indirect block, rinse, repeat.

Directories are just files, but they get pretty fragmented anyway (if the
size of the directory, in bytes, is larger than one file system block,
which by default is 16k).

I wasn't disputing the fragmentation of these files but the performance of
having the blocks of the underlying file-store allocated in the same order
that UFS allocates them.  It would be interesting to test the performance
difference.

-- Rick C. Petty



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060728151029.GB58252>