Subject: msdosfs: the fatblock() function is called many many times
To: None <tech-kern@netbsd.org>
From: Juan RP <juan@nocturno.xtrarom.org>
List: tech-kern
Date: 09/16/2005 02:26:17
Hi,

I just wanted to know why the msdosfs is so slow copying
large files (>500MB), and I tried to profile the kernel to
see the statistics:

Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 66.96    224.00   224.00                             mpidle
 15.09    274.47    50.47 999302052     0.00     0.00  fatblock
 12.46    316.15    41.68   357648     0.12     0.26  pcbmap
  0.66    318.37     2.22   125566     0.02     0.02  memcpy
  0.53    320.13     1.76   528223     0.00     0.00  i386_copyin
  0.48    321.73     1.60   466034     0.00     0.00  i486_copyout
  0.46    323.28     1.55   369788     0.00     0.00  wdccommand
  0.35    324.44     1.16                             Xintr_legacy5
  0.27    325.33     0.89   369788     0.00     0.00  pciide_dma_init
  0.23    326.10     0.77   113940     0.01     0.01  Xspllower
  0.19    326.74     0.64   369788     0.00     0.00  pciide_dma_finish
  0.16    327.28     0.54                             Xdoreti
  0.14    327.75     0.47   369788     0.00     0.00  pciide_irqack
  0.13    328.18     0.43   369788     0.00     0.00  pciide_dma_start
  0.12    328.59     0.41  2342160     0.00     0.00  incore
  0.11    328.96     0.37   739576     0.00     0.00  __wdcwait
  0.10    329.30     0.34   369788     0.00     0.01  _wdc_ata_bio_start
  0.10    329.62     0.32   740598     0.00     0.00  uhci_intr1
  0.06    329.81     0.19  1527117     0.00     0.00  __qdivrem
  0.04    329.95     0.14  2344123     0.00     0.00  brelse
  0.04    330.09     0.14  1368139     0.00     0.00  lockmgr
  0.04    330.23     0.14  1193671     0.00     0.00  uvm_pagelookup

The profiled kernel showed that the fatblock function was called 
999302052 times! copying a 700MB file into a msdosfs partition.

BTW the CPU usage was at >80% when the half of the file was
copied...
 
And my question is, could that be the cause for the (really slow)
performance in the msdosfs?

Is there anything we can do to improve this situation? 

(I hate to say that having to reboot to windows only to copy large
files into a FAT partition really sucks, but that's what I do
currently...)

Thanks.