ATA 4K sector issues
dillon at apollo.backplane.com
Wed Mar 17 21:11:19 UTC 2010
I'll note one last thing with regards to write combining within the
drive's zone cache. Drive zone caches work very well for combing
adjacent sectors when the write zones are perfectly linear (when
the writes within each zone being tracked are perfectly linear).
But the drive zone caches I've tested tend to break down very
quickly when the data is written out of order, even if all the data winds
up being present (could be combined into a linear result).
I posted a program a while back that showed that. Basically writing
512-byte sectors ordered 0, 1, 2, 3, 4, ... is very fast, but the
moment you start writing out of order, e.g. 3, 2, 1, 0, 7, 6, 5, 4,
things start to break down very quickly.
I would suspect the issue with UFS and a 2K fragment size on a 4K
physical sector drive is precisely this. When UFS mixes fragmented
writes with full block writes (related to different files), they
tend to have locality of reference but they also tend to be NOT
perfectly linear. 2K+ gaps will be created during the unpack and
filled later on, but the drive cache can't handle it.
Having lots of directories with a few small files in each probably
doesn't help matters any either but that can't be 'fixed' without
messing up UFS's ability to maintain a relatively unfragmented
filesystem over long periods of time.
This is probably what is tripping the drive up. This implies that
you absolutely must use a 4K fragment size (32K block size) and an
aligned partition when using UFS with 4K physical sector drives.
More information about the freebsd-hackers