Very slow writes on flash + msdosfs

Dmitry Marakasov amdmi3 at amdmi3.ru
Thu Oct 4 17:46:57 PDT 2007


Hi!

I have USB flash:

da0 at umass-sim0 bus 0 target 0 lun 0
da0: <JetFlash TS2GJF150 8.07> Removable Direct Access SCSI-2 device 
da0: 40.000MB/s transfers
da0: 1999MB (4095998 512 byte sectors: 255H 63S/T 254C)

It attaches to ehci and I get pretty good read/write speed:

% dd if=/dev/zero of=/dev/da0 bs=1m 
dd: /dev/da0: short write on character device
dd: /dev/da0: end of device
2000+0 records in
1999+1 records out
2097150976 bytes transferred in 178.132363 secs (11772993 bytes/sec)

% dd if=/dev/da0 of=/dev/zero bs=1m count=100
100+0 records in
100+0 records out
104857600 bytes transferred in 7.240738 secs (14481618 bytes/sec)

But newfs_msdos ran on it is very slow:

% time newfs_msdos -F32 -LAMDmi3 -k 0xffff /dev/da0s1 
/dev/da0s1: 4072456 sectors in 509057 FAT32 clusters (4096 bytes/cluster)
bps=512 spc=8 res=32 nft=2 mid=0xf0 spt=63 hds=255 hid=0 bsec=4080447 bspf=3978 rdcl=2 infs=1 bkbs=0xffff
newfs_msdos -F32 -LAMDmi3 -k 0xffff /dev/da0s1  0,02s user 0,21s system 0% cpu 2:54,37 total

when it runs, gkrellm shows 23kb/s writes.

Writing a 1.0Mb directory with 340 files takes 1.5 minutes (up to 300k/sec
writes => seems like much more data is actually written that it's
needed).

Larger files behave somewhat better (up to 3 MB/s).

Btw, dd if=/dev/zero of=/dev/da0 bs=512 show the same 23k/s speed as
newfs_msdosfs.

So where is the problem? Why's there no caching and why's there 1 sector
writes?

PS. I use 6.1, has the situation changed in -CURRENT?

-- 
Best regards,
  Dmitry Marakasov               mailto:amdmi3 at amdmi3.ru


More information about the freebsd-fs mailing list