Subject: msdosfs performance problem
To: None <tech-kern@netbsd.org>
From: Michael van Elst <mlelstv@serpens.de>
List: tech-kern
Date: 11/27/2005 11:23:02
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.

E.g:

% iostat -x -w 1 sd0
device  read KB/t    r/s   time     MB/s write KB/t    w/s   time     MB/s
sd0         15.99      3   0.17     0.05      16.10      3   0.17     0.05
sd0          0.00      0   0.00     0.00       0.00      0   0.00     0.00
sd0          0.00      0   0.00     0.00       0.00      0   0.00     0.00
sd0          0.00      0   0.00     0.00       0.00      0   0.00     0.00
sd0          0.00      0   0.07     0.00      16.00      1   0.07     0.02
sd0         16.00     14   0.80     0.22      15.43     14   0.80     0.21
sd0         16.00     18   0.88     0.28      16.00     16   0.88     0.25
sd0         16.00     16   0.96     0.25      16.00     20   0.96     0.31
sd0         16.00     19   0.91     0.29      16.00     16   0.91     0.25
sd0         16.00     17   0.95     0.26      16.00     19   0.95     0.29
sd0         16.00     17   0.89     0.26      16.00     17   0.89     0.26
sd0         16.00     19   0.95     0.29      16.00     18   0.95     0.28
sd0         16.00     16   0.88     0.25      16.00     17   0.88     0.26

This is a USB stick, but the same also happens on a normal disk.

msdosfs just maps data blocks using the VM system and copies the
written data in memory with uiomove(). The dirty blocks get page out
later.

I guess there is no optimization done for overwriting complete pages
and the old data is first read from the disk before it gets overwritten.

If that is right, how do other filesystems avoid this problem?


-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."
-- 
-- 
                                Michael van Elst
Internet: mlelstv@serpens.de
                                "A potential Snark may lurk in every tree."