Optimizations
HFS+ also has a few specific optimizations. When a file is opened on an HFS+ volume, the following conditions are teste
The file is less than 20 MB in size
The file is not already busy
The file is not read only
The file is fragmented (the eighth extent descriptor in its extend record has a non-zero block count)
The system uptime is at least 3 minutes
I all the above are satisfied, the file is relocated (de-fragmented) - on-the-fly.
Another optimization is "Hot File Clustering". This is a multi-staged (the stages bein DISABLED, IDLE, BUSY, RECORDING, EVALUATION, EVICTION and ADOPTION) clustering scheme that records "hot" files (except journal files, and ideally quota files) on a volume, and moves "hot" files to the "hot" space on the disk (0.5% of the total filesystem size located at the end of the default metadata zone - at the start of the volume). The scheme uses an on-disk B-Tree file for tracking (/.hotfiles.btree on a volume):
# ls -l /.hotfiles.btree
-rw------- 1 root admin 196608 17 Dec 10:09 /.hotfiles.btree
At most 5000 files, and only files less than 10 MB in size are "adopted" under this schem