Subject: Re: msdosfs performance problem
To: Michael van Elst <mlelstv@serpens.de>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: tech-kern
Date: 11/27/2005 13:16:58
On Sun, Nov 27, 2005 at 11:39:18AM +0000, Michael van Elst wrote:
> tonnerre@thundrix.ch (Tonnerre LOMBARD) writes:
> 
> >Salut,
> 
> >On Sun, Nov 27, 2005 at 11:23:02AM +0000, Michael van Elst wrote:
> >> I recently noticed that msdosfs reads from the disk when
> >> you write to it. The number of blocks read is almost the
> >> same as the number of blocks written.
> 
> >That may be partially related to fatfs's weird cluster mapping
> >algorithm.
> 
> Please explain.

File blocks are chained by a pointer from the previous file
block, so if you need to extend the file, you need to walk
the whole file chain (i.e. read all intermediate file blocks)
in order to find last block.

However, this doesn't quite explain the number of reads. While
the file blocks must be read the first time a file is extended,
no more reads should be necessary when the file is extended
again (the data should be in buffer cache).

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
-=- We can walk our road together if our goals are all the same;     -=-
-=- We can run alone and free if we pursue a different aim.          -=-