On Wed, Sep 08, 2010 at 03:28:50PM -0500, Anthony Liguori wrote: > That's a good point. Is there a reasonable way to do this cooperatively > with the underlying filesystem?
The only thing we can do easily is to try to use as large as possible extents in the allocation. Once we're at a cuple Megabytes the fragmentation doesn't matter too much. > BTW, the same problem would occur for sparse file system images, no? Sparse filesystems images are relatively probe to fragmentation, too. Some filesystems like ext4 have heuristics that try to related physical locality to logical locality, but that only helps if the filesystem is relatively empty. On XFS you can set a minimum extent size which forces the filesystem to allocate more data than nessecary and thus reduce fragmentation. That's equivalent to suggestion a above to use larger extents in the image format.