On Thu, 2004-12-02 at 12:59 -0500, Colin Walters wrote:
On Thu, 2004-12-02 at 12:40 -0500, David Zeuthen wrote:
I'm almost positive it requires kernel changes to do this the right way; one naive idea is to have a userspace daemon, capturing what blocks are read when (kernel tells this daemon using the kernel events layer). This would run in the first three minutes on each and every boot. When the system is idle (and only when running on AC power!) another daemon rearranges blocks on the disk. What blocks to rearrange could be the result of a computation involving several three-minute result sets.
Rearranging sounds complex and dangerous, since it requires deep integration with the filesystem. The online resizing took quite a long time to appear and that is conceptually much simpler. Why not do it on the block device layer (without knowledge of the filesystem) and just copy those blocks to a reserved area of the block device? Disks are big, duplicating say 100MB for this purpose wouldn't be bad. We would need to ensure that mkfs.ext3 would leave enough space for this though (and probably whatever does the copying would have to make sure that the filesystem wasn't in the way; perhaps an ext flag).
This sounds much simpler and better; for good measure, ensure that the reserved area is in the beginning of the partition as reads are generally faster on lower sectors. This article seems to suggest
http://www.kernelthread.com/mac/apme/optimizations/
that Mac OS X is doing something that like although it appears to be on a file system level rather than a block level. The concept of "hot files" is interesting.
Cheers, David