Painful speed for copying to fat32 partitions with small cluster size.

Mark Day mday at
Tue Feb 10 10:33:20 PST 2004

On Feb 7, 2004, at 5:58 AM, Ion-Mihai Tetcu wrote:

> Copying to FAT32 partitions is very slow with small cluster sizes (I 
> was
> copying some 300 - 700MB files):

(My FAT experience is mostly from Darwin/Mac OS X, which was ported 
from FreeBSD a few years ago.  I haven't looked at the FreeBSD sources 
recently to know how relevant these remarks are for FreeBSD).

First of all, smaller clusters sizes means larger FAT tables (more 
entries per table).  This means you end up doing more I/O for a given 
file size.

The Darwin code as originally ported from FreeBSD was using buffer 
cache blocks sized the same as a cluster (that is, one cluster per 
buffer cache block).  But the real problem was that the VOP_BMAP (and 
VOP_CMAP in Darwin) implementation was very naive and always claimed 
that only there were no additional blocks of the file contiguous with 
the one being mapped.  So, read and write ended up doing lots of tiny 
maps and I/Os.  When this was fixed to scan the FAT for contiguous 
clusters, the buffer cache code (what Darwin calls Cluster I/O) was 
able to send much larger I/O requests to the driver.  This made a huge 
difference, and brought streaming I/O performance into line with HFS 
Plus and UFS.


More information about the freebsd-fs mailing list