Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Nov 2002 03:03:30 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Tomas Pluskal <plusik@pohoda.cz>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: seeking help to rewrite the msdos filesystem
Message-ID:  <3DD0E002.914DA5EF@mindspring.com>
References:  <Pine.LNX.4.30L2.0211121047290.21366-100000@pohoda.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
Tomas Pluskal wrote:
> I believe that everybody here knows about the "slow msdosfs" problem, that
> is AFAIK caused by implementation without clustering.

No; mostly it's non-page aligned accesses, and the fact that
serial access requires traversal of the entire file up to that
point, and so becomes exponential, the further you get into
the file.  See:

    http://www.usenix.org/publications/library/proceedings/sf94/forin.html

The intent of this paper was to make the DOS FS look good, by
caching all FAT metadata, and disabling all normal OS caching
in the FFS implementation.

However, it does have a couple of good suggestions for speeding
FAT file access up.  The most useful is that you should cache
the metadata information, so that you can traverse the list of
FS blocks in memory, instead of on disk, and caching of all the
directory information (for the same reasons).  Because the directory
entry is also the inode, in FAT, this has the effect of caching all
the inodes, as well.

If you want to get fancy, then you would implement the metadata
cachine for file blocks as a btree, so that you could go to a
given block in log2(# of blocks) compares, in memory, instead of
spending a long time traversing sectors.


> For me this is very annoying, because I use digital camera, and ZIP drive,
> and FAT on both of them. Speed is about 10 times lower than it could be..
> I would like to rewrite the msdosfs driver to use clustering (in fact, I
> have chosen it as school project, so I have to do it anyway :).
> 
> Is there anybody, who could spend few minutes and write me some
> information about how these filesystems are implemented, what should I
> read first, and what steps to follow to implement clustering ?
> I am ready to do the hard work :)

I don't think the issue is actually clustering.  If the cluster
size is set, you really don't have a choice, since your block
chain is hung off that, so it's not like FreeBSD goes out of its
way to pessimize access.

As far as alignment goes, make sure the MSDOSFS starts on a 4K
boundary, and you should be OK; otherwise, every 4th one is going
to span a page boundary, and you'll eat a page-in latency over it;
this is less common these days, but it really depends on your ZIP
disk partition layout (in most cases, there's an assumption of 64K
per cylinder/head these days, and 64K is evenly divisible by 4K,
which equals no alignment problem).

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-fs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3DD0E002.914DA5EF>